diff --git a/package.json b/package.json index fca0e077e7..fa25865c9d 100644 --- a/package.json +++ b/package.json @@ -128,7 +128,7 @@ "lint:style": "cross-env LINT_PRECOMMIT_RUN=1 stylelint '**/*.css' --cache --cache-location .cache/.stylelintcache", "lint:prettier": "prettier --check --ignore-unknown --cache --cache-location .cache/.prettiercache .", "lint:types": "tsc --incremental --emitDeclarationOnly --declaration --tsBuildInfoFile .cache/.tsbuildinfo", - "lint:generated-files": "concurrently 'yarn workspace @vkontakte/vkui run lint:generated-files' 'yarn workspace @vkontakte/vkui-docs-theme run lint:generated-files'", + "lint:generated-files": "yarn workspace @vkontakte/vkui run lint:generated-files", "prepare": "husky", "playwright:install": "playwright install --with-deps", "playwright:cmd:merge-reports": "playwright merge-reports", diff --git a/packages/vkui-docs-theme/package.json b/packages/vkui-docs-theme/package.json index b62bc76e49..dc25098dd7 100644 --- a/packages/vkui-docs-theme/package.json +++ b/packages/vkui-docs-theme/package.json @@ -44,8 +44,6 @@ "react-dom": "^18.3.1" }, "scripts": { - "test": "jest", - "lint:generated-files": "yarn run generate:css-custom-medias && git diff --exit-code styles/customMedias.generated.css", - "generate:css-custom-medias": "node scripts/generateCSSCustomMedias.mjs" + "test": "jest" } } diff --git a/packages/vkui-docs-theme/scripts/generateCSSCustomMedias.mjs b/packages/vkui-docs-theme/scripts/generateCSSCustomMedias.mjs deleted file mode 100644 index ce98b2b4bb..0000000000 --- a/packages/vkui-docs-theme/scripts/generateCSSCustomMedias.mjs +++ /dev/null @@ -1,57 +0,0 @@ -/* eslint no-console: 0 */ -import fs from 'node:fs'; -import path from 'node:path'; -import ts from 'typescript'; - -const inputSourceFilePath = path.resolve(import.meta.dirname, '../src/breakpoints.ts'); -const outputSourceFilePath = path.resolve( - import.meta.dirname, - '../styles/customMedias.generated.css', -); - -/** - * Возвращает медиа выражения необходимые по дизайн-системе. У ключей синтаксис должен быть как у CSS Custom Properties. - * - * > ❗️IMPORTANT❗️ - * > При изменении функции следует вызвать команду `yarn workspace @vkontakte/vkui-docs-theme run generate:css-custom-medias`, - * > для обновления CSS файла, и закоммитить изменения. - * - * @link https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-custom-media - * @link https://github.com/Microsoft/TypeScript-wiki/blob/main/Using-the-Compiler-API.md#a-simple-transform-function - * @link https://2ality.com/2019/10/eval-via-import.html#evaluating-simple-code-via-import() - * - */ -async function main() { - console.log('🔄 Processing...'); - - const sourceTS = fs.readFileSync(inputSourceFilePath, 'utf-8').toString(); - const { outputText: sourceJS } = ts.transpileModule(sourceTS, { - compilerOptions: { module: ts.ModuleKind.ESNext }, - }); - const { MEDIA_QUERIES } = await import( - `data:text/javascript;charset=utf-8,${encodeURIComponent(sourceJS)}` - ); - - const dataRaw = []; - - dataRaw.push('/* ⚠️ Документ сгенерирован автоматически */'); - dataRaw.push('/* 📝 Если требуются изменения, то запустите команду `yarn workspace @vkontakte/vkui-docs-theme run generate:css-custom-medias` */'); // prettier-ignore - dataRaw.push(''); - dataRaw.push('/* stylelint-disable */'); - dataRaw.push( - Object.entries(MEDIA_QUERIES) - .map(([key, value]) => { - return ['/* prettier-ignore */', `@custom-media ${key} ${value};`].join('\n'); - }) - .join('\n'), - ); - dataRaw.push(''); - - const data = dataRaw.join('\n'); - - fs.writeFileSync(outputSourceFilePath, data, 'utf-8'); - - console.log(`✅ ${outputSourceFilePath}`); -} - -void main(); diff --git a/packages/vkui-docs-theme/src/breakpoints.ts b/packages/vkui-docs-theme/src/breakpoints.ts deleted file mode 100644 index 7df34b0cbd..0000000000 --- a/packages/vkui-docs-theme/src/breakpoints.ts +++ /dev/null @@ -1,10 +0,0 @@ -export const BREAKPOINTS = { - DESKTOP: 1250, - TABLET: 500, -}; - -export const MEDIA_QUERIES = { - '--view-mobile': `(max-width: ${BREAKPOINTS.TABLET - 0.1}px)`, - '--view-tablet': `(min-width: ${BREAKPOINTS.TABLET}px) and (max-width: ${BREAKPOINTS.DESKTOP - 0.1}px)`, - '--view-desktop': `(min-width: ${BREAKPOINTS.DESKTOP}px)`, -}; diff --git a/packages/vkui-docs-theme/styles/customMedias.generated.css b/packages/vkui-docs-theme/styles/customMedias.generated.css deleted file mode 100644 index f98763d4f2..0000000000 --- a/packages/vkui-docs-theme/styles/customMedias.generated.css +++ /dev/null @@ -1,10 +0,0 @@ -/* ⚠️ Документ сгенерирован автоматически */ -/* 📝 Если требуются изменения, то запустите команду `yarn workspace @vkontakte/vkui-docs-theme run generate:css-custom-medias` */ - -/* stylelint-disable */ -/* prettier-ignore */ -@custom-media --view-mobile (max-width: 499.9px); -/* prettier-ignore */ -@custom-media --view-tablet (min-width: 500px) and (max-width: 1249.9px); -/* prettier-ignore */ -@custom-media --view-desktop (min-width: 1250px);