@dxtmisha/scripts 0.11.8 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +57 -0
- package/ai-resources/componentMaterials.md +19 -0
- package/ai-resources/componentPrompt.md +381 -0
- package/ai-resources/componentWiki.md +13 -0
- package/bin/arguments.ts +168 -0
- package/bin/build-packages.ts +12 -2
- package/bin/build-publish-packages.ts +12 -2
- package/bin/design-component.ts +7 -1
- package/bin/design-constructor.ts +22 -3
- package/bin/design-figma.ts +26 -4
- package/bin/design-flags.ts +14 -2
- package/bin/design-library.ts +7 -1
- package/bin/design-package.ts +29 -5
- package/bin/design-prompt.ts +22 -3
- package/bin/design-screenshot.ts +12 -2
- package/bin/design-types-save.ts +32 -5
- package/bin/design-types.ts +32 -6
- package/bin/design-ui.ts +21 -3
- package/bin/design-wiki-storm.ts +11 -3
- package/dist/AiZAi-x3CInynJ.js +232 -0
- package/dist/PropertiesConfig-ChizwW5y.js +250 -0
- package/{src/config.ts → dist/config.d.ts} +179 -158
- package/dist/config.js +20 -0
- package/dist/figmaApiTypes-CArSsNW8.js +6 -0
- package/dist/library-ai.d.ts +482 -0
- package/dist/library-ai.js +2 -0
- package/dist/library-figma.d.ts +462 -0
- package/dist/library-figma.js +75 -0
- package/dist/library-ui.d.ts +586 -0
- package/dist/library-ui.js +3760 -0
- package/dist/library.d.ts +4677 -0
- package/dist/library.js +1436 -0
- package/dist/propertyTypes-DflziKuR.js +236 -0
- package/package.json +69 -20
- package/bin/ai-doc.ts +0 -7
- package/bin/build-functional.ts +0 -5
- package/bin/design-component-wiki.ts +0 -11
- package/src/classes/Ai/AiAbstract.ts +0 -242
- package/src/classes/Ai/AiClaude.ts +0 -26
- package/src/classes/Ai/AiClaudeAgent.ts +0 -16
- package/src/classes/Ai/AiClaudeAgentLite.ts +0 -86
- package/src/classes/Ai/AiClaudeCli.ts +0 -24
- package/src/classes/Ai/AiClaudeCliLite.ts +0 -108
- package/src/classes/Ai/AiClaudeLite.ts +0 -112
- package/src/classes/Ai/AiDoc.ts +0 -81
- package/src/classes/Ai/AiDocItem.ts +0 -27
- package/src/classes/Ai/AiDocItemAbstract.ts +0 -209
- package/src/classes/Ai/AiDocItemClasses.ts +0 -27
- package/src/classes/Ai/AiDocItemComposables.ts +0 -20
- package/src/classes/Ai/AiDocType.ts +0 -45
- package/src/classes/Ai/AiGoogle.ts +0 -26
- package/src/classes/Ai/AiGoogleCli.ts +0 -24
- package/src/classes/Ai/AiGoogleCliLite.ts +0 -108
- package/src/classes/Ai/AiGoogleLite.ts +0 -78
- package/src/classes/Ai/AiOpenAi.ts +0 -26
- package/src/classes/Ai/AiOpenAiLite.ts +0 -107
- package/src/classes/Ai/AiZAi.ts +0 -17
- package/src/classes/Ai/AiZAiLite.ts +0 -77
- package/src/classes/Ai/ApiTmp.ts +0 -43
- package/src/classes/BrowserItem.ts +0 -408
- package/src/classes/Build/BuildFunctional.ts +0 -54
- package/src/classes/Build/BuildPackages.ts +0 -137
- package/src/classes/Build/BuildPublishPackages.ts +0 -105
- package/src/classes/BuildItem.ts +0 -187
- package/src/classes/Component/ComponentCreator.ts +0 -45
- package/src/classes/Component/ComponentItem.ts +0 -161
- package/src/classes/Component/ComponentWiki.ts +0 -258
- package/src/classes/Component/ComponentWikiFile.ts +0 -138
- package/src/classes/Design/DesignCommand.ts +0 -243
- package/src/classes/Design/DesignComponent.ts +0 -824
- package/src/classes/Design/DesignConstructor.ts +0 -222
- package/src/classes/Design/DesignConstructors.ts +0 -101
- package/src/classes/Design/DesignFigma.ts +0 -61
- package/src/classes/Design/DesignFlags.ts +0 -215
- package/src/classes/Design/DesignReplace.ts +0 -672
- package/src/classes/Design/DesignScreenshot.ts +0 -140
- package/src/classes/Design/DesignStructure.ts +0 -201
- package/src/classes/Design/DesignStructureClasses.ts +0 -105
- package/src/classes/Design/DesignStructureItemAbstract.ts +0 -52
- package/src/classes/Design/DesignStructureRead.ts +0 -349
- package/src/classes/Design/DesignStructureStyles.ts +0 -45
- package/src/classes/Design/DesignTypes.ts +0 -94
- package/src/classes/Design/DesignTypesAi.ts +0 -135
- package/src/classes/Design/DesignTypesDescription.ts +0 -121
- package/src/classes/Design/DesignTypesMake.ts +0 -460
- package/src/classes/Design/DesignTypesMcp.ts +0 -90
- package/src/classes/Design/DesignTypesPrompts.ts +0 -332
- package/src/classes/Design/DesignTypescript.ts +0 -244
- package/src/classes/Design/DesignUi.ts +0 -143
- package/src/classes/Design/DesignWiki.ts +0 -52
- package/src/classes/Design/DesignWikiStorm.ts +0 -95
- package/src/classes/Design/DesignWikiStormItem.ts +0 -316
- package/src/classes/FigmaApi.ts +0 -190
- package/src/classes/Git/GitRead.ts +0 -261
- package/src/classes/Library/LibraryAiMcpItem.ts +0 -67
- package/src/classes/Library/LibraryAiPrompt.ts +0 -268
- package/src/classes/Library/LibraryAiPromptItem.ts +0 -331
- package/src/classes/Library/LibraryAiWiki.ts +0 -127
- package/src/classes/Library/LibraryAiWikiItem.ts +0 -79
- package/src/classes/Library/LibraryExport.ts +0 -167
- package/src/classes/Library/LibraryFlags.ts +0 -62
- package/src/classes/Library/LibraryItems.ts +0 -138
- package/src/classes/Library/LibraryList.ts +0 -189
- package/src/classes/Library/LibraryMedia.ts +0 -139
- package/src/classes/Library/LibraryPlugin.ts +0 -73
- package/src/classes/Library/LibraryTypes.ts +0 -130
- package/src/classes/Package/PackageFile.ts +0 -154
- package/src/classes/Package/PackageInit.ts +0 -54
- package/src/classes/Package/PackageItem.ts +0 -329
- package/src/classes/Properties/Properties.ts +0 -175
- package/src/classes/Properties/PropertiesCache.ts +0 -248
- package/src/classes/Properties/PropertiesConfig.ts +0 -213
- package/src/classes/Properties/PropertiesConvector.ts +0 -52
- package/src/classes/Properties/PropertiesFile.ts +0 -522
- package/src/classes/Properties/PropertiesImport.ts +0 -182
- package/src/classes/Properties/PropertiesItems.ts +0 -605
- package/src/classes/Properties/PropertiesKeys.ts +0 -121
- package/src/classes/Properties/PropertiesMain.ts +0 -138
- package/src/classes/Properties/PropertiesPalette.ts +0 -149
- package/src/classes/Properties/PropertiesPath.ts +0 -193
- package/src/classes/Properties/PropertiesScss.ts +0 -261
- package/src/classes/Properties/PropertiesSeparator.ts +0 -118
- package/src/classes/Properties/PropertiesSettings.ts +0 -104
- package/src/classes/Properties/PropertiesStandard.ts +0 -180
- package/src/classes/Properties/PropertiesTool.ts +0 -80
- package/src/classes/Properties/PropertiesTypes.ts +0 -147
- package/src/classes/Properties/PropertiesValues.ts +0 -75
- package/src/classes/Properties/PropertiesWrap.ts +0 -187
- package/src/classes/Properties/convector/convectorColor.ts +0 -27
- package/src/classes/Properties/convector/convectorFontFamilies.ts +0 -18
- package/src/classes/Properties/convector/convectorShadow.ts +0 -61
- package/src/classes/Properties/convector/convectorTypography.ts +0 -19
- package/src/classes/Properties/to/PropertiesToAbstract.ts +0 -51
- package/src/classes/Properties/to/PropertiesToAnimate.ts +0 -59
- package/src/classes/Properties/to/PropertiesToClass.ts +0 -49
- package/src/classes/Properties/to/PropertiesToClone.ts +0 -114
- package/src/classes/Properties/to/PropertiesToComponent.ts +0 -52
- package/src/classes/Properties/to/PropertiesToDrag.ts +0 -231
- package/src/classes/Properties/to/PropertiesToDuplicate.ts +0 -165
- package/src/classes/Properties/to/PropertiesToFull.ts +0 -36
- package/src/classes/Properties/to/PropertiesToLink.ts +0 -259
- package/src/classes/Properties/to/PropertiesToMedia.ts +0 -187
- package/src/classes/Properties/to/PropertiesToMulti.ts +0 -101
- package/src/classes/Properties/to/PropertiesToNone.ts +0 -46
- package/src/classes/Properties/to/PropertiesToPalette.ts +0 -241
- package/src/classes/Properties/to/PropertiesToProperty.ts +0 -31
- package/src/classes/Properties/to/PropertiesToRemove.ts +0 -33
- package/src/classes/Properties/to/PropertiesToReplace.ts +0 -77
- package/src/classes/Properties/to/PropertiesToRoot.ts +0 -40
- package/src/classes/Properties/to/PropertiesToSimilar.ts +0 -128
- package/src/classes/Properties/to/PropertiesToSort.ts +0 -146
- package/src/classes/Properties/to/PropertiesToState.ts +0 -65
- package/src/classes/Properties/to/PropertiesToStyle.ts +0 -52
- package/src/classes/Properties/to/PropertiesToSub.ts +0 -95
- package/src/classes/Properties/to/PropertiesToSubclass.ts +0 -76
- package/src/classes/Properties/to/PropertiesToVar.ts +0 -194
- package/src/classes/Properties/to/PropertiesToVariable.ts +0 -176
- package/src/classes/Styles/Styles.ts +0 -247
- package/src/classes/Styles/StylesClasses.ts +0 -86
- package/src/classes/Styles/StylesProperties.ts +0 -197
- package/src/classes/Styles/StylesRoot.ts +0 -103
- package/src/classes/Styles/StylesTool.ts +0 -112
- package/src/classes/Styles/to/StylesToAbstract.ts +0 -93
- package/src/classes/Styles/to/StylesToAnimate.ts +0 -19
- package/src/classes/Styles/to/StylesToClass.ts +0 -25
- package/src/classes/Styles/to/StylesToClassFull.ts +0 -19
- package/src/classes/Styles/to/StylesToContainer.ts +0 -24
- package/src/classes/Styles/to/StylesToMedia.ts +0 -19
- package/src/classes/Styles/to/StylesToProperty.ts +0 -123
- package/src/classes/Styles/to/StylesToRoot.ts +0 -14
- package/src/classes/Styles/to/StylesToSelector.ts +0 -71
- package/src/classes/Styles/to/StylesToVar.ts +0 -105
- package/src/classes/Styles/to/StylesToVirtual.ts +0 -33
- package/src/composables/useAi.ts +0 -38
- package/src/demo/ai.ts +0 -10
- package/src/functions/getComponentPaths.ts +0 -13
- package/src/functions/getConfigAi.ts +0 -14
- package/src/functions/getConstructorProperties.ts +0 -54
- package/src/functions/getDirname.ts +0 -17
- package/src/functions/getNameDirByPaths.ts +0 -16
- package/src/functions/getPackageJson.ts +0 -19
- package/src/functions/hasNativeDirname.ts +0 -8
- package/src/functions/run.ts +0 -47
- package/src/functions/toPathStandardSep.ts +0 -14
- package/src/library-ai.ts +0 -10
- package/src/library.ts +0 -73
- package/src/media/ai/ai-doc-types.ts +0 -21
- package/src/media/properties/css.ts +0 -634
- package/src/media/properties/cssSelector.ts +0 -74
- package/src/media/properties/cssVirtual.ts +0 -12
- package/src/media/properties/listSort.ts +0 -113
- package/src/media/properties/style.ts +0 -81
- package/src/media/templates/component/DesignComponent.mdx +0 -30
- package/src/media/templates/component/DesignComponent.stories.ts +0 -34
- package/src/media/templates/component/DesignComponent.vue +0 -54
- package/src/media/templates/component/DesignComponentAiWiki.vue +0 -25
- package/src/media/templates/component/index.ts +0 -13
- package/src/media/templates/component/props.ts +0 -27
- package/src/media/templates/component/styleToken.scss +0 -17
- package/src/media/templates/component/wiki.ts +0 -13
- package/src/media/templates/component/wikiData.ts +0 -28
- package/src/media/templates/componentDoc/ComponentDoc.vue +0 -26
- package/src/media/templates/componentDoc/index.ts +0 -12
- package/src/media/templates/componentDoc/materials/README.md +0 -8
- package/src/media/templates/componentDoc/materials/prompt.md +0 -38
- package/src/media/templates/componentDoc/subcomponents/_.gitignore.txt +0 -0
- package/src/media/templates/componentDoc/types.ts +0 -15
- package/src/media/templates/componentDoc/wiki/ComponentDoc.mdx +0 -13
- package/src/media/templates/componentDoc/wiki/ComponentDoc.stories.ts +0 -24
- package/src/media/templates/componentDoc/wiki/prompt.md +0 -41
- package/src/media/templates/constructors/Constructors.ts +0 -33
- package/src/media/templates/constructors/ConstructorsDesign.tsx +0 -129
- package/src/media/templates/constructors/basicTypes.ts +0 -0
- package/src/media/templates/constructors/index.ts +0 -5
- package/src/media/templates/constructors/props.ts +0 -28
- package/src/media/templates/constructors/style.scss +0 -5
- package/src/media/templates/constructors/types.ts +0 -47
- package/src/media/templates/packages/figma/README.md +0 -1
- package/src/media/templates/packages/figma/_.gitignore.txt +0 -29
- package/src/media/templates/packages/figma/ai.sample.config.ts +0 -2
- package/src/media/templates/packages/figma/design.config.json +0 -3
- package/src/media/templates/packages/figma/index.html +0 -12
- package/src/media/templates/packages/figma/manifest.json +0 -25
- package/src/media/templates/packages/figma/package.json +0 -37
- package/src/media/templates/packages/figma/src/App.vue +0 -9
- package/src/media/templates/packages/figma/src/classes/_.gitignore.txt +0 -1
- package/src/media/templates/packages/figma/src/code.ts +0 -16
- package/src/media/templates/packages/figma/src/components/_.gitignore.txt +0 -1
- package/src/media/templates/packages/figma/src/composables/_.gitignore.txt +0 -1
- package/src/media/templates/packages/figma/src/config.ts +0 -0
- package/src/media/templates/packages/figma/src/functions/_.gitignore.txt +0 -1
- package/src/media/templates/packages/figma/src/library.ts +0 -0
- package/src/media/templates/packages/figma/src/main.ts +0 -4
- package/src/media/templates/packages/figma/src/media/_.gitignore.txt +0 -1
- package/src/media/templates/packages/figma/src/storybook/_.gitignore.txt +0 -1
- package/src/media/templates/packages/figma/src/types/_.gitignore.txt +0 -1
- package/src/media/templates/packages/figma/src/vite-env.d.ts +0 -1
- package/src/media/templates/packages/figma/tsconfig.app.json +0 -12
- package/src/media/templates/packages/figma/tsconfig.json +0 -7
- package/src/media/templates/packages/figma/tsconfig.node.json +0 -8
- package/src/media/templates/packages/figma/vite.config.ts +0 -7
- package/src/media/templates/packages/library/README.md +0 -1
- package/src/media/templates/packages/library/_.gitignore.txt +0 -27
- package/src/media/templates/packages/library/ai-description.md +0 -15
- package/src/media/templates/packages/library/design.config.json +0 -3
- package/src/media/templates/packages/library/index.html +0 -12
- package/src/media/templates/packages/library/materials/README.md +0 -8
- package/src/media/templates/packages/library/materials/prompt.md +0 -45
- package/src/media/templates/packages/library/package.json +0 -46
- package/src/media/templates/packages/library/src/App.vue +0 -8
- package/src/media/templates/packages/library/src/classes/_.gitignore.txt +0 -1
- package/src/media/templates/packages/library/src/components/_.gitignore.txt +0 -1
- package/src/media/templates/packages/library/src/composables/_.gitignore.txt +0 -1
- package/src/media/templates/packages/library/src/functions/_.gitignore.txt +0 -1
- package/src/media/templates/packages/library/src/library.ts +0 -0
- package/src/media/templates/packages/library/src/main.ts +0 -6
- package/src/media/templates/packages/library/src/style.scss +0 -0
- package/src/media/templates/packages/library/src/types/_.gitignore.txt +0 -1
- package/src/media/templates/packages/library/src/vite-env.d.ts +0 -1
- package/src/media/templates/packages/library/tsconfig.app.json +0 -11
- package/src/media/templates/packages/library/tsconfig.json +0 -7
- package/src/media/templates/packages/library/tsconfig.node.json +0 -7
- package/src/media/templates/packages/library/vite.config.ts +0 -14
- package/src/media/templates/packages/nitro/README.md +0 -1
- package/src/media/templates/packages/nitro/_.gitignore.txt +0 -28
- package/src/media/templates/packages/nitro/index.html +0 -2
- package/src/media/templates/packages/nitro/package.json +0 -25
- package/src/media/templates/packages/nitro/server/plugins/ui-plugin.ts +0 -7
- package/src/media/templates/packages/nitro/server/routes/api/hello.ts +0 -13
- package/src/media/templates/packages/nitro/src/App.vue +0 -10
- package/src/media/templates/packages/nitro/src/assets/_.gitignore.txt +0 -0
- package/src/media/templates/packages/nitro/src/components/_.gitignore.txt +0 -0
- package/src/media/templates/packages/nitro/src/composables/_.gitignore.txt +0 -0
- package/src/media/templates/packages/nitro/src/entry-client.ts +0 -13
- package/src/media/templates/packages/nitro/src/entry-server.ts +0 -29
- package/src/media/templates/packages/nitro/src/main.ts +0 -14
- package/src/media/templates/packages/nitro/src/pages/HomePage.vue +0 -8
- package/src/media/templates/packages/nitro/src/router.ts +0 -11
- package/src/media/templates/packages/nitro/src/style.scss +0 -0
- package/src/media/templates/packages/nitro/src/templates/main.html +0 -21
- package/src/media/templates/packages/nitro/src/vite-env.d.ts +0 -11
- package/src/media/templates/packages/nitro/tsconfig.app.json +0 -14
- package/src/media/templates/packages/nitro/tsconfig.json +0 -7
- package/src/media/templates/packages/nitro/tsconfig.node.json +0 -12
- package/src/media/templates/packages/nitro/vite.config.ts +0 -17
- package/src/media/templates/packages/project/README.md +0 -1
- package/src/media/templates/packages/project/_.gitignore.txt +0 -28
- package/src/media/templates/packages/project/design.config.json +0 -3
- package/src/media/templates/packages/project/index.html +0 -12
- package/src/media/templates/packages/project/materials/README.md +0 -8
- package/src/media/templates/packages/project/materials/prompt.md +0 -41
- package/src/media/templates/packages/project/package.json +0 -13
- package/src/media/templates/packages/project/public/_.gitignore.txt +0 -0
- package/src/media/templates/packages/project/src/App.vue +0 -12
- package/src/media/templates/packages/project/src/assets/_.gitignore.txt +0 -0
- package/src/media/templates/packages/project/src/components/_.gitignore.txt +0 -0
- package/src/media/templates/packages/project/src/composables/_.gitignore.txt +0 -0
- package/src/media/templates/packages/project/src/main.ts +0 -6
- package/src/media/templates/packages/project/src/style.scss +0 -0
- package/src/media/templates/packages/project/src/vite-env.d.ts +0 -1
- package/src/media/templates/packages/project/tsconfig.app.json +0 -11
- package/src/media/templates/packages/project/tsconfig.json +0 -7
- package/src/media/templates/packages/project/tsconfig.node.json +0 -7
- package/src/media/templates/packages/project/vite.config.ts +0 -7
- package/src/media/templates/prompts/aiCodeGlobalPrompt.en.md +0 -22
- package/src/media/templates/prompts/aiCodeGlobalPrompt.ru.md +0 -21
- package/src/media/templates/prompts/aiCodeVuePrompt.en.md +0 -17
- package/src/media/templates/prompts/aiCodeVuePrompt.ru.md +0 -17
- package/src/media/templates/prompts/aiDocClassPrompt.en.txt +0 -63
- package/src/media/templates/prompts/aiDocClassPrompt.ru.txt +0 -63
- package/src/media/templates/prompts/aiDocComposablePrompt.en.txt +0 -67
- package/src/media/templates/prompts/aiDocComposablePrompt.ru.txt +0 -67
- package/src/media/templates/prompts/aiDocFunctionPrompt.en.txt +0 -57
- package/src/media/templates/prompts/aiDocFunctionPrompt.ru.txt +0 -57
- package/src/media/templates/prompts/componentPrompt.en.txt +0 -182
- package/src/media/templates/prompts/componentPrompt.ru.txt +0 -182
- package/src/media/templates/prompts/demoClassEn.mdx +0 -111
- package/src/media/templates/prompts/demoClassRu.mdx +0 -111
- package/src/media/templates/prompts/demoComponentEn.mdx +0 -282
- package/src/media/templates/prompts/demoComponentRu.mdx +0 -282
- package/src/media/templates/prompts/demoComposableEn.mdx +0 -103
- package/src/media/templates/prompts/demoComposableRu.mdx +0 -103
- package/src/media/templates/prompts/demoDocEn.mdx +0 -30
- package/src/media/templates/prompts/demoDocRu.mdx +0 -30
- package/src/media/templates/viteComponentTemplateConfig.ts +0 -14
- package/src/types/aiTypes.ts +0 -19
- package/src/types/configTypes.ts +0 -69
- package/src/types/designTypes.ts +0 -167
- package/src/types/figmaApiTypes.ts +0 -337
- package/src/types/gitTypes.ts +0 -59
- package/src/types/libraryTypes.ts +0 -49
- package/src/types/propertyTypes.ts +0 -586
- package/src/types/screenshotTypes.ts +0 -55
- package/src/types/webTypes.ts +0 -134
- package/src/vite-env.d.ts +0 -1
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
import { LibraryItems } from './LibraryItems'
|
|
2
|
-
|
|
3
|
-
import { forEach, toCamelCase, toKebabCase, uniqueArray } from '@dxtmisha/functional-basic'
|
|
4
|
-
import { getPackageJson } from '../../functions/getPackageJson'
|
|
5
|
-
|
|
6
|
-
import { PropertiesConfig } from '../Properties/PropertiesConfig'
|
|
7
|
-
import { PropertiesFile } from '../Properties/PropertiesFile'
|
|
8
|
-
|
|
9
|
-
import { UI_DIRS_STYLES, UI_FILE_NAME_DESIGN } from '../../config'
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Class for generating the design system overview file, including component imports and regular expressions.
|
|
13
|
-
*
|
|
14
|
-
* Класс для создания обзорного файла дизайн-системы, включая импорты компонентов и регулярные выражения.
|
|
15
|
-
*/
|
|
16
|
-
export class LibraryList {
|
|
17
|
-
protected readonly packageName: string
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Constructor for LibraryList.
|
|
21
|
-
*
|
|
22
|
-
* Конструктор для LibraryList.
|
|
23
|
-
* @param items object for working with the list of components / объект для работы со списком компонентов
|
|
24
|
-
*/
|
|
25
|
-
constructor(
|
|
26
|
-
protected readonly items: LibraryItems
|
|
27
|
-
) {
|
|
28
|
-
this.packageName = getPackageJson()?.name
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Creates the design system overview file (`design.ts`) with metadata and component lists.
|
|
33
|
-
*
|
|
34
|
-
* Создает обзорный файл дизайн-системы (`design.ts`) с метаданными и списками компонентов.
|
|
35
|
-
* @returns this
|
|
36
|
-
*/
|
|
37
|
-
make(): this {
|
|
38
|
-
const list = this.getComponents()
|
|
39
|
-
const listReg = this.getComponentsReg()
|
|
40
|
-
|
|
41
|
-
this.items.write(
|
|
42
|
-
UI_FILE_NAME_DESIGN,
|
|
43
|
-
[
|
|
44
|
-
'import type { PluginComponentImports } from \'@dxtmisha/constructor/plugin\'',
|
|
45
|
-
'',
|
|
46
|
-
`// count: ${this.items.getCount()}`,
|
|
47
|
-
`export const designName: string = '${PropertiesConfig.getDesignName()}'`,
|
|
48
|
-
`export const packageName: string = '${this.packageName}'`,
|
|
49
|
-
`export const componentsReg: RegExp = ${listReg}`,
|
|
50
|
-
`export const styleVarsReg: RegExp = ${this.getVarsReg()}`,
|
|
51
|
-
'',
|
|
52
|
-
'export const componentsList: PluginComponentImports = [',
|
|
53
|
-
list.join(',\r\n'),
|
|
54
|
-
']'
|
|
55
|
-
]
|
|
56
|
-
)
|
|
57
|
-
|
|
58
|
-
return this
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Returns a list of components for the file.
|
|
63
|
-
*
|
|
64
|
-
* Возвращает список компонентов для файла.
|
|
65
|
-
*/
|
|
66
|
-
protected getComponents(): string[] {
|
|
67
|
-
const list: string[] = []
|
|
68
|
-
|
|
69
|
-
if (this.packageName) {
|
|
70
|
-
forEach(
|
|
71
|
-
this.items.getComponentList(),
|
|
72
|
-
(item) => {
|
|
73
|
-
list.push(` {
|
|
74
|
-
name: '${item.codeFull}',
|
|
75
|
-
reg: ${this.getReg([item.name], true)}
|
|
76
|
-
}`
|
|
77
|
-
)
|
|
78
|
-
})
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return list
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Returns a regular expression for all components.
|
|
86
|
-
*
|
|
87
|
-
* Возвращает регулярное выражение для всех компонентов.
|
|
88
|
-
*/
|
|
89
|
-
protected getComponentsReg(): string {
|
|
90
|
-
const names: string[] = forEach(
|
|
91
|
-
this.items.getComponentList(),
|
|
92
|
-
item => item.name
|
|
93
|
-
)
|
|
94
|
-
|
|
95
|
-
return this.getReg(names)
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Returns a list of design names.
|
|
100
|
-
*
|
|
101
|
-
* Возвращает список названий дизайнов.
|
|
102
|
-
*/
|
|
103
|
-
protected getDesigns(): string[] {
|
|
104
|
-
return [
|
|
105
|
-
PropertiesConfig.getDesignName(),
|
|
106
|
-
...(PropertiesConfig.getDesignAlternativeName() ?? [])
|
|
107
|
-
]
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Generates a regular expression for the list of names.
|
|
112
|
-
*
|
|
113
|
-
* Генерирует регулярное выражение для списка имен.
|
|
114
|
-
* @param names list of names / список имен
|
|
115
|
-
* @param only exact match / точное совпадение
|
|
116
|
-
*/
|
|
117
|
-
protected getReg(
|
|
118
|
-
names: string[],
|
|
119
|
-
only: boolean = false
|
|
120
|
-
): string {
|
|
121
|
-
const designs = this.getDesigns().join('|')
|
|
122
|
-
const namesReg = this.getRegName(names)
|
|
123
|
-
let code = `((${designs})-?(${namesReg}))`
|
|
124
|
-
|
|
125
|
-
if (only) {
|
|
126
|
-
code = `^${code}$`
|
|
127
|
-
} else {
|
|
128
|
-
code = `${code}(?![\\w-])`
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return `/${code}/ig`
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Formats names for regular expression.
|
|
136
|
-
*
|
|
137
|
-
* Форматирует имена для регулярного выражения.
|
|
138
|
-
* @param names list of names / список имен
|
|
139
|
-
*/
|
|
140
|
-
protected getRegName(names: string[]): string {
|
|
141
|
-
return forEach(
|
|
142
|
-
names,
|
|
143
|
-
name => toKebabCase(name)
|
|
144
|
-
.replace('-', '-?')
|
|
145
|
-
).join('|')
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* Returns a list of CSS variables.
|
|
150
|
-
*
|
|
151
|
-
* Возвращает список CSS переменных.
|
|
152
|
-
*/
|
|
153
|
-
protected getVars(): string[] {
|
|
154
|
-
const design: string = toCamelCase(PropertiesConfig.getDesignName())
|
|
155
|
-
const path = [...UI_DIRS_STYLES, PropertiesConfig.getProjectName(), 'vars.scss']
|
|
156
|
-
const context = PropertiesFile.readFileOnly(path)
|
|
157
|
-
const data: string[] = []
|
|
158
|
-
|
|
159
|
-
if (context) {
|
|
160
|
-
const vars = context.match(/(?<=--)[^: ]+(?=:)/g)
|
|
161
|
-
|
|
162
|
-
if (vars) {
|
|
163
|
-
vars.forEach((varName) => {
|
|
164
|
-
const value = varName.match(/^([^-]+)-(.*?)$/)
|
|
165
|
-
|
|
166
|
-
if (
|
|
167
|
-
value
|
|
168
|
-
&& value?.[1] === design
|
|
169
|
-
&& value?.[2]
|
|
170
|
-
) {
|
|
171
|
-
const varName = value[2].split('-')
|
|
172
|
-
|
|
173
|
-
if (varName.length > 2) {
|
|
174
|
-
varName.pop()
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
data.push(varName.join('-'))
|
|
178
|
-
}
|
|
179
|
-
})
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
return uniqueArray(data)
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
protected getVarsReg(): string {
|
|
187
|
-
return `/(?<=var\\(--)(${this.getVars().join('|')})/ig`
|
|
188
|
-
}
|
|
189
|
-
}
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
// export:none
|
|
2
|
-
|
|
3
|
-
import { toCamelCase, toCamelCaseFirst } from '@dxtmisha/functional-basic'
|
|
4
|
-
|
|
5
|
-
import { PropertiesConfig } from '../Properties/PropertiesConfig'
|
|
6
|
-
import { PropertiesFile } from '../Properties/PropertiesFile'
|
|
7
|
-
|
|
8
|
-
import { LibraryItems } from './LibraryItems'
|
|
9
|
-
|
|
10
|
-
import { UI_DIRS_ICONS, UI_FILE_NAME_MEDIA, UI_FILE_NAME_STYLE } from '../../config'
|
|
11
|
-
import type { LibraryIconItem } from '../../types/libraryTypes'
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Class for generating connection files for media data (primarily icons) and style entry points.
|
|
15
|
-
*
|
|
16
|
-
* Класс для формирования файлов подключения медиа-данных (прежде всего иконок) и точек входа стилей.
|
|
17
|
-
*/
|
|
18
|
-
export class LibraryMedia {
|
|
19
|
-
/**
|
|
20
|
-
* Constructor for LibraryMedia.
|
|
21
|
-
*
|
|
22
|
-
* Конструктор для LibraryMedia.
|
|
23
|
-
* @param items object for working with the list of components / объект для работы со списком компонентов
|
|
24
|
-
*/
|
|
25
|
-
constructor(
|
|
26
|
-
protected readonly items: LibraryItems
|
|
27
|
-
) {
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Generates media connection files and style entries.
|
|
32
|
-
*
|
|
33
|
-
* Генерирует файлы подключения медиа и записи стилей.
|
|
34
|
-
*/
|
|
35
|
-
make(): void {
|
|
36
|
-
const projectName = toCamelCaseFirst(PropertiesConfig.getProjectName())
|
|
37
|
-
const name = toCamelCase(PropertiesConfig.getDesignName())
|
|
38
|
-
const isIcons = this.getIconImport().length > 0
|
|
39
|
-
|
|
40
|
-
if (isIcons) {
|
|
41
|
-
this.items.write(
|
|
42
|
-
UI_FILE_NAME_MEDIA,
|
|
43
|
-
[
|
|
44
|
-
'import { Icons } from \'@dxtmisha/functional\'',
|
|
45
|
-
'',
|
|
46
|
-
...this.initIconImport(),
|
|
47
|
-
'',
|
|
48
|
-
`export const ${name}MakeIcons = (): void => {`,
|
|
49
|
-
...this.initIcon(),
|
|
50
|
-
'}'
|
|
51
|
-
]
|
|
52
|
-
)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
this.items.write(
|
|
56
|
-
UI_FILE_NAME_STYLE,
|
|
57
|
-
[
|
|
58
|
-
`import '../styles/${projectName}/main.scss'`
|
|
59
|
-
]
|
|
60
|
-
)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Returns the list of available icons.
|
|
65
|
-
*
|
|
66
|
-
* Возвращает список доступных иконок.
|
|
67
|
-
*/
|
|
68
|
-
private getIconImport() {
|
|
69
|
-
const data: LibraryIconItem[] = []
|
|
70
|
-
const path = [PropertiesFile.getRoot(), ...UI_DIRS_ICONS]
|
|
71
|
-
|
|
72
|
-
if (PropertiesFile.is(path)) {
|
|
73
|
-
PropertiesFile
|
|
74
|
-
.readDirRecursive(path)
|
|
75
|
-
.forEach((iconPath) => {
|
|
76
|
-
const icon = iconPath.replace('/', '-')
|
|
77
|
-
|
|
78
|
-
data.push({
|
|
79
|
-
name: toCamelCase(this.getIconName(icon)),
|
|
80
|
-
path: this.getIconPath(iconPath),
|
|
81
|
-
value: this.getIconName(icon)
|
|
82
|
-
})
|
|
83
|
-
})
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return data
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Returns the icon name.
|
|
91
|
-
*
|
|
92
|
-
* Возвращает название иконки.
|
|
93
|
-
* @param icon icon name/ название иконки
|
|
94
|
-
*/
|
|
95
|
-
private getIconName(icon: string): string {
|
|
96
|
-
return icon
|
|
97
|
-
.replace(/\.[^.]+$/, '')
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Returns the path to the icon.
|
|
102
|
-
*
|
|
103
|
-
* Возвращает путь к иконке.
|
|
104
|
-
* @param icon icon name/ название иконки
|
|
105
|
-
*/
|
|
106
|
-
private getIconPath(icon: string): string {
|
|
107
|
-
return PropertiesFile.joinPath(['.', '..', '..', ...UI_DIRS_ICONS, icon])
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Generates the code to add the icon.
|
|
112
|
-
*
|
|
113
|
-
* Создаёт код для добавления иконки.
|
|
114
|
-
*/
|
|
115
|
-
private initIcon(): string[] {
|
|
116
|
-
const data: string[] = []
|
|
117
|
-
|
|
118
|
-
this.getIconImport().forEach((item) => {
|
|
119
|
-
data.push(` Icons.add('${item.value}', ${item.name})`)
|
|
120
|
-
})
|
|
121
|
-
|
|
122
|
-
return data
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Generates the code to connect the icon.
|
|
127
|
-
*
|
|
128
|
-
* Создаёт код для подключения иконки.
|
|
129
|
-
*/
|
|
130
|
-
private initIconImport(): string[] {
|
|
131
|
-
const data: string[] = []
|
|
132
|
-
|
|
133
|
-
this.getIconImport().forEach((item) => {
|
|
134
|
-
data.push(`const ${item.name} = async () => (await import('${item.path}'))?.default`)
|
|
135
|
-
})
|
|
136
|
-
|
|
137
|
-
return data
|
|
138
|
-
}
|
|
139
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { toCamelCaseFirst, toKebabCase } from '@dxtmisha/functional-basic'
|
|
2
|
-
|
|
3
|
-
import { PropertiesConfig } from '../Properties/PropertiesConfig'
|
|
4
|
-
import { LibraryItems } from './LibraryItems'
|
|
5
|
-
|
|
6
|
-
import { UI_FILE_NAME_PLUGIN } from '../../config'
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Class for creating a plugin file for the design system.
|
|
10
|
-
*
|
|
11
|
-
* Класс для создания файла плагина для дизайн-системы.
|
|
12
|
-
*/
|
|
13
|
-
export class LibraryPlugin {
|
|
14
|
-
/**
|
|
15
|
-
* Constructor for LibraryPlugin.
|
|
16
|
-
*
|
|
17
|
-
* Конструктор для LibraryPlugin.
|
|
18
|
-
* @param items object for working with the list of components / объект для работы со списком компонентов
|
|
19
|
-
*/
|
|
20
|
-
constructor(
|
|
21
|
-
protected readonly items: LibraryItems
|
|
22
|
-
) {
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Creates a plugin file that initializes the Vite plugin for the library.
|
|
27
|
-
*
|
|
28
|
-
* Создает файл плагина, который инициализирует плагин Vite для библиотеки.
|
|
29
|
-
* @returns this
|
|
30
|
-
*/
|
|
31
|
-
make(): this {
|
|
32
|
-
const design = PropertiesConfig.getDesignName()
|
|
33
|
-
|
|
34
|
-
this.items.write(
|
|
35
|
-
UI_FILE_NAME_PLUGIN,
|
|
36
|
-
[
|
|
37
|
-
'import type { Plugin as VitePlugin } from \'vite\'',
|
|
38
|
-
'import { type PluginOptions, Plugin } from \'@dxtmisha/constructor/plugin\'',
|
|
39
|
-
'',
|
|
40
|
-
'import {',
|
|
41
|
-
' componentsList,',
|
|
42
|
-
' componentsReg,',
|
|
43
|
-
' designName,',
|
|
44
|
-
' packageName,',
|
|
45
|
-
' styleVarsReg',
|
|
46
|
-
'} from \'./design\'',
|
|
47
|
-
'',
|
|
48
|
-
'/**',
|
|
49
|
-
' * Initializes the Vite plugin for the design system.',
|
|
50
|
-
' *',
|
|
51
|
-
' * Инициализирует плагин Vite для дизайн-системы.',
|
|
52
|
-
' * @param options plugin options / настройки плагина',
|
|
53
|
-
' */',
|
|
54
|
-
`export function ui${toCamelCaseFirst(design)}VitePlugin(`,
|
|
55
|
-
' options: PluginOptions = {}',
|
|
56
|
-
'): VitePlugin {',
|
|
57
|
-
' return new Plugin(',
|
|
58
|
-
' designName,',
|
|
59
|
-
' packageName,',
|
|
60
|
-
' componentsReg,',
|
|
61
|
-
' styleVarsReg,',
|
|
62
|
-
' componentsList,',
|
|
63
|
-
` 'vite-plugin-${toKebabCase(design)}-ui',`,
|
|
64
|
-
' options',
|
|
65
|
-
' )',
|
|
66
|
-
' .init()',
|
|
67
|
-
'}'
|
|
68
|
-
]
|
|
69
|
-
)
|
|
70
|
-
|
|
71
|
-
return this
|
|
72
|
-
}
|
|
73
|
-
}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { PropertiesConfig } from '../Properties/PropertiesConfig'
|
|
2
|
-
import { LibraryItems } from './LibraryItems'
|
|
3
|
-
|
|
4
|
-
import type { LibraryData } from '../../types/libraryTypes'
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Class for generating global type definitions for Vue components.
|
|
8
|
-
*
|
|
9
|
-
* Класс для создания глобальных определений типов для компонентов Vue.
|
|
10
|
-
*/
|
|
11
|
-
export class LibraryTypes {
|
|
12
|
-
/**
|
|
13
|
-
* Constructor for LibraryTypes.
|
|
14
|
-
*
|
|
15
|
-
* Конструктор для LibraryTypes.
|
|
16
|
-
* @param items object for working with the list of components / объект для работы со списком компонентов
|
|
17
|
-
*/
|
|
18
|
-
constructor(
|
|
19
|
-
protected readonly items: LibraryItems
|
|
20
|
-
) {
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Creates the type definition file (`types.d.ts`) for global Vue components.
|
|
25
|
-
*
|
|
26
|
-
* Создает файл определений типов (`types.d.ts`) для глобальных компонентов Vue.
|
|
27
|
-
*/
|
|
28
|
-
make(): void {
|
|
29
|
-
this.items.write(
|
|
30
|
-
'types',
|
|
31
|
-
[
|
|
32
|
-
// 'import { type App } from \'vue\'',
|
|
33
|
-
...this.initImports(),
|
|
34
|
-
// '',
|
|
35
|
-
// 'export const components = {',
|
|
36
|
-
// this.initExports(),
|
|
37
|
-
// '}',
|
|
38
|
-
// '',
|
|
39
|
-
// 'export const useVueComponentsPlugin = {',
|
|
40
|
-
// ' install: async (app: App) => {',
|
|
41
|
-
// ...this.initIncludeVueComponents(),
|
|
42
|
-
// ' }',
|
|
43
|
-
// '}',
|
|
44
|
-
'',
|
|
45
|
-
'declare module \'@vue/runtime-core\' {',
|
|
46
|
-
' export interface GlobalComponents {',
|
|
47
|
-
...this.initGlobalComponentsVue(),
|
|
48
|
-
' }',
|
|
49
|
-
'}'
|
|
50
|
-
]
|
|
51
|
-
)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Returns the path to the component.
|
|
56
|
-
*
|
|
57
|
-
* Возвращает путь к компоненту.
|
|
58
|
-
* @param component component data / данные компонента
|
|
59
|
-
*/
|
|
60
|
-
protected getPathComponent(component: LibraryData): string {
|
|
61
|
-
return `../components/${PropertiesConfig.getProjectName()}/${component.dir}`
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Returns a list of imports for the file.
|
|
66
|
-
*
|
|
67
|
-
* Возвращает список импортов для файла.
|
|
68
|
-
*/
|
|
69
|
-
protected initImports(): string[] {
|
|
70
|
-
const list: string[] = []
|
|
71
|
-
|
|
72
|
-
this.items.getComponentList()
|
|
73
|
-
.forEach((component) => {
|
|
74
|
-
list.push(
|
|
75
|
-
`import _${component.codeFull} from '${this.getPathComponent(component)}/${component.codeFull}.vue'`
|
|
76
|
-
)
|
|
77
|
-
})
|
|
78
|
-
|
|
79
|
-
return list
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Returns a list of exports for the file.
|
|
84
|
-
*
|
|
85
|
-
* Возвращает список экспортов для файла.
|
|
86
|
-
*/
|
|
87
|
-
protected initExports(): string {
|
|
88
|
-
const list: string[] = []
|
|
89
|
-
|
|
90
|
-
this.items.getComponentList()
|
|
91
|
-
.forEach((component) => {
|
|
92
|
-
list.push(
|
|
93
|
-
` ${component.codeFull}: _${component.codeFull}`
|
|
94
|
-
)
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
return list.join(',\r\n')
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
protected initIncludeVueComponents(): string[] {
|
|
101
|
-
const list: string[] = []
|
|
102
|
-
|
|
103
|
-
this.items.getComponentList()
|
|
104
|
-
.forEach((component) => {
|
|
105
|
-
list.push(
|
|
106
|
-
` app.component('${component.codeFull}', _${component.codeFull})`
|
|
107
|
-
)
|
|
108
|
-
})
|
|
109
|
-
|
|
110
|
-
return list
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Returns a list of global components for Vue.
|
|
115
|
-
*
|
|
116
|
-
* Возвращает список глобальных компонентов для Vue.
|
|
117
|
-
*/
|
|
118
|
-
protected initGlobalComponentsVue(): string[] {
|
|
119
|
-
const list: string[] = []
|
|
120
|
-
|
|
121
|
-
this.items.getComponentList()
|
|
122
|
-
.forEach((component) => {
|
|
123
|
-
list.push(
|
|
124
|
-
` ${component.codeFull}: typeof _${component.codeFull}`
|
|
125
|
-
)
|
|
126
|
-
})
|
|
127
|
-
|
|
128
|
-
return list
|
|
129
|
-
}
|
|
130
|
-
}
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import { toArray } from '@dxtmisha/functional-basic'
|
|
2
|
-
import { PropertiesFile } from '../Properties/PropertiesFile'
|
|
3
|
-
import { UI_FILE_PACKAGE } from '../../config'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Class for working with the package.json file.
|
|
7
|
-
*
|
|
8
|
-
* Класс для работы с файлом package.json.
|
|
9
|
-
*/
|
|
10
|
-
export class PackageFile {
|
|
11
|
-
protected readonly data?: Record<string, any>
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Constructor
|
|
15
|
-
* @param path path to the directory containing package.json / путь к директории, содержащей package.json
|
|
16
|
-
*/
|
|
17
|
-
constructor(
|
|
18
|
-
protected readonly path: string | string[]
|
|
19
|
-
) {
|
|
20
|
-
if (this.is()) {
|
|
21
|
-
this.data = PropertiesFile.readFile(this.getPath()) ?? {}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Checks if the directory is a package (contains package.json).
|
|
27
|
-
*
|
|
28
|
-
* Проверяет, является ли директория пакетом (содержит package.json).
|
|
29
|
-
*/
|
|
30
|
-
is(): boolean {
|
|
31
|
-
return PropertiesFile.is(this.getPath())
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Checks if the package version matches the specified version.
|
|
36
|
-
*
|
|
37
|
-
* Проверяет, соответствует ли версия пакета указанной версии.
|
|
38
|
-
* @param version version to compare with / версия для сравнения
|
|
39
|
-
*/
|
|
40
|
-
isVersionConsistency(version?: string): boolean {
|
|
41
|
-
return Boolean(version) && this.getVersion() === version
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Checks if the package is a test package.
|
|
46
|
-
*
|
|
47
|
-
* Проверяет, является ли пакет тестовым.
|
|
48
|
-
*/
|
|
49
|
-
isTest(): boolean {
|
|
50
|
-
return this.get()?.['ui-test'] === true
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Checks if the package should not be published.
|
|
55
|
-
*
|
|
56
|
-
* Проверяет, не должен ли пакет публиковаться.
|
|
57
|
-
*/
|
|
58
|
-
isNoPublish(): boolean {
|
|
59
|
-
const data = this.get()
|
|
60
|
-
return data?.['ui-no-publish'] === true || data?.private === true
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Returns the package data.
|
|
65
|
-
*
|
|
66
|
-
* Возвращает данные пакета.
|
|
67
|
-
*/
|
|
68
|
-
get(): Record<string, any> {
|
|
69
|
-
return this.data ?? {}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Returns the package name.
|
|
74
|
-
*
|
|
75
|
-
* Возвращает имя пакета.
|
|
76
|
-
*/
|
|
77
|
-
getName(): string {
|
|
78
|
-
return this.get()?.name ?? PropertiesFile.joinPath(this.getDir())
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Returns the package version.
|
|
83
|
-
*
|
|
84
|
-
* Возвращает версию пакета.
|
|
85
|
-
*/
|
|
86
|
-
getVersion(): string {
|
|
87
|
-
return this.get()?.version ?? '0.0.0'
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Returns the package scripts.
|
|
92
|
-
*
|
|
93
|
-
* Возвращает скрипты пакета.
|
|
94
|
-
*/
|
|
95
|
-
getScripts(): Record<string, string> {
|
|
96
|
-
return this.get()?.scripts ?? {}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Returns the package directory path segments.
|
|
101
|
-
*
|
|
102
|
-
* Возвращает сегменты пути к директории пакета.
|
|
103
|
-
*/
|
|
104
|
-
getDir(): string[] {
|
|
105
|
-
return toArray(this.path)
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Returns the package path.
|
|
110
|
-
*
|
|
111
|
-
* Возвращает путь к пакету.
|
|
112
|
-
*/
|
|
113
|
-
getPath(): string[] {
|
|
114
|
-
return [...this.getDir(), UI_FILE_PACKAGE]
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Returns the command name for build or build-recovery.
|
|
119
|
-
*
|
|
120
|
-
* Возвращает название команды для build или build-recovery.
|
|
121
|
-
*/
|
|
122
|
-
getCodeBuildOrRecovery(): string | undefined {
|
|
123
|
-
const scripts = this.getScripts()
|
|
124
|
-
|
|
125
|
-
if ('prepublishOnly' in scripts) {
|
|
126
|
-
return 'prepublishOnly'
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
if ('build-recovery' in scripts) {
|
|
130
|
-
return 'build-recovery'
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
if ('build' in scripts) {
|
|
134
|
-
return 'build'
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
return undefined
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Returns the command name for publish or publish-to-npm.
|
|
142
|
-
*
|
|
143
|
-
* Возвращает название команды для publish или publish-to-npm.
|
|
144
|
-
*/
|
|
145
|
-
getCodePublish(): string {
|
|
146
|
-
const scripts = this.getScripts()
|
|
147
|
-
|
|
148
|
-
if ('publish-to-npm' in scripts) {
|
|
149
|
-
return 'npm run publish-to-npm'
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
return 'npm publish --access public'
|
|
153
|
-
}
|
|
154
|
-
}
|