-
-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/icons generation reproducibility check #716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
comfrt1k
wants to merge
19
commits into
master
Choose a base branch
from
feat/icons-generation-reproducibility-check
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
b3e16c6
fix(atls-ui-generators): stabilize icon generation
comfrt1k ae538b6
feat(atls-ui-admin): check generated icons
comfrt1k b4d9e17
refactor(atls-ui-generators): flat namings
comfrt1k 5d548f7
fix(atls-ui-generators): return cheerio generator instead of regex
comfrt1k 709036c
refactor(atls-ui-generators): extract lib from scripts
comfrt1k 39742b5
refactor(icons): move generated check under owner
comfrt1k 4770189
refactor(icons): model generated check input constraints
comfrt1k 27d257c
refactor(icons): colocate generated check role types
comfrt1k 1f059fe
refactor(icons): keep generated check output in script
comfrt1k 712a364
refactor(icons): add generated check error contract
comfrt1k 00e9170
refactor(icons): simplify generated check contracts
comfrt1k d79b94c
refactor(icons): colocate generated error messages
comfrt1k c7bcbf9
fix(icons): align check command interfaces
comfrt1k b93ce1a
fix(icons): model generated file drift state
comfrt1k fd4e56b
fix(icons): make input constraints predicates
comfrt1k 6257927
fix(icons): clarify input path failure handling
comfrt1k 15d4dfa
fix(icons): colocate check generated cli
comfrt1k 180355a
fix(icons): expose drift comparison interfaces
comfrt1k 572f3df
fix(icons): split drift messages and interfaces
comfrt1k File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
...d-replacements/build-replacements.util.ts → .../build-replacements/build-replacements.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
generators/icons/src/replacement-utils/build-replacements/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| export * from './build-replacements.util.js' | ||
| export * from './build-replacements.js' |
File renamed without changes.
6 changes: 3 additions & 3 deletions
6
...rs/create-replacement-icon-colors.util.ts → ...-colors/create-replacement-icon-colors.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
generators/icons/src/replacement-utils/create-replacement-icon-colors/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| export * from './create-replacement-icon-colors.util.js' | ||
| export * from './create-replacement-icon-colors.js' |
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
...-replacements/create-replacements.util.ts → ...reate-replacements/create-replacements.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
generators/icons/src/replacement-utils/create-replacements/index.cts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| export * from './create-replacements.util.cjs' | ||
| export * from './create-replacements.cjs' |
2 changes: 1 addition & 1 deletion
2
generators/icons/src/replacement-utils/create-replacements/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| export * from './create-replacements.util.js' | ||
| export * from './create-replacements.js' |
2 changes: 1 addition & 1 deletion
2
...ns/src/replacement-utils/create-replacements/tests/create-replacements.test.interfaces.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...replacement/get-color-replacement.util.ts → ...olor-replacement/get-color-replacement.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
generators/icons/src/replacement-utils/get-color-replacement/index.cts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| export * from './get-color-replacement.util.cjs' | ||
| export * from './get-color-replacement.cjs' |
2 changes: 1 addition & 1 deletion
2
generators/icons/src/replacement-utils/get-color-replacement/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| export * from './get-color-replacement.util.js' | ||
| export * from './get-color-replacement.js' |
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
generators/icons/src/replacement-utils/write-replacements-file/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| export * from './write-replacements-file.util.js' | ||
| export * from './write-replacements-file.js' |
2 changes: 1 addition & 1 deletion
2
...ents-file/write-replacements-file.util.ts → ...lacements-file/write-replacements-file.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...s/icons/src/svgr-utils/build-svgr.util.ts → ...rators/icons/src/svgr-utils/build-svgr.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 0 additions & 21 deletions
21
generators/icons/src/svgr-utils/compile-icons/compile-icons.constants.ts
This file was deleted.
Oops, something went wrong.
54 changes: 54 additions & 0 deletions
54
generators/icons/src/svgr-utils/compile-icons/constants.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| import type { Config } from '@svgr/core' | ||
|
|
||
| import type { SvgrPlugin } from './interfaces.js' | ||
| import type { SvgrPluginModule } from './interfaces.js' | ||
|
|
||
| import { createRequire } from 'node:module' | ||
|
|
||
| import { svgrTemplate } from './template.js' | ||
|
|
||
| const svgrCorePackageName = '@svgr/core/package.json' | ||
|
|
||
| const svgoPluginName = '@svgr/plugin-svgo' | ||
|
|
||
| const jsxPluginName = '@svgr/plugin-jsx' | ||
|
|
||
| const prettierPluginName = '@svgr/plugin-prettier' | ||
|
|
||
| const require = createRequire(import.meta.url) | ||
|
|
||
| const svgrRequire = createRequire(require.resolve(svgrCorePackageName)) | ||
|
|
||
| const loadSvgrPlugin = (pluginName: string): SvgrPlugin => { | ||
| const plugin = svgrRequire(pluginName) as SvgrPlugin | SvgrPluginModule | ||
|
|
||
| if (typeof plugin === 'object' && 'default' in plugin && plugin.default) { | ||
| return plugin.default | ||
| } | ||
|
|
||
| return plugin as SvgrPlugin | ||
| } | ||
|
|
||
| const svgrTransformPlugins = [ | ||
| loadSvgrPlugin(svgoPluginName), | ||
| loadSvgrPlugin(jsxPluginName), | ||
| loadSvgrPlugin(prettierPluginName), | ||
| ] | ||
|
|
||
| export const MASK_ID_PATTERN = /mask0/g | ||
| export const PROPS_SPREAD_FROM = '...props' | ||
| export const PROPS_SPREAD_TO = '...otherProps' | ||
|
|
||
| export const FIFTY_PLUS_PATTERN = '50+' | ||
| export const FIFTY_PLUS_REPLACEMENT = 'FiftyPlus' | ||
|
|
||
| export const svgrTransformConfig: Config = { | ||
| icon: true, | ||
| typescript: true, | ||
| template: svgrTemplate, | ||
| plugins: svgrTransformPlugins, | ||
| svgProps: { | ||
| className: `{clsx(className, String(otherProps.className || ''))}`, | ||
| style: '{iconStyle}', | ||
| }, | ||
| } |
6 changes: 3 additions & 3 deletions
6
...ls/compile-icons/compile-icon-jsx.util.ts → .../src/svgr-utils/compile-icons/icon-jsx.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 9 additions & 9 deletions
18
...utils/compile-icons/compile-icons.util.ts → ...ons/src/svgr-utils/compile-icons/icons.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| export * from './compile-icon-jsx.util.js' | ||
| export * from './compile-icons.template.js' | ||
| export * from './compile-icons.util.js' | ||
| export * from './icon-jsx.js' | ||
| export * from './icons.js' | ||
| export * from './template.js' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import type { Config } from '@svgr/core' | ||
|
|
||
| export type SvgrPlugin = NonNullable<Config['plugins']>[number] | ||
|
|
||
| export interface SvgrPluginModule { | ||
| default?: SvgrPlugin | ||
| } |
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...ons/src/svgr-utils/discover-icons.util.ts → ...rs/icons/src/svgr-utils/discover-icons.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export const styleColorAttributeKey = 'style' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
generators/icons/src/svgr-utils/get-svg-colors/get-svg-colors.constants.ts
This file was deleted.
Oops, something went wrong.
8 changes: 4 additions & 4 deletions
8
...ils/get-svg-colors/get-svg-colors.util.ts → ...gr-utils/get-svg-colors/get-svg-colors.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...s/get-svg-colors/validate-color.helper.ts → .../get-svg-colors/helpers/validate-color.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| export * from './get-svg-colors.util.js' | ||
| export type * from './get-svg-colors.interfaces.js' | ||
| export * from './get-svg-colors.js' | ||
| export type * from './interfaces.js' |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| export * from './build-svgr.util.js' | ||
| export * from './build-svgr.js' | ||
| export * from './compile-icons/index.js' | ||
| export * from './discover-icons.util.js' | ||
| export * from './discover-icons.js' | ||
| export * from './get-svg-colors/index.js' |
2 changes: 1 addition & 1 deletion
2
...c/svgr-utils/write-compiled-icons.util.ts → ...ns/src/svgr-utils/write-compiled-icons.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import { checkSuccessMessage } from './constants.js' | ||
| import { outputLineBreak } from './constants.js' | ||
| import { checkGenerated } from './index.js' | ||
|
|
||
| try { | ||
| await checkGenerated() | ||
| process.stdout.write(`${checkSuccessMessage}${outputLineBreak}`) | ||
| } catch (error) { | ||
| const errorMessage = error instanceof Error ? (error.stack ?? error.message) : String(error) | ||
|
|
||
| process.stderr.write(`${errorMessage}${outputLineBreak}`) | ||
| process.exitCode = 1 | ||
| } |
|
TorinAsakura marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| export interface CommandOptions { | ||
| cwd?: string | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.