@dxtmisha/scripts 0.7.2 → 0.7.6
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/bin/design-wiki-storm.ts +9 -0
- package/package.json +5 -3
- package/src/classes/Ai/AiAbstract.ts +14 -1
- package/src/classes/Ai/AiGoogleLite.ts +2 -1
- package/src/classes/Build/__tests__/buildFunctional.test.ts +43 -0
- package/src/classes/Build/buildFunctional.ts +15 -0
- package/src/classes/Component/ComponentCreator.ts +1 -0
- package/src/classes/Component/ComponentItem.ts +15 -0
- package/src/classes/Component/ComponentWiki.ts +8 -0
- package/src/classes/Component/ComponentWikiFile.ts +2 -0
- package/src/classes/Component/__tests__/ComponentCreator.test.ts +71 -0
- package/src/classes/Component/__tests__/ComponentItem.test.ts +71 -0
- package/src/classes/Design/DesignCommand.ts +13 -8
- package/src/classes/Design/DesignComponent.ts +235 -28
- package/src/classes/Design/DesignConstructor.ts +9 -5
- package/src/classes/Design/DesignConstructors.ts +8 -4
- package/src/classes/Design/DesignFlags.ts +16 -0
- package/src/classes/Design/DesignReplace.ts +10 -6
- package/src/classes/Design/DesignStructure.ts +8 -6
- package/src/classes/Design/DesignStructureClasses.ts +8 -4
- package/src/classes/Design/DesignStructureItemAbstract.ts +11 -2
- package/src/classes/Design/DesignStructureRead.ts +8 -4
- package/src/classes/Design/DesignStructureStyles.ts +8 -4
- package/src/classes/Design/DesignTypes.ts +53 -28
- package/src/classes/Design/DesignTypescript.ts +11 -2
- package/src/classes/Design/DesignUi.ts +42 -11
- package/src/classes/Design/DesignWiki.ts +4 -6
- package/src/classes/Design/DesignWikiStorm.ts +94 -0
- package/src/classes/Design/DesignWikiStormItem.ts +246 -0
- package/src/classes/Git/GitRead.ts +1 -0
- package/src/classes/Git/__tests__/GitRead.test.ts +70 -0
- package/src/classes/Library/LibraryAiWiki.ts +2 -1
- package/src/classes/Library/LibraryFlags.ts +9 -7
- package/src/classes/Library/LibraryItems.ts +9 -9
- package/src/classes/Library/LibraryList.ts +10 -5
- package/src/classes/Library/LibraryMedia.ts +21 -6
- package/src/classes/Library/LibraryPlugin.ts +8 -5
- package/src/classes/Library/LibraryTypes.ts +34 -10
- package/src/classes/Package/PackageInit.ts +12 -4
- package/src/classes/Package/PackageItem.ts +13 -4
- package/src/classes/Properties/Properties.ts +14 -3
- package/src/classes/Properties/PropertiesCache.ts +19 -20
- package/src/classes/Properties/PropertiesConfig.ts +39 -28
- package/src/classes/Properties/PropertiesConvector.ts +10 -6
- package/src/classes/Properties/PropertiesFile.ts +22 -28
- package/src/classes/Properties/PropertiesImport.ts +10 -7
- package/src/classes/Properties/PropertiesItems.ts +19 -12
- package/src/classes/Properties/PropertiesKeys.ts +15 -9
- package/src/classes/Properties/PropertiesMain.ts +13 -7
- package/src/classes/Properties/PropertiesPalette.ts +12 -6
- package/src/classes/Properties/PropertiesPath.ts +17 -11
- package/src/classes/Properties/PropertiesScss.ts +10 -8
- package/src/classes/Properties/PropertiesSeparator.ts +9 -11
- package/src/classes/Properties/PropertiesSettings.ts +8 -6
- package/src/classes/Properties/PropertiesStandard.ts +5 -6
- package/src/classes/Properties/PropertiesTool.ts +16 -9
- package/src/classes/Properties/PropertiesTypes.ts +12 -12
- package/src/classes/Properties/PropertiesValues.ts +14 -14
- package/src/classes/Properties/PropertiesWrap.ts +5 -6
- package/src/classes/Properties/convector/convectorColor.ts +5 -3
- package/src/classes/Properties/to/PropertiesToAbstract.ts +18 -4
- package/src/composables/__tests__/useAi.test.ts +75 -0
- package/src/config.ts +2 -0
- package/src/functions/__tests__/getComponentPaths.test.ts +19 -0
- package/src/functions/__tests__/getConfigAi.test.ts +26 -0
- package/src/functions/__tests__/getConstructorProperties.test.ts +51 -0
- package/src/functions/__tests__/getDirname.test.ts +31 -0
- package/src/functions/__tests__/getNameDirByPaths.test.ts +40 -0
- package/src/functions/__tests__/getPackageJson.test.ts +34 -0
- package/src/functions/__tests__/hasNativeDirname.test.ts +18 -0
- package/src/functions/__tests__/toPathStandardSep.test.ts +31 -0
- package/src/functions/getConfigAi.ts +3 -2
- package/src/functions/toPathStandardSep.ts +1 -1
- package/src/library-ai.ts +0 -1
- package/src/library.ts +6 -0
- package/src/media/properties/css.ts +3 -1
- package/src/media/templates/component/props.ts +1 -1
- package/src/media/templates/component/wiki.ts +6 -12
- package/src/media/templates/component/wikiData.ts +28 -0
- package/src/media/templates/packages/figma/README.md +1 -0
- package/src/media/templates/packages/figma/ai.sample.config.ts +2 -0
- package/src/media/templates/packages/figma/design.config.json +3 -0
- package/src/media/templates/packages/figma/index.html +12 -0
- package/src/media/templates/packages/figma/manifest.json +25 -0
- package/src/media/templates/packages/figma/package.json +37 -0
- package/src/media/templates/packages/figma/src/App.vue +9 -0
- package/src/media/templates/packages/figma/src/classes/_.gitignore.txt +1 -0
- package/src/media/templates/packages/figma/src/code.ts +16 -0
- package/src/media/templates/packages/figma/src/components/_.gitignore.txt +1 -0
- package/src/media/templates/packages/figma/src/composables/_.gitignore.txt +1 -0
- package/src/media/templates/packages/figma/src/config.ts +0 -0
- package/src/media/templates/packages/figma/src/functions/_.gitignore.txt +1 -0
- package/src/media/templates/packages/figma/src/library.ts +0 -0
- package/src/media/templates/packages/figma/src/main.ts +4 -0
- package/src/media/templates/packages/figma/src/media/_.gitignore.txt +1 -0
- package/src/media/templates/packages/figma/src/storybook/_.gitignore.txt +1 -0
- package/src/media/templates/packages/figma/src/types/_.gitignore.txt +1 -0
- package/src/media/templates/packages/figma/src/vite-env.d.ts +1 -0
- package/src/media/templates/packages/figma/tsconfig.app.json +12 -0
- package/src/media/templates/packages/figma/tsconfig.json +7 -0
- package/src/media/templates/packages/figma/tsconfig.node.json +8 -0
- package/src/media/templates/packages/figma/vite.config.ts +7 -0
- package/src/types/configTypes.ts +3 -0
- package/src/types/webTypes.ts +105 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { describe, expect, it, vi, beforeEach } from 'vitest'
|
|
2
|
+
import { GitRead } from '../GitRead'
|
|
3
|
+
import { execSync } from 'node:child_process'
|
|
4
|
+
import { PropertiesFile } from '../../Properties/PropertiesFile'
|
|
5
|
+
|
|
6
|
+
vi.mock('node:child_process', () => ({
|
|
7
|
+
execSync: vi.fn()
|
|
8
|
+
}))
|
|
9
|
+
|
|
10
|
+
vi.mock('../../Properties/PropertiesFile', () => ({
|
|
11
|
+
PropertiesFile: {
|
|
12
|
+
getTime: vi.fn()
|
|
13
|
+
}
|
|
14
|
+
}))
|
|
15
|
+
|
|
16
|
+
describe('GitRead', () => {
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
vi.clearAllMocks()
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
it('getDirPrefix should return the result of git rev-parse', () => {
|
|
22
|
+
vi.mocked(execSync).mockReturnValue('packages/scripts/' as any)
|
|
23
|
+
const result = GitRead.getDirPrefix()
|
|
24
|
+
expect(execSync).toHaveBeenCalledWith('git rev-parse --show-prefix', expect.anything())
|
|
25
|
+
expect(result).toBe('packages/scripts/')
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
it('getFilesPath should return list of HEAD files', () => {
|
|
29
|
+
vi.mocked(execSync).mockReturnValue('file1.ts\nfile2.ts\n' as any)
|
|
30
|
+
const result = GitRead.getFilesPath()
|
|
31
|
+
expect(result).toEqual(['file1.ts', 'file2.ts'])
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
it('getList should return files with metadata', () => {
|
|
35
|
+
vi.mocked(execSync).mockImplementation((cmd: string) => {
|
|
36
|
+
if (cmd.startsWith('git rev-parse')) return 'prefix/' as any
|
|
37
|
+
if (cmd.startsWith('git ls-tree')) return 'file.ts\n' as any
|
|
38
|
+
if (cmd.startsWith('git log')) return '2023-10-27 12:00:00 +0300' as any
|
|
39
|
+
return '' as any
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
const result = GitRead.getList()
|
|
43
|
+
expect(result[0]).toMatchObject({
|
|
44
|
+
path: 'file.ts',
|
|
45
|
+
pathFull: 'prefix/file.ts',
|
|
46
|
+
date: expect.stringContaining('2023-10-27')
|
|
47
|
+
})
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
it('getListPorcelain should parse git status and metadata', () => {
|
|
51
|
+
vi.mocked(execSync).mockImplementation((cmd: string) => {
|
|
52
|
+
if (cmd.startsWith('git rev-parse')) return 'prefix/' as any
|
|
53
|
+
if (cmd.startsWith('git status')) return 'M file.ts\nA new.ts\n' as any
|
|
54
|
+
return '' as any
|
|
55
|
+
})
|
|
56
|
+
vi.mocked(PropertiesFile.getTime).mockReturnValue('2023-10-27 12:00:00' as any)
|
|
57
|
+
|
|
58
|
+
const result = GitRead.getListPorcelain()
|
|
59
|
+
expect(result).toHaveLength(2)
|
|
60
|
+
expect(result[0]).toMatchObject({
|
|
61
|
+
path: 'file.ts',
|
|
62
|
+
status: 'M'
|
|
63
|
+
})
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
it('splitPath should correctly split string', () => {
|
|
67
|
+
expect(GitRead.splitPath('a/b/c')).toEqual(['a', 'b', 'c'])
|
|
68
|
+
expect(GitRead.splitPath('/a/b/')).toEqual(['a', 'b'])
|
|
69
|
+
})
|
|
70
|
+
})
|
|
@@ -99,7 +99,7 @@ export class LibraryAiWiki {
|
|
|
99
99
|
`<script setup lang="ts">
|
|
100
100
|
// This file is generated by a script, do not edit.
|
|
101
101
|
|
|
102
|
-
import { DxtTestPage, DxtTestWikiAnchor } from '@dxtmisha/test'
|
|
102
|
+
import { DxtTestPage, DxtTestWikiAnchor, DxtTestWikiHide } from '@dxtmisha/test'
|
|
103
103
|
import { aiList } from '../library/${this.getFileList()}.wiki'
|
|
104
104
|
|
|
105
105
|
defineOptions({
|
|
@@ -112,6 +112,7 @@ defineOptions({
|
|
|
112
112
|
title="List of available UI components"
|
|
113
113
|
description="Below is a list of Vue 3 components available in the UI. These components are available immediately and do not need to be imported."
|
|
114
114
|
>
|
|
115
|
+
<DxtTestWikiHide/>
|
|
115
116
|
<DxtTestWikiAnchor :list="aiList"/>
|
|
116
117
|
<component
|
|
117
118
|
v-for="(item, key) in aiList"
|
|
@@ -8,24 +8,26 @@ import { LibraryItems } from './LibraryItems'
|
|
|
8
8
|
import { UI_FILE_NAME_FLAGS } from '../../config'
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* Class for generating a
|
|
11
|
+
* Class for generating connection files for country flags and providing a list of flag identifiers.
|
|
12
12
|
*
|
|
13
|
-
* Класс для формирования
|
|
13
|
+
* Класс для формирования файлов подключения флагов стран и предоставления списка идентификаторов флагов.
|
|
14
14
|
*/
|
|
15
15
|
export class LibraryFlags {
|
|
16
16
|
/**
|
|
17
|
-
* Constructor
|
|
18
|
-
*
|
|
17
|
+
* Constructor for LibraryFlags.
|
|
18
|
+
*
|
|
19
|
+
* Конструктор для LibraryFlags.
|
|
20
|
+
* @param items object for working with the list of components / объект для работы со списком компонентов
|
|
19
21
|
*/
|
|
20
|
-
|
|
21
22
|
constructor(
|
|
22
23
|
protected readonly items: LibraryItems
|
|
23
24
|
) {
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
28
|
+
* Generates flag connection files (TypeScript) and a list of flag keys (JSON).
|
|
29
|
+
*
|
|
30
|
+
* Генерирует файлы подключения флагов (TypeScript) и список ключей флагов (JSON).
|
|
29
31
|
*/
|
|
30
32
|
make(): void {
|
|
31
33
|
const data: string[] = []
|
|
@@ -55,6 +55,15 @@ export class LibraryItems {
|
|
|
55
55
|
return this.getComponentList().length
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Returns the path to the design system components directory
|
|
60
|
+
*
|
|
61
|
+
* Возвращает путь к директории компонентов дизайн-системы
|
|
62
|
+
*/
|
|
63
|
+
getComponentsPath(): string[] {
|
|
64
|
+
return [...UI_DIRS_COMPONENTS, PropertiesConfig.getProjectName()]
|
|
65
|
+
}
|
|
66
|
+
|
|
58
67
|
/**
|
|
59
68
|
* Writes data in the file.
|
|
60
69
|
*
|
|
@@ -113,15 +122,6 @@ export class LibraryItems {
|
|
|
113
122
|
return list
|
|
114
123
|
}
|
|
115
124
|
|
|
116
|
-
/**
|
|
117
|
-
* Returns the path to the design system components directory
|
|
118
|
-
*
|
|
119
|
-
* Возвращает путь к директории компонентов дизайн-системы
|
|
120
|
-
*/
|
|
121
|
-
protected getComponentsPath(): string[] {
|
|
122
|
-
return [...UI_DIRS_COMPONENTS, PropertiesConfig.getProjectName()]
|
|
123
|
-
}
|
|
124
|
-
|
|
125
125
|
/**
|
|
126
126
|
* Initializes data about the component.
|
|
127
127
|
*
|
|
@@ -9,15 +9,17 @@ import { PropertiesFile } from '../Properties/PropertiesFile'
|
|
|
9
9
|
import { UI_DIRS_STYLES, UI_FILE_NAME_DESIGN } from '../../config'
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* Class for
|
|
12
|
+
* Class for generating the design system overview file, including component imports and regular expressions.
|
|
13
13
|
*
|
|
14
|
-
* Класс для создания файла
|
|
14
|
+
* Класс для создания обзорного файла дизайн-системы, включая импорты компонентов и регулярные выражения.
|
|
15
15
|
*/
|
|
16
16
|
export class LibraryList {
|
|
17
17
|
protected readonly packageName: string
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* Constructor
|
|
20
|
+
* Constructor for LibraryList.
|
|
21
|
+
*
|
|
22
|
+
* Конструктор для LibraryList.
|
|
21
23
|
* @param items object for working with the list of components / объект для работы со списком компонентов
|
|
22
24
|
*/
|
|
23
25
|
constructor(
|
|
@@ -27,9 +29,10 @@ export class LibraryList {
|
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
/**
|
|
30
|
-
* Creates
|
|
32
|
+
* Creates the design system overview file (`design.ts`) with metadata and component lists.
|
|
31
33
|
*
|
|
32
|
-
* Создает
|
|
34
|
+
* Создает обзорный файл дизайн-системы (`design.ts`) с метаданными и списками компонентов.
|
|
35
|
+
* @returns this
|
|
33
36
|
*/
|
|
34
37
|
make(): this {
|
|
35
38
|
const list = this.getComponents()
|
|
@@ -121,6 +124,8 @@ export class LibraryList {
|
|
|
121
124
|
|
|
122
125
|
if (only) {
|
|
123
126
|
code = `^${code}$`
|
|
127
|
+
} else {
|
|
128
|
+
code = `${code}(?![\\w-])`
|
|
124
129
|
}
|
|
125
130
|
|
|
126
131
|
return `/${code}/ig`
|
|
@@ -1,31 +1,39 @@
|
|
|
1
1
|
// export:none
|
|
2
2
|
|
|
3
|
-
import { toCamelCase } from '@dxtmisha/functional-basic'
|
|
3
|
+
import { toCamelCase, toCamelCaseFirst } from '@dxtmisha/functional-basic'
|
|
4
4
|
|
|
5
5
|
import { PropertiesConfig } from '../Properties/PropertiesConfig'
|
|
6
6
|
import { PropertiesFile } from '../Properties/PropertiesFile'
|
|
7
7
|
|
|
8
8
|
import { LibraryItems } from './LibraryItems'
|
|
9
9
|
|
|
10
|
-
import { UI_DIRS_ICONS, UI_FILE_NAME_MEDIA } from '../../config'
|
|
10
|
+
import { UI_DIRS_ICONS, UI_FILE_NAME_MEDIA, UI_FILE_NAME_STYLE } from '../../config'
|
|
11
11
|
import type { LibraryIconItem } from '../../types/libraryTypes'
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* Class for generating
|
|
14
|
+
* Class for generating connection files for media data (primarily icons) and style entry points.
|
|
15
15
|
*
|
|
16
|
-
* Класс для формирования
|
|
16
|
+
* Класс для формирования файлов подключения медиа-данных (прежде всего иконок) и точек входа стилей.
|
|
17
17
|
*/
|
|
18
18
|
export class LibraryMedia {
|
|
19
19
|
/**
|
|
20
|
-
* Constructor
|
|
21
|
-
*
|
|
20
|
+
* Constructor for LibraryMedia.
|
|
21
|
+
*
|
|
22
|
+
* Конструктор для LibraryMedia.
|
|
23
|
+
* @param items object for working with the list of components / объект для работы со списком компонентов
|
|
22
24
|
*/
|
|
23
25
|
constructor(
|
|
24
26
|
protected readonly items: LibraryItems
|
|
25
27
|
) {
|
|
26
28
|
}
|
|
27
29
|
|
|
30
|
+
/**
|
|
31
|
+
* Generates media connection files and style entries.
|
|
32
|
+
*
|
|
33
|
+
* Генерирует файлы подключения медиа и записи стилей.
|
|
34
|
+
*/
|
|
28
35
|
make(): void {
|
|
36
|
+
const projectName = toCamelCaseFirst(PropertiesConfig.getProjectName())
|
|
29
37
|
const name = toCamelCase(PropertiesConfig.getDesignName())
|
|
30
38
|
const isIcons = this.getIconImport().length > 0
|
|
31
39
|
|
|
@@ -43,6 +51,13 @@ export class LibraryMedia {
|
|
|
43
51
|
]
|
|
44
52
|
)
|
|
45
53
|
}
|
|
54
|
+
|
|
55
|
+
this.items.write(
|
|
56
|
+
UI_FILE_NAME_STYLE,
|
|
57
|
+
[
|
|
58
|
+
`import '../styles/${projectName}/main.scss'`
|
|
59
|
+
]
|
|
60
|
+
)
|
|
46
61
|
}
|
|
47
62
|
|
|
48
63
|
/**
|
|
@@ -6,13 +6,15 @@ import { LibraryItems } from './LibraryItems'
|
|
|
6
6
|
import { UI_FILE_NAME_PLUGIN } from '../../config'
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Class for creating a plugin file.
|
|
9
|
+
* Class for creating a plugin file for the design system.
|
|
10
10
|
*
|
|
11
|
-
* Класс для создания файла
|
|
11
|
+
* Класс для создания файла плагина для дизайн-системы.
|
|
12
12
|
*/
|
|
13
13
|
export class LibraryPlugin {
|
|
14
14
|
/**
|
|
15
|
-
* Constructor
|
|
15
|
+
* Constructor for LibraryPlugin.
|
|
16
|
+
*
|
|
17
|
+
* Конструктор для LibraryPlugin.
|
|
16
18
|
* @param items object for working with the list of components / объект для работы со списком компонентов
|
|
17
19
|
*/
|
|
18
20
|
constructor(
|
|
@@ -21,9 +23,10 @@ export class LibraryPlugin {
|
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
/**
|
|
24
|
-
* Creates a plugin file.
|
|
26
|
+
* Creates a plugin file that initializes the Vite plugin for the library.
|
|
25
27
|
*
|
|
26
|
-
* Создает файл
|
|
28
|
+
* Создает файл плагина, который инициализирует плагин Vite для библиотеки.
|
|
29
|
+
* @returns this
|
|
27
30
|
*/
|
|
28
31
|
make(): this {
|
|
29
32
|
const design = PropertiesConfig.getDesignName()
|
|
@@ -4,13 +4,15 @@ import { LibraryItems } from './LibraryItems'
|
|
|
4
4
|
import type { LibraryData } from '../../types/libraryTypes'
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* Class for
|
|
7
|
+
* Class for generating global type definitions for Vue components.
|
|
8
8
|
*
|
|
9
|
-
* Класс для создания
|
|
9
|
+
* Класс для создания глобальных определений типов для компонентов Vue.
|
|
10
10
|
*/
|
|
11
11
|
export class LibraryTypes {
|
|
12
12
|
/**
|
|
13
|
-
* Constructor
|
|
13
|
+
* Constructor for LibraryTypes.
|
|
14
|
+
*
|
|
15
|
+
* Конструктор для LibraryTypes.
|
|
14
16
|
* @param items object for working with the list of components / объект для работы со списком компонентов
|
|
15
17
|
*/
|
|
16
18
|
constructor(
|
|
@@ -19,17 +21,26 @@ export class LibraryTypes {
|
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
/**
|
|
22
|
-
* Creates
|
|
24
|
+
* Creates the type definition file (`types.d.ts`) for global Vue components.
|
|
23
25
|
*
|
|
24
|
-
* Создает файл
|
|
26
|
+
* Создает файл определений типов (`types.d.ts`) для глобальных компонентов Vue.
|
|
25
27
|
*/
|
|
26
28
|
make(): void {
|
|
27
29
|
this.items.write(
|
|
28
30
|
'types',
|
|
29
31
|
[
|
|
32
|
+
// 'import { type App } from \'vue\'',
|
|
30
33
|
...this.initImports(),
|
|
31
|
-
'',
|
|
32
|
-
|
|
34
|
+
// '',
|
|
35
|
+
// 'export const components = {',
|
|
36
|
+
// this.initExports(),
|
|
37
|
+
// '}',
|
|
38
|
+
// '',
|
|
39
|
+
// 'export const useVueComponentsPlugin = {',
|
|
40
|
+
// ' install: async (app: App) => {',
|
|
41
|
+
// ...this.initIncludeVueComponents(),
|
|
42
|
+
// ' }',
|
|
43
|
+
// '}',
|
|
33
44
|
'',
|
|
34
45
|
'declare module \'@vue/runtime-core\' {',
|
|
35
46
|
' export interface GlobalComponents {',
|
|
@@ -73,13 +84,26 @@ export class LibraryTypes {
|
|
|
73
84
|
*
|
|
74
85
|
* Возвращает список экспортов для файла.
|
|
75
86
|
*/
|
|
76
|
-
protected initExports(): string
|
|
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[] {
|
|
77
101
|
const list: string[] = []
|
|
78
102
|
|
|
79
103
|
this.items.getComponentList()
|
|
80
104
|
.forEach((component) => {
|
|
81
105
|
list.push(
|
|
82
|
-
`
|
|
106
|
+
` app.component('${component.codeFull}', _${component.codeFull})`
|
|
83
107
|
)
|
|
84
108
|
})
|
|
85
109
|
|
|
@@ -97,7 +121,7 @@ export class LibraryTypes {
|
|
|
97
121
|
this.items.getComponentList()
|
|
98
122
|
.forEach((component) => {
|
|
99
123
|
list.push(
|
|
100
|
-
` ${component.codeFull}: typeof ${component.codeFull}`
|
|
124
|
+
` ${component.codeFull}: typeof _${component.codeFull}`
|
|
101
125
|
)
|
|
102
126
|
})
|
|
103
127
|
|
|
@@ -6,11 +6,19 @@ import { PackageInitItem } from './PackageItem'
|
|
|
6
6
|
import { UI_DIR_PACKAGES } from '../../config'
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Class for initializing the package structure and development environment based on templates.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
11
|
+
* Класс для инициализации структуры пакета и среды разработки на основе шаблонов.
|
|
12
12
|
*/
|
|
13
13
|
export class PackageInit {
|
|
14
|
+
/**
|
|
15
|
+
* Constructor for PackageInit.
|
|
16
|
+
*
|
|
17
|
+
* Конструктор для PackageInit.
|
|
18
|
+
* @param type package type identifier / идентификатор типа пакета
|
|
19
|
+
* @param templates optional list of templates to apply / необязательный список шаблонов для применения
|
|
20
|
+
* @param dir base directory for packages / базовая директория для пакетов
|
|
21
|
+
*/
|
|
14
22
|
constructor(
|
|
15
23
|
protected readonly type: string,
|
|
16
24
|
protected readonly templates?: string,
|
|
@@ -19,9 +27,9 @@ export class PackageInit {
|
|
|
19
27
|
}
|
|
20
28
|
|
|
21
29
|
/**
|
|
22
|
-
*
|
|
30
|
+
* Triggers the package creation process and initializes required files.
|
|
23
31
|
*
|
|
24
|
-
*
|
|
32
|
+
* Запускает процесс создания пакета и инициализирует необходимые файлы.
|
|
25
33
|
*/
|
|
26
34
|
make() {
|
|
27
35
|
console.log(`Initializing package of type: ${this.type} with templates: ${this.templates}`)
|
|
@@ -29,11 +29,20 @@ type PackageInitItemFile = {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
32
|
+
* Class for initializing a single package component, managing its files, dependencies, and integration.
|
|
33
33
|
*
|
|
34
|
-
*
|
|
34
|
+
* Класс для инициализации отдельного компонента пакета, управления его файлами, зависимостями и интеграцией.
|
|
35
35
|
*/
|
|
36
36
|
export class PackageInitItem {
|
|
37
|
+
/**
|
|
38
|
+
* Constructor for PackageInitItem.
|
|
39
|
+
*
|
|
40
|
+
* Конструктор для PackageInitItem.
|
|
41
|
+
* @param name unique name of the component / уникальное имя компонента
|
|
42
|
+
* @param dir path to the component directory / путь к директории компонента
|
|
43
|
+
* @param type package type identifier / идентификатор типа пакета
|
|
44
|
+
* @param templates optional list of templates to apply / необязательный список шаблонов для применения
|
|
45
|
+
*/
|
|
37
46
|
constructor(
|
|
38
47
|
protected readonly name: string,
|
|
39
48
|
protected readonly dir: string[],
|
|
@@ -43,9 +52,9 @@ export class PackageInitItem {
|
|
|
43
52
|
}
|
|
44
53
|
|
|
45
54
|
/**
|
|
46
|
-
*
|
|
55
|
+
* Performs the full initialization cycle for the package item, including file creation and integration updates.
|
|
47
56
|
*
|
|
48
|
-
*
|
|
57
|
+
* Выполняет полный цикл инициализации элемента пакета, включая создание файлов и обновление интеграций.
|
|
49
58
|
*/
|
|
50
59
|
make() {
|
|
51
60
|
console.log('Package init in:', this.dir)
|
|
@@ -45,22 +45,33 @@ import { type PropertyList } from '../../types/propertyTypes'
|
|
|
45
45
|
const FILE_CACHE = 'properties'
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
|
-
*
|
|
48
|
+
* Central orchestrator for the design system's token management.
|
|
49
|
+
* Responsible for loading, merging, and executing a multi-stage transformation pipeline to convert raw property definitions into structured, resolved data for various output formats.
|
|
49
50
|
*
|
|
50
|
-
*
|
|
51
|
+
* Центральный оркестратор для управления токенами дизайн-системы.
|
|
52
|
+
* Отвечает за загрузку, слияние и выполнение многоэтапного конвейера преобразований для конвертации необработанных определений свойств в структурированные, разрешенные данные для различных выходных форматов.
|
|
51
53
|
*/
|
|
52
54
|
export class Properties {
|
|
53
55
|
private readonly designs: string[]
|
|
54
56
|
private readonly items: PropertiesItems
|
|
55
57
|
|
|
56
58
|
/**
|
|
57
|
-
* Constructor
|
|
59
|
+
* Constructor for Properties.
|
|
60
|
+
* Initializes the list of designs and triggers the token processing pipeline.
|
|
61
|
+
*
|
|
62
|
+
* Конструктор для Properties.
|
|
63
|
+
* Инициализирует список дизайнов и запускает конвейер обработки токенов.
|
|
58
64
|
*/
|
|
59
65
|
constructor() {
|
|
60
66
|
this.designs = PropertiesTool.getDesigns()
|
|
61
67
|
this.items = new PropertiesItems(this.read())
|
|
62
68
|
}
|
|
63
69
|
|
|
70
|
+
/**
|
|
71
|
+
* Returns the processed collection of design tokens.
|
|
72
|
+
*
|
|
73
|
+
* Возвращает обработанную коллекцию токенов дизайна.
|
|
74
|
+
*/
|
|
64
75
|
get() {
|
|
65
76
|
return this.items
|
|
66
77
|
}
|
|
@@ -20,9 +20,11 @@ type PropertiesCacheSystem = {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* Static orchestrator for managing persistent file caching in the design system.
|
|
24
|
+
* Provides a structured mechanism for storing transformed tokens, tracking file dependencies, and ensuring incremental build performance by avoiding redundant processing.
|
|
24
25
|
*
|
|
25
|
-
*
|
|
26
|
+
* Статический оркестратор для управления постоянным файловым кэшированием в дизайн-системе.
|
|
27
|
+
* Предоставляет структурированный механизм для хранения трансформированных токенов, отслеживания зависимостей файлов и обеспечения производительности инкрементальной сборки за счет исключения повторной обработки.
|
|
26
28
|
*/
|
|
27
29
|
export class PropertiesCache {
|
|
28
30
|
private static time = 0
|
|
@@ -31,16 +33,13 @@ export class PropertiesCache {
|
|
|
31
33
|
private static readonly listenerName: string[] = ['global']
|
|
32
34
|
|
|
33
35
|
/**
|
|
34
|
-
*
|
|
36
|
+
* Retrieves data from the cache or executes the callback to regenerate and store it if the cache is missing or outdated.
|
|
35
37
|
*
|
|
36
|
-
*
|
|
37
|
-
* @param path path
|
|
38
|
-
* @param name
|
|
39
|
-
* @param callback
|
|
40
|
-
*
|
|
41
|
-
* если файл не найден, вызывается функция обратного вызова (callback) и её
|
|
42
|
-
* результат сохраняется в текущем файле
|
|
43
|
-
* @param extension file extension by default is json/ расширение файла по умолчанию - json
|
|
38
|
+
* Извлекает данные из кэша или выполняет функцию обратного вызова для регенерации и сохранения данных, если кэш отсутствует или устарел.
|
|
39
|
+
* @param path the logical path structure for the cache file/ логическая структура пути для файла кэша
|
|
40
|
+
* @param name the unique identifier for the cache entry/ уникальный идентификатор записи кэша
|
|
41
|
+
* @param callback the generator function to execute on cache miss/ функция-генератор, выполняемая при отсутствии данных в кэше
|
|
42
|
+
* @param extension the file extension, typically 'json'/ расширение файла, обычно 'json'
|
|
44
43
|
*/
|
|
45
44
|
static get<T extends PropertiesFileValue>(
|
|
46
45
|
path: PropertiesFilePath,
|
|
@@ -67,10 +66,10 @@ export class PropertiesCache {
|
|
|
67
66
|
}
|
|
68
67
|
|
|
69
68
|
/**
|
|
70
|
-
*
|
|
69
|
+
* Directly reads a file and registers it as a dependency for the currently active cache listener.
|
|
71
70
|
*
|
|
72
|
-
*
|
|
73
|
-
* @param path
|
|
71
|
+
* Напрямую читает файл и регистрирует его как зависимость для текущего активного слушателя кэша.
|
|
72
|
+
* @param path the path to the file to be read/ путь к считываемому файлу
|
|
74
73
|
*/
|
|
75
74
|
static read<R>(path: PropertiesFilePath): R | undefined {
|
|
76
75
|
if (PropertiesFile.is(path)) {
|
|
@@ -89,20 +88,20 @@ export class PropertiesCache {
|
|
|
89
88
|
}
|
|
90
89
|
|
|
91
90
|
/**
|
|
92
|
-
*
|
|
91
|
+
* Persists intermediate results to the temporary step-based cache directory.
|
|
93
92
|
*
|
|
94
|
-
* Сохраняет промежуточные
|
|
95
|
-
* @param name
|
|
96
|
-
* @param value
|
|
93
|
+
* Сохраняет промежуточные результаты во временную директорию пошагового кэша.
|
|
94
|
+
* @param name the name of the cached step result/ название кэшированного результата шага
|
|
95
|
+
* @param value the data structure to persist/ структура данных для сохранения
|
|
97
96
|
*/
|
|
98
97
|
static write<T extends PropertiesFileValue>(name: string, value: T): void {
|
|
99
98
|
this.writeFile<T>(DIR_STEP, name, value)
|
|
100
99
|
}
|
|
101
100
|
|
|
102
101
|
/**
|
|
103
|
-
*
|
|
102
|
+
* Recursively removes all cached data from the `.cache` directory.
|
|
104
103
|
*
|
|
105
|
-
*
|
|
104
|
+
* Рекурсивно удаляет все кэшированные данные из директории `.cache`.
|
|
106
105
|
*/
|
|
107
106
|
static clear(): void {
|
|
108
107
|
PropertiesFile.removeDir(this.getPath([]))
|