Skip to content

tech: mv breakpoints from js to ts#7161

Merged
inomdzhon merged 1 commit intomasterfrom
imirdzhamolov/tech/breakpoints-to-ts-file
Jul 10, 2024
Merged

tech: mv breakpoints from js to ts#7161
inomdzhon merged 1 commit intomasterfrom
imirdzhamolov/tech/breakpoints-to-ts-file

Conversation

@inomdzhon
Copy link
Copy Markdown
Contributor

Описание

Т.к. /src/shared/breakpoints.js нужен только для /scripts/generateCSSCustomMedias.js внёс следующие изменения:

  1. /src/shared/breakpoints.js -> /src/lib/adaptivity/breakpoints.ts;
  2. /scripts/generateCSSCustomMedias.js -> /scripts/generateCSSCustomMedias.mjs;
  3. перенёс getCustomMedias() из shared.config.js в /scripts/generateCSSCustomMedias.mjs;
  4. /src/lib/adaptivity/breakpoints.ts в /scripts/generateCSSCustomMedias.mjs мы импортируем через fs.readFileSync() и последующий ts.transpileModule(). Выполняем код через import().
  5. в /src/lib/adaptivity/types.ts создал тип CSSCustomMedias и применяю его через JSDoc в getCustomMedias() – теперь yarn workspace @vkontakte/vkui run lint:generated-files будет падать с ошибкой если поменяли брейкпоинты, а в getCustomMedias() поправить забыли;
  6. в /styleguide/Components/Preview заменил импорт @vkui/shared/breakpoints на @vkui/lib/adaptivity;
  7. поправил docs/ADAPTIVITY_GUIDE.md

@inomdzhon inomdzhon added this to the v6.3.0 milestone Jul 9, 2024
@inomdzhon inomdzhon self-assigned this Jul 9, 2024
@inomdzhon inomdzhon requested a review from a team as a code owner July 9, 2024 13:25
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jul 9, 2024

size-limit report 📦

Path Size
JS 372.26 KB (-0.11% 🔽)
JS (gzip) 113.93 KB (-0.14% 🔽)
JS (brotli) 93.77 KB (-0.15% 🔽)
JS import Div (tree shaking) 1.42 KB (0%)
CSS 300 KB (0%)
CSS (gzip) 38.26 KB (0%)
CSS (brotli) 30.79 KB (0%)

@codesandbox-ci
Copy link
Copy Markdown

codesandbox-ci bot commented Jul 9, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jul 9, 2024

e2e tests

Playwright Report

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jul 9, 2024

👀 Docs deployed

Commit 3669009

@codecov
Copy link
Copy Markdown

codecov bot commented Jul 9, 2024

Codecov Report

Attention: Patch coverage is 80.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 83.96%. Comparing base (e728d24) to head (3669009).

Files Patch % Lines
packages/vkui/src/lib/adaptivity/breakpoints.ts 75.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7161      +/-   ##
==========================================
- Coverage   83.98%   83.96%   -0.02%     
==========================================
  Files         358      359       +1     
  Lines       10882    10897      +15     
  Branches     3589     3589              
==========================================
+ Hits         9139     9150      +11     
- Misses       1743     1747       +4     
Flag Coverage Δ
unittests 83.96% <80.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@inomdzhon inomdzhon force-pushed the imirdzhamolov/tech/breakpoints-to-ts-file branch from d31d466 to d76b8ea Compare July 9, 2024 13:48
Т.к. `/src/shared/breakpoints.js` нужен только для `/scripts/generateCSSCustomMedias.js` внёс следующие изменения:

1. `/src/shared/breakpoints.js` -> `/src/lib/adaptivity/breakpoints.ts`;
2. `/scripts/generateCSSCustomMedias.js` -> `/scripts/generateCSSCustomMedias.mjs`;
3. перенёс `getCustomMedias()` из `shared.config.js` в `/scripts/generateCSSCustomMedias.mjs`;
4. `/src/lib/adaptivity/breakpoints.ts` в `/scripts/generateCSSCustomMedias.mjs` мы импортируем через `fs.readFileSync()` и последующий [ts.transpileModule()](https://github.com/Microsoft/TypeScript-wiki/blob/main/Using-the-Compiler-API.md#a-simple-transform-function). Выполняем код через [import()](https://2ality.com/2019/10/eval-via-import.html#evaluating-simple-code-via-import()).
5. в `/src/lib/adaptivity/types.ts` создал тип `CSSCustomMedias` и применяю его через JSDoc в `getCustomMedias()` – теперь `yarn workspace @vkontakte/vkui run lint:generated-files` будет падать с ошибкой если поменяли брейкпоинты, а в `getCustomMedias()` поправить забыли;
6. в `/styleguide/Components/Preview` заменил импорт `@vkui/shared/breakpoints` на `@vkui/lib/adaptivity`;
7. поправил `docs/ADAPTIVITY_GUIDE.md`
@inomdzhon inomdzhon force-pushed the imirdzhamolov/tech/breakpoints-to-ts-file branch from d76b8ea to 3669009 Compare July 9, 2024 13:58
@inomdzhon inomdzhon merged commit 9a6166b into master Jul 10, 2024
@inomdzhon inomdzhon deleted the imirdzhamolov/tech/breakpoints-to-ts-file branch July 10, 2024 07:24
@vkcom-publisher
Copy link
Copy Markdown
Contributor

v6.3.0 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants