@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.
Files changed (104) hide show
  1. package/bin/design-wiki-storm.ts +9 -0
  2. package/package.json +5 -3
  3. package/src/classes/Ai/AiAbstract.ts +14 -1
  4. package/src/classes/Ai/AiGoogleLite.ts +2 -1
  5. package/src/classes/Build/__tests__/buildFunctional.test.ts +43 -0
  6. package/src/classes/Build/buildFunctional.ts +15 -0
  7. package/src/classes/Component/ComponentCreator.ts +1 -0
  8. package/src/classes/Component/ComponentItem.ts +15 -0
  9. package/src/classes/Component/ComponentWiki.ts +8 -0
  10. package/src/classes/Component/ComponentWikiFile.ts +2 -0
  11. package/src/classes/Component/__tests__/ComponentCreator.test.ts +71 -0
  12. package/src/classes/Component/__tests__/ComponentItem.test.ts +71 -0
  13. package/src/classes/Design/DesignCommand.ts +13 -8
  14. package/src/classes/Design/DesignComponent.ts +235 -28
  15. package/src/classes/Design/DesignConstructor.ts +9 -5
  16. package/src/classes/Design/DesignConstructors.ts +8 -4
  17. package/src/classes/Design/DesignFlags.ts +16 -0
  18. package/src/classes/Design/DesignReplace.ts +10 -6
  19. package/src/classes/Design/DesignStructure.ts +8 -6
  20. package/src/classes/Design/DesignStructureClasses.ts +8 -4
  21. package/src/classes/Design/DesignStructureItemAbstract.ts +11 -2
  22. package/src/classes/Design/DesignStructureRead.ts +8 -4
  23. package/src/classes/Design/DesignStructureStyles.ts +8 -4
  24. package/src/classes/Design/DesignTypes.ts +53 -28
  25. package/src/classes/Design/DesignTypescript.ts +11 -2
  26. package/src/classes/Design/DesignUi.ts +42 -11
  27. package/src/classes/Design/DesignWiki.ts +4 -6
  28. package/src/classes/Design/DesignWikiStorm.ts +94 -0
  29. package/src/classes/Design/DesignWikiStormItem.ts +246 -0
  30. package/src/classes/Git/GitRead.ts +1 -0
  31. package/src/classes/Git/__tests__/GitRead.test.ts +70 -0
  32. package/src/classes/Library/LibraryAiWiki.ts +2 -1
  33. package/src/classes/Library/LibraryFlags.ts +9 -7
  34. package/src/classes/Library/LibraryItems.ts +9 -9
  35. package/src/classes/Library/LibraryList.ts +10 -5
  36. package/src/classes/Library/LibraryMedia.ts +21 -6
  37. package/src/classes/Library/LibraryPlugin.ts +8 -5
  38. package/src/classes/Library/LibraryTypes.ts +34 -10
  39. package/src/classes/Package/PackageInit.ts +12 -4
  40. package/src/classes/Package/PackageItem.ts +13 -4
  41. package/src/classes/Properties/Properties.ts +14 -3
  42. package/src/classes/Properties/PropertiesCache.ts +19 -20
  43. package/src/classes/Properties/PropertiesConfig.ts +39 -28
  44. package/src/classes/Properties/PropertiesConvector.ts +10 -6
  45. package/src/classes/Properties/PropertiesFile.ts +22 -28
  46. package/src/classes/Properties/PropertiesImport.ts +10 -7
  47. package/src/classes/Properties/PropertiesItems.ts +19 -12
  48. package/src/classes/Properties/PropertiesKeys.ts +15 -9
  49. package/src/classes/Properties/PropertiesMain.ts +13 -7
  50. package/src/classes/Properties/PropertiesPalette.ts +12 -6
  51. package/src/classes/Properties/PropertiesPath.ts +17 -11
  52. package/src/classes/Properties/PropertiesScss.ts +10 -8
  53. package/src/classes/Properties/PropertiesSeparator.ts +9 -11
  54. package/src/classes/Properties/PropertiesSettings.ts +8 -6
  55. package/src/classes/Properties/PropertiesStandard.ts +5 -6
  56. package/src/classes/Properties/PropertiesTool.ts +16 -9
  57. package/src/classes/Properties/PropertiesTypes.ts +12 -12
  58. package/src/classes/Properties/PropertiesValues.ts +14 -14
  59. package/src/classes/Properties/PropertiesWrap.ts +5 -6
  60. package/src/classes/Properties/convector/convectorColor.ts +5 -3
  61. package/src/classes/Properties/to/PropertiesToAbstract.ts +18 -4
  62. package/src/composables/__tests__/useAi.test.ts +75 -0
  63. package/src/config.ts +2 -0
  64. package/src/functions/__tests__/getComponentPaths.test.ts +19 -0
  65. package/src/functions/__tests__/getConfigAi.test.ts +26 -0
  66. package/src/functions/__tests__/getConstructorProperties.test.ts +51 -0
  67. package/src/functions/__tests__/getDirname.test.ts +31 -0
  68. package/src/functions/__tests__/getNameDirByPaths.test.ts +40 -0
  69. package/src/functions/__tests__/getPackageJson.test.ts +34 -0
  70. package/src/functions/__tests__/hasNativeDirname.test.ts +18 -0
  71. package/src/functions/__tests__/toPathStandardSep.test.ts +31 -0
  72. package/src/functions/getConfigAi.ts +3 -2
  73. package/src/functions/toPathStandardSep.ts +1 -1
  74. package/src/library-ai.ts +0 -1
  75. package/src/library.ts +6 -0
  76. package/src/media/properties/css.ts +3 -1
  77. package/src/media/templates/component/props.ts +1 -1
  78. package/src/media/templates/component/wiki.ts +6 -12
  79. package/src/media/templates/component/wikiData.ts +28 -0
  80. package/src/media/templates/packages/figma/README.md +1 -0
  81. package/src/media/templates/packages/figma/ai.sample.config.ts +2 -0
  82. package/src/media/templates/packages/figma/design.config.json +3 -0
  83. package/src/media/templates/packages/figma/index.html +12 -0
  84. package/src/media/templates/packages/figma/manifest.json +25 -0
  85. package/src/media/templates/packages/figma/package.json +37 -0
  86. package/src/media/templates/packages/figma/src/App.vue +9 -0
  87. package/src/media/templates/packages/figma/src/classes/_.gitignore.txt +1 -0
  88. package/src/media/templates/packages/figma/src/code.ts +16 -0
  89. package/src/media/templates/packages/figma/src/components/_.gitignore.txt +1 -0
  90. package/src/media/templates/packages/figma/src/composables/_.gitignore.txt +1 -0
  91. package/src/media/templates/packages/figma/src/config.ts +0 -0
  92. package/src/media/templates/packages/figma/src/functions/_.gitignore.txt +1 -0
  93. package/src/media/templates/packages/figma/src/library.ts +0 -0
  94. package/src/media/templates/packages/figma/src/main.ts +4 -0
  95. package/src/media/templates/packages/figma/src/media/_.gitignore.txt +1 -0
  96. package/src/media/templates/packages/figma/src/storybook/_.gitignore.txt +1 -0
  97. package/src/media/templates/packages/figma/src/types/_.gitignore.txt +1 -0
  98. package/src/media/templates/packages/figma/src/vite-env.d.ts +1 -0
  99. package/src/media/templates/packages/figma/tsconfig.app.json +12 -0
  100. package/src/media/templates/packages/figma/tsconfig.json +7 -0
  101. package/src/media/templates/packages/figma/tsconfig.node.json +8 -0
  102. package/src/media/templates/packages/figma/vite.config.ts +7 -0
  103. package/src/types/configTypes.ts +3 -0
  104. 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 file to connect flags.
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
- * @param items object for working with the list of components/ объект для работы со списком компонентов
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
- * Adds a file with flags.<br>
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 creating a file with a list of components.
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 files with a list of components.
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 the media data connection file.
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
- * @param items object for working with the list of components/ объект для работы со списком компонентов
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 creating a file with type exports.
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 a file with type exports.
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
- ...this.initExports(),
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
- `export const ${component.codeFull} = _${component.codeFull}`
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
- * Initializes the package configuration and environment.
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
- * Creates the package structure and initializes files.
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
- * Represents a single package item with its metadata and operations.
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
- * Initializes the package item by creating files from samples and templates.
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
- * The main class for working with tokens.
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
- * Processing for storing temporary files.
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
- * Reads data from the cache or updates the cache if the data is outdated.
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 to the file/ путь к файлу
38
- * @param name file name/ название файла
39
- * @param callback if the file is not found, the callback function is called
40
- * and its result is saved in the current file /
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
- * Returns the content of the file by the specified path
69
+ * Directly reads a file and registers it as a dependency for the currently active cache listener.
71
70
  *
72
- * Возвращает содержимое файла по указанному пути.
73
- * @param path filename/ имя файла
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
- * Saves intermediate data
91
+ * Persists intermediate results to the temporary step-based cache directory.
93
92
  *
94
- * Сохраняет промежуточные данные.
95
- * @param name file name/ название файла
96
- * @param value values for storage/ значения для хранения
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
- * Clear cached data
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([]))