@dxtmisha/scripts 0.8.2 → 0.9.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 +6 -0
- package/bin/build-functional.ts +1 -1
- package/bin/build-packages.ts +7 -0
- package/bin/build-publish-packages.ts +7 -0
- package/package.json +3 -1
- package/src/classes/Build/BuildPackages.ts +111 -0
- package/src/classes/Build/BuildPublishPackages.ts +105 -0
- package/src/classes/Design/DesignWikiStormItem.ts +42 -4
- package/src/classes/Package/PackageFile.ts +150 -0
- package/src/functions/run.ts +47 -0
- package/src/library.ts +1 -1
- package/src/media/templates/packages/library/package.json +12 -8
- package/src/types/webTypes.ts +1 -1
- package/src/classes/Build/__tests__/buildFunctional.test.ts +0 -43
- /package/src/classes/Build/{buildFunctional.ts → BuildFunctional.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.8.2] - 2026-05-13
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
- **Type Generation**: Modified `DesignReplace.ts` to implement stricter typing for generated component properties. Removed the automatic addition of the generic `string` type to union prop definitions, ensuring generated components use precise literal types.
|
|
9
|
+
- **Wiki Integration**: Updated `DesignWikiStormItem.ts` to improve technical data generation for the wiki system.
|
|
10
|
+
|
|
5
11
|
## [0.8.0] - 2026-05-10
|
|
6
12
|
|
|
7
13
|
### Added
|
package/bin/build-functional.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxtmisha/scripts",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.9.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Development scripts and CLI tools for DXT UI projects - automated component generation, library building and project management tools",
|
|
7
7
|
"keywords": [
|
|
@@ -44,6 +44,8 @@
|
|
|
44
44
|
"bin": {
|
|
45
45
|
"dxt-ai-doc": "bin/ai-doc.ts",
|
|
46
46
|
"dxt-build-functional": "bin/build-functional.ts",
|
|
47
|
+
"dxt-build-packages": "bin/build-packages.ts",
|
|
48
|
+
"dxt-build-publish-packages": "bin/build-publish-packages.ts",
|
|
47
49
|
"dxt-component": "bin/design-component.ts",
|
|
48
50
|
"dxt-component-wiki": "bin/design-component-wiki.ts",
|
|
49
51
|
"dxt-constructor": "bin/design-constructor.ts",
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { run } from '../../functions/run'
|
|
2
|
+
|
|
3
|
+
import { PropertiesFile } from '../Properties/PropertiesFile'
|
|
4
|
+
import { PackageFile } from '../Package/PackageFile'
|
|
5
|
+
|
|
6
|
+
import { UI_DIR_PACKAGES } from '../../config'
|
|
7
|
+
|
|
8
|
+
const UI_BUILD_LOG_FILE = ['.', 'logs', 'ui-build.log.json']
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Class for building all packages in the project.
|
|
12
|
+
*
|
|
13
|
+
* Класс для сборки всех пакетов в проекте.
|
|
14
|
+
*/
|
|
15
|
+
export class BuildPackages {
|
|
16
|
+
protected readonly log: Record<string, string>
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Constructor
|
|
20
|
+
* @param path packages directory path / путь к директории пакетов
|
|
21
|
+
*/
|
|
22
|
+
constructor(
|
|
23
|
+
protected readonly path: string = UI_DIR_PACKAGES
|
|
24
|
+
) {
|
|
25
|
+
this.log = PropertiesFile.readFile(UI_BUILD_LOG_FILE) ?? {}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Scans the packages directory and builds each package that contains a package.json.
|
|
30
|
+
*
|
|
31
|
+
* Сканирует директорию пакетов и собирает каждый пакет, содержащий package.json.
|
|
32
|
+
*/
|
|
33
|
+
async make(): Promise<void> {
|
|
34
|
+
const list = PropertiesFile.readDir(this.path)
|
|
35
|
+
let changed = 0
|
|
36
|
+
|
|
37
|
+
console.info(`Build packages(${list.length})...`)
|
|
38
|
+
|
|
39
|
+
for (const folder of list) {
|
|
40
|
+
const packageFile = new PackageFile([this.path, folder])
|
|
41
|
+
|
|
42
|
+
if (
|
|
43
|
+
packageFile.is()
|
|
44
|
+
&& !packageFile.isTest()
|
|
45
|
+
&& this.isUpdate(packageFile)
|
|
46
|
+
&& await this.build(packageFile)
|
|
47
|
+
) {
|
|
48
|
+
this.updateLog(packageFile)
|
|
49
|
+
changed++
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (changed > 0) {
|
|
54
|
+
this.saveLog()
|
|
55
|
+
console.info(`Build packages changed: ${changed}`)
|
|
56
|
+
} else {
|
|
57
|
+
console.info('Build packages - no changes')
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
protected async build(packageFile: PackageFile): Promise<boolean> {
|
|
62
|
+
const code = packageFile.getCodeBuildOrRecovery()
|
|
63
|
+
|
|
64
|
+
if (code) {
|
|
65
|
+
return await run(packageFile, `npm run ${code}`)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return false
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Checks if the package needs to be updated.
|
|
73
|
+
*
|
|
74
|
+
* Проверяет, нужно ли обновлять пакет.
|
|
75
|
+
* @param packageFile package file object / объект файла пакета
|
|
76
|
+
*/
|
|
77
|
+
protected isUpdate(packageFile: PackageFile): boolean {
|
|
78
|
+
return !packageFile.isVersionConsistency(
|
|
79
|
+
this.getVersionLog(packageFile.getName())
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Returns the cached version of the package from the build log.
|
|
85
|
+
*
|
|
86
|
+
* Возвращает кэшированную версию пакета из лога сборки.
|
|
87
|
+
* @param name package name / имя пакета
|
|
88
|
+
*/
|
|
89
|
+
protected getVersionLog(name: string): string {
|
|
90
|
+
return this.log?.[name] ?? '0.0.0'
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Updates the build log with the current package version in memory.
|
|
95
|
+
*
|
|
96
|
+
* Обновляет лог сборки текущей версией пакета в памяти.
|
|
97
|
+
* @param packageFile package file object / объект файла пакета
|
|
98
|
+
*/
|
|
99
|
+
protected updateLog(packageFile: PackageFile): void {
|
|
100
|
+
this.log[packageFile.getName()] = packageFile.getVersion()
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Saves the build log to a file.
|
|
105
|
+
*
|
|
106
|
+
* Сохраняет лог сборки в файл.
|
|
107
|
+
*/
|
|
108
|
+
protected saveLog(): void {
|
|
109
|
+
PropertiesFile.writeByPath(UI_BUILD_LOG_FILE, this.log)
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { PropertiesFile } from '../Properties/PropertiesFile'
|
|
2
|
+
import { PackageFile } from '../Package/PackageFile'
|
|
3
|
+
import { run } from '../../functions/run'
|
|
4
|
+
import { UI_DIR_PACKAGES } from '../../config'
|
|
5
|
+
|
|
6
|
+
const UI_PUBLISH_LOG_FILE = ['.', 'logs', 'ui-publish.log.json']
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Class for publishing all packages in the project.
|
|
10
|
+
*
|
|
11
|
+
* Класс для публикации всех пакетов в проекте.
|
|
12
|
+
*/
|
|
13
|
+
export class BuildPublishPackages {
|
|
14
|
+
protected readonly log: Record<string, string>
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Constructor
|
|
18
|
+
* @param path packages directory path / путь к директории пакетов
|
|
19
|
+
*/
|
|
20
|
+
constructor(
|
|
21
|
+
protected readonly path: string = UI_DIR_PACKAGES
|
|
22
|
+
) {
|
|
23
|
+
this.log = PropertiesFile.readFile(UI_PUBLISH_LOG_FILE) ?? {}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Scans the packages directory and publishes each package that has a new version.
|
|
28
|
+
*
|
|
29
|
+
* Сканирует директорию пакетов и публикует каждый пакет с новой версией.
|
|
30
|
+
*/
|
|
31
|
+
async make(): Promise<void> {
|
|
32
|
+
const list = PropertiesFile.readDir(this.path)
|
|
33
|
+
let changed = 0
|
|
34
|
+
|
|
35
|
+
console.info(`Publish packages(${list.length})...`)
|
|
36
|
+
|
|
37
|
+
for (const folder of list) {
|
|
38
|
+
const packageFile = new PackageFile([this.path, folder])
|
|
39
|
+
|
|
40
|
+
if (
|
|
41
|
+
packageFile.is()
|
|
42
|
+
&& !packageFile.isNoPublish()
|
|
43
|
+
) {
|
|
44
|
+
if (
|
|
45
|
+
this.log[packageFile.getName()] === undefined
|
|
46
|
+
|| (
|
|
47
|
+
this.isUpdate(packageFile)
|
|
48
|
+
&& await run(packageFile, packageFile.getCodePublish(), true, true)
|
|
49
|
+
)
|
|
50
|
+
) {
|
|
51
|
+
this.updateLog(packageFile)
|
|
52
|
+
changed++
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (changed > 0) {
|
|
58
|
+
this.saveLog()
|
|
59
|
+
console.info(`Publish packages changed: ${changed}`)
|
|
60
|
+
} else {
|
|
61
|
+
console.info('Publish packages - no changes')
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Checks if the package needs to be published.
|
|
67
|
+
*
|
|
68
|
+
* Проверяет, нужно ли публиковать пакет.
|
|
69
|
+
* @param packageFile package file object / объект файла пакета
|
|
70
|
+
*/
|
|
71
|
+
protected isUpdate(packageFile: PackageFile): boolean {
|
|
72
|
+
return !packageFile.isVersionConsistency(
|
|
73
|
+
this.getVersionLog(packageFile.getName())
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Returns the cached version of the package from the publish log.
|
|
79
|
+
*
|
|
80
|
+
* Возвращает кэшированную версию пакета из лога публикации.
|
|
81
|
+
* @param name package name / имя пакета
|
|
82
|
+
*/
|
|
83
|
+
protected getVersionLog(name: string): string {
|
|
84
|
+
return this.log?.[name] ?? '0.0.0'
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Updates the publish log with the current package version in memory.
|
|
89
|
+
*
|
|
90
|
+
* Обновляет лог публикации текущей версией пакета в памяти.
|
|
91
|
+
* @param packageFile package file object / объект файла пакета
|
|
92
|
+
*/
|
|
93
|
+
protected updateLog(packageFile: PackageFile): void {
|
|
94
|
+
this.log[packageFile.getName()] = packageFile.getVersion()
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Saves the publish log to a file.
|
|
99
|
+
*
|
|
100
|
+
* Сохраняет лог публикации в файл.
|
|
101
|
+
*/
|
|
102
|
+
protected saveLog(): void {
|
|
103
|
+
PropertiesFile.writeByPath(UI_PUBLISH_LOG_FILE, this.log)
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -7,6 +7,13 @@ import { PropertiesFile } from '../Properties/PropertiesFile'
|
|
|
7
7
|
|
|
8
8
|
import type { LibraryData } from '../../types/libraryTypes'
|
|
9
9
|
import type { WebTypesAttributeItem, WebTypesAttributes, WebTypesEvents, WebTypesSlots, WebTypesTagItem } from '../../types/webTypes'
|
|
10
|
+
import { forEach } from '@dxtmisha/functional-basic'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* List of basic types that do not need to be wrapped in quotes for web-types/
|
|
14
|
+
* Список базовых типов, которые не нужно оборачивать в кавычки для web-types
|
|
15
|
+
*/
|
|
16
|
+
const BASE_TYPES = /^(boolean|number|string|null|any|void|object|unknown|never)$/
|
|
10
17
|
|
|
11
18
|
/**
|
|
12
19
|
* Resolver for extracting and formatting IDE metadata for a specific component.
|
|
@@ -78,13 +85,14 @@ export class DesignWikiStormItem {
|
|
|
78
85
|
* @param item prop item / элемент свойства
|
|
79
86
|
*/
|
|
80
87
|
getAttribute(item: WikiStorybookProp): WebTypesAttributeItem {
|
|
88
|
+
const type = this.prepareType(item.getType())
|
|
81
89
|
return {
|
|
82
90
|
name: item.getName(),
|
|
83
91
|
description: item.getDescription(),
|
|
84
|
-
default: item.getDefaultValue(),
|
|
92
|
+
// default: item.getDefaultValue(),
|
|
85
93
|
value: {
|
|
86
94
|
kind: 'expression',
|
|
87
|
-
type
|
|
95
|
+
type
|
|
88
96
|
}
|
|
89
97
|
}
|
|
90
98
|
}
|
|
@@ -120,8 +128,8 @@ export class DesignWikiStormItem {
|
|
|
120
128
|
|
|
121
129
|
data.slots.forEach(
|
|
122
130
|
props => slots.push({
|
|
123
|
-
name: props.name,
|
|
124
|
-
description: props.description,
|
|
131
|
+
'name': props.name,
|
|
132
|
+
'description': props.description,
|
|
125
133
|
'vue-properties': props.properties ?? []
|
|
126
134
|
})
|
|
127
135
|
)
|
|
@@ -224,6 +232,36 @@ export class DesignWikiStormItem {
|
|
|
224
232
|
]
|
|
225
233
|
}
|
|
226
234
|
|
|
235
|
+
/**
|
|
236
|
+
* Formats a type string for web-types.
|
|
237
|
+
*
|
|
238
|
+
* Форматирует строку типа для web-types.
|
|
239
|
+
* @param type original type string / исходная строка типа
|
|
240
|
+
*/
|
|
241
|
+
protected prepareType(type?: string): string | undefined {
|
|
242
|
+
if (type) {
|
|
243
|
+
return forEach(
|
|
244
|
+
type.split('|'),
|
|
245
|
+
(item) => {
|
|
246
|
+
const trimmed = item.trim()
|
|
247
|
+
|
|
248
|
+
if (trimmed === 'undefined') {
|
|
249
|
+
return undefined
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
if (BASE_TYPES.test(trimmed)) {
|
|
253
|
+
return trimmed
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
return `'${trimmed}'`
|
|
257
|
+
}
|
|
258
|
+
)
|
|
259
|
+
.join(' | ')
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
return type
|
|
263
|
+
}
|
|
264
|
+
|
|
227
265
|
/**
|
|
228
266
|
* Initializes the wiki object.
|
|
229
267
|
*
|
|
@@ -0,0 +1,150 @@
|
|
|
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 ('build-recovery' in scripts) {
|
|
126
|
+
return 'build-recovery'
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if ('build' in scripts) {
|
|
130
|
+
return 'build'
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return undefined
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Returns the command name for publish or publish-to-npm.
|
|
138
|
+
*
|
|
139
|
+
* Возвращает название команды для publish или publish-to-npm.
|
|
140
|
+
*/
|
|
141
|
+
getCodePublish(): string {
|
|
142
|
+
const scripts = this.getScripts()
|
|
143
|
+
|
|
144
|
+
if ('publish-to-npm' in scripts) {
|
|
145
|
+
return 'npm run publish-to-npm'
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return 'npm publish --access public'
|
|
149
|
+
}
|
|
150
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { promisify } from 'node:util'
|
|
2
|
+
import { exec } from 'node:child_process'
|
|
3
|
+
|
|
4
|
+
import { PackageFile } from '../classes/Package/PackageFile'
|
|
5
|
+
import { PropertiesFile } from '../classes/Properties/PropertiesFile'
|
|
6
|
+
|
|
7
|
+
const execAsync = promisify(exec)
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Executes a command for a specific package.
|
|
11
|
+
*
|
|
12
|
+
* Выполняет команду для конкретного пакета.
|
|
13
|
+
* @param packageFile package file object / объект файла пакета
|
|
14
|
+
* @param command command to execute / команда для выполнения
|
|
15
|
+
* @param showStdout whether to show stdout in the console / нужно ли выводить stdout в консоль
|
|
16
|
+
* @param showStderr whether to show stderr in the console / нужно ли выводить stderr в консоль
|
|
17
|
+
*/
|
|
18
|
+
export async function run(
|
|
19
|
+
packageFile: PackageFile,
|
|
20
|
+
command: string,
|
|
21
|
+
showStdout: boolean = false,
|
|
22
|
+
showStderr: boolean = false
|
|
23
|
+
): Promise<boolean> {
|
|
24
|
+
const name = packageFile.getName()
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
const { stdout, stderr } = await execAsync(command, {
|
|
28
|
+
cwd: PropertiesFile.joinPath(packageFile.getDir())
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
console.log(`Command ${command} for ${name}`)
|
|
32
|
+
|
|
33
|
+
if (stdout && showStdout) {
|
|
34
|
+
console.log(stdout)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (stderr && showStderr) {
|
|
38
|
+
console.error(stderr)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return true
|
|
42
|
+
} catch (error) {
|
|
43
|
+
console.error(`Error command ${command} for ${name}:`, error)
|
|
44
|
+
|
|
45
|
+
return false
|
|
46
|
+
}
|
|
47
|
+
}
|
package/src/library.ts
CHANGED
|
@@ -15,7 +15,7 @@ export * from './classes/Ai/AiGoogleCli'
|
|
|
15
15
|
export * from './classes/Ai/AiGoogleCliLite'
|
|
16
16
|
export * from './classes/Ai/AiGoogleLite'
|
|
17
17
|
export * from './classes/BrowserItem'
|
|
18
|
-
export * from './classes/Build/
|
|
18
|
+
export * from './classes/Build/BuildFunctional'
|
|
19
19
|
export * from './classes/BuildItem'
|
|
20
20
|
export * from './classes/Design/DesignFigma'
|
|
21
21
|
export * from './classes/Design/DesignScreenshot'
|
|
@@ -15,22 +15,26 @@
|
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
17
|
"dist",
|
|
18
|
-
"
|
|
19
|
-
"
|
|
18
|
+
"ai-description.txt",
|
|
19
|
+
"ai-doc.ru.txt",
|
|
20
|
+
"ai-doc.txt",
|
|
21
|
+
"ai-types.txt",
|
|
22
|
+
"CHANGELOG.md",
|
|
23
|
+
"LICENSE",
|
|
24
|
+
"package.json",
|
|
25
|
+
"README.md"
|
|
20
26
|
],
|
|
21
27
|
"main": "dist/library.js",
|
|
22
28
|
"module": "dist/library.js",
|
|
23
|
-
"types": "dist/library.d.ts",
|
|
29
|
+
"types": "dist/src/library.d.ts",
|
|
24
30
|
"exports": {
|
|
25
31
|
".": {
|
|
26
32
|
"import": "./dist/library.js",
|
|
27
|
-
"types": "./dist/library.d.ts"
|
|
33
|
+
"types": "./dist/src/library.d.ts"
|
|
28
34
|
},
|
|
29
|
-
"./style.css": "./dist/style.css"
|
|
30
|
-
"./types/*": "./dist/*",
|
|
31
|
-
"./types/**/*.d.ts": "./dist/**/*.d.ts"
|
|
35
|
+
"./style.css": "./dist/style.css"
|
|
32
36
|
},
|
|
33
37
|
"dependencies": {},
|
|
34
38
|
"devDependencies": {},
|
|
35
39
|
"sideEffects": false
|
|
36
|
-
}
|
|
40
|
+
}
|
package/src/types/webTypes.ts
CHANGED
|
@@ -25,7 +25,7 @@ export type WebTypesProperties = WebTypesProperty[]
|
|
|
25
25
|
*
|
|
26
26
|
* Вид значения атрибута.
|
|
27
27
|
*/
|
|
28
|
-
export type WebTypesAttributeKind = 'expression' | 'string'
|
|
28
|
+
export type WebTypesAttributeKind = 'expression' | 'plainText' | 'string'
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* Attribute definition for a tag.
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it, vi } from 'vitest'
|
|
2
|
-
import { BuildFunctional } from '../buildFunctional'
|
|
3
|
-
import { PropertiesFile } from '../../Properties/PropertiesFile'
|
|
4
|
-
import { UI_DIRS_LIBRARY } from '../../../config'
|
|
5
|
-
|
|
6
|
-
vi.mock('@dxtmisha/functional', () => ({
|
|
7
|
-
func1: vi.fn(),
|
|
8
|
-
func2: vi.fn()
|
|
9
|
-
}))
|
|
10
|
-
|
|
11
|
-
vi.mock('../../Properties/PropertiesFile', () => ({
|
|
12
|
-
PropertiesFile: {
|
|
13
|
-
writeByPath: vi.fn()
|
|
14
|
-
}
|
|
15
|
-
}))
|
|
16
|
-
|
|
17
|
-
describe('BuildFunctional', () => {
|
|
18
|
-
it('getList should return keys of the functional package', () => {
|
|
19
|
-
const build = new BuildFunctional()
|
|
20
|
-
const list = build.getList()
|
|
21
|
-
expect(list).toContain('func1')
|
|
22
|
-
expect(list).toContain('func2')
|
|
23
|
-
expect(list).toHaveLength(2)
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
it('make should call PropertiesFile.writeByPath with correct arguments', () => {
|
|
27
|
-
const build = new BuildFunctional()
|
|
28
|
-
build.make()
|
|
29
|
-
|
|
30
|
-
expect(PropertiesFile.writeByPath).toHaveBeenCalledWith(
|
|
31
|
-
[...UI_DIRS_LIBRARY, 'functional.ts'],
|
|
32
|
-
expect.stringContaining('export { func1 } from \'@dxtmisha/functional\'')
|
|
33
|
-
)
|
|
34
|
-
expect(PropertiesFile.writeByPath).toHaveBeenCalledWith(
|
|
35
|
-
[...UI_DIRS_LIBRARY, 'functional.ts'],
|
|
36
|
-
expect.stringContaining('export { func2 } from \'@dxtmisha/functional\'')
|
|
37
|
-
)
|
|
38
|
-
expect(PropertiesFile.writeByPath).toHaveBeenCalledWith(
|
|
39
|
-
[...UI_DIRS_LIBRARY, 'functional.ts'],
|
|
40
|
-
expect.stringContaining('export type * from \'@dxtmisha/functional\'')
|
|
41
|
-
)
|
|
42
|
-
})
|
|
43
|
-
})
|
|
File without changes
|