@dxtmisha/scripts 0.5.19 → 0.5.21
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/package.json +1 -1
- package/src/classes/Ai/AiDocItem.ts +8 -1
- package/src/classes/Ai/AiDocItemClasses.ts +8 -1
- package/src/classes/Ai/AiDocItemComposables.ts +8 -1
- package/src/classes/BuildItem.ts +8 -1
- package/src/classes/Component/ComponentItem.ts +8 -1
- package/src/classes/Component/ComponentWiki.ts +9 -1
- package/src/classes/Design/DesignCommand.ts +8 -1
- package/src/classes/Git/GitRead.ts +3 -1
- package/src/classes/Package/PackageItem.ts +8 -1
- package/src/classes/Properties/PropertiesFile.ts +8 -5
- package/src/functions/getConstructorProperties.ts +7 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxtmisha/scripts",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.21",
|
|
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": [
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
import { dirname } from 'node:path'
|
|
2
|
+
import { fileURLToPath } from 'node:url'
|
|
3
|
+
import { hasNativeDirname } from '../../functions/hasNativeDirname'
|
|
1
4
|
import { AiDocItemAbstract } from './AiDocItemAbstract'
|
|
2
5
|
|
|
6
|
+
const dirnamePath = hasNativeDirname()
|
|
7
|
+
? __dirname
|
|
8
|
+
: dirname(fileURLToPath(import.meta.url))
|
|
9
|
+
|
|
3
10
|
/** Sample prompt template path / Путь к шаблону промпта */
|
|
4
|
-
const FILE_PROMPT_SAMPLE = [
|
|
11
|
+
const FILE_PROMPT_SAMPLE = [dirnamePath, '..', '..', 'media', 'templates', 'prompts']
|
|
5
12
|
|
|
6
13
|
/** Sample prompt template path for functions / Путь к шаблону промпта для функций */
|
|
7
14
|
const FILE_PROMPT_SAMPLE_ITEM = [...FILE_PROMPT_SAMPLE, 'aiDocFunctionPrompt.en.txt']
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
import { dirname } from 'node:path'
|
|
2
|
+
import { fileURLToPath } from 'node:url'
|
|
3
|
+
import { hasNativeDirname } from '../../functions/hasNativeDirname'
|
|
1
4
|
import { AiDocItemAbstract } from './AiDocItemAbstract'
|
|
2
5
|
|
|
6
|
+
const dirnamePath = hasNativeDirname()
|
|
7
|
+
? __dirname
|
|
8
|
+
: dirname(fileURLToPath(import.meta.url))
|
|
9
|
+
|
|
3
10
|
/** Sample prompt template path / Путь к шаблону промпта */
|
|
4
|
-
const FILE_PROMPT_SAMPLE = [
|
|
11
|
+
const FILE_PROMPT_SAMPLE = [dirnamePath, '..', '..', 'media', 'templates', 'prompts']
|
|
5
12
|
|
|
6
13
|
/** Sample prompt template for classes / Шаблон промпта для классов */
|
|
7
14
|
const FILE_PROMPT_SAMPLE_CLASS = [...FILE_PROMPT_SAMPLE, 'aiDocClassPrompt.en.txt']
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
import { dirname } from 'node:path'
|
|
2
|
+
import { fileURLToPath } from 'node:url'
|
|
3
|
+
import { hasNativeDirname } from '../../functions/hasNativeDirname'
|
|
1
4
|
import { AiDocItemAbstract } from './AiDocItemAbstract'
|
|
2
5
|
|
|
6
|
+
const dirnamePath = hasNativeDirname()
|
|
7
|
+
? __dirname
|
|
8
|
+
: dirname(fileURLToPath(import.meta.url))
|
|
9
|
+
|
|
3
10
|
/** Sample prompt template path / Путь к шаблону промпта */
|
|
4
|
-
const FILE_PROMPT_SAMPLE = [
|
|
11
|
+
const FILE_PROMPT_SAMPLE = [dirnamePath, '..', '..', 'media', 'templates', 'prompts']
|
|
5
12
|
|
|
6
13
|
const FILE_PROMPT_SAMPLE_COMPOSABLE = [...FILE_PROMPT_SAMPLE, 'aiDocComposablePrompt.en.txt']
|
|
7
14
|
|
package/src/classes/BuildItem.ts
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
|
+
import { dirname } from 'node:path'
|
|
2
|
+
import { fileURLToPath } from 'node:url'
|
|
1
3
|
import { promisify } from 'node:util'
|
|
2
4
|
import { exec } from 'node:child_process'
|
|
5
|
+
import { hasNativeDirname } from '../functions/hasNativeDirname'
|
|
3
6
|
|
|
4
7
|
import { PropertiesFile } from './Properties/PropertiesFile'
|
|
5
8
|
import { ComponentWikiFile } from './Component/ComponentWikiFile'
|
|
6
9
|
|
|
7
10
|
import { UI_DIR_DIST_TEMPORARY, UI_FILE_NAME_VITE, UI_FILE_NAME_VITE_WORKERS } from '../config'
|
|
8
11
|
|
|
12
|
+
const dirnamePath = hasNativeDirname()
|
|
13
|
+
? __dirname
|
|
14
|
+
: dirname(fileURLToPath(import.meta.url))
|
|
15
|
+
|
|
9
16
|
/** Template vite config file path / Путь к файлу шаблона vite-конфига */
|
|
10
|
-
const FILE_VITE_SAMPLE = [
|
|
17
|
+
const FILE_VITE_SAMPLE = [dirnamePath, '..', 'media', 'templates', 'viteComponentTemplateConfig.ts']
|
|
11
18
|
|
|
12
19
|
/** Async exec wrapper / Обёртка для асинхронного exec */
|
|
13
20
|
const execAsync = promisify(exec)
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
// export:none
|
|
2
2
|
|
|
3
|
+
import { dirname } from 'node:path'
|
|
4
|
+
import { fileURLToPath } from 'node:url'
|
|
3
5
|
import { toKebabCase } from '@dxtmisha/functional-basic'
|
|
4
6
|
import { getComponentPaths } from '../../functions/getComponentPaths'
|
|
7
|
+
import { hasNativeDirname } from '../../functions/hasNativeDirname'
|
|
5
8
|
|
|
6
9
|
import { PropertiesFile } from '../Properties/PropertiesFile'
|
|
7
10
|
|
|
8
11
|
import { UI_FILE_PACKAGE } from '../../config'
|
|
9
12
|
|
|
10
|
-
const
|
|
13
|
+
const dirnamePath = hasNativeDirname()
|
|
14
|
+
? __dirname
|
|
15
|
+
: dirname(fileURLToPath(import.meta.url))
|
|
16
|
+
|
|
17
|
+
const DIR_SAMPLE = [dirnamePath, '..', '..', 'media', 'templates', 'componentDoc']
|
|
11
18
|
|
|
12
19
|
/**
|
|
13
20
|
* Class for creating component files from templates.
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
import { getNameDirByPaths } from '../../functions/getNameDirByPaths'
|
|
4
4
|
import { useAi } from '../../composables/useAi'
|
|
5
5
|
|
|
6
|
+
import { dirname } from 'node:path'
|
|
7
|
+
import { fileURLToPath } from 'node:url'
|
|
8
|
+
import { hasNativeDirname } from '../../functions/hasNativeDirname'
|
|
9
|
+
|
|
6
10
|
import { PropertiesConfig } from '../Properties/PropertiesConfig'
|
|
7
11
|
import { BuildItem } from '../BuildItem'
|
|
8
12
|
import { ComponentWikiFile } from './ComponentWikiFile'
|
|
@@ -15,8 +19,12 @@ import {
|
|
|
15
19
|
UI_DIRS_COMPONENTS
|
|
16
20
|
} from '../../config'
|
|
17
21
|
|
|
22
|
+
const dirnamePath = hasNativeDirname()
|
|
23
|
+
? __dirname
|
|
24
|
+
: dirname(fileURLToPath(import.meta.url))
|
|
25
|
+
|
|
18
26
|
/** Sample templates directory / Директория с шаблонами */
|
|
19
|
-
const DIR_SAMPLE = [
|
|
27
|
+
const DIR_SAMPLE = [dirnamePath, '..', '..', 'media', 'templates', 'prompts']
|
|
20
28
|
/** Sample AI prompt template path / Путь к шаблону AI-промпта */
|
|
21
29
|
const FILE_PROMPT_SAMPLE = [...DIR_SAMPLE, 'componentPrompt.en.txt']
|
|
22
30
|
/** Sample demo component MDX path / Путь к MDX демо-компоненту */
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// export:none
|
|
2
2
|
|
|
3
|
+
import { dirname } from 'node:path'
|
|
4
|
+
import { fileURLToPath } from 'node:url'
|
|
3
5
|
import { toArray } from '@dxtmisha/functional-basic'
|
|
6
|
+
import { hasNativeDirname } from '../../functions/hasNativeDirname'
|
|
4
7
|
|
|
5
8
|
import { PropertiesConfig } from '../Properties/PropertiesConfig'
|
|
6
9
|
import { PropertiesFile } from '../Properties/PropertiesFile'
|
|
@@ -9,7 +12,11 @@ import { DesignReplace } from './DesignReplace'
|
|
|
9
12
|
|
|
10
13
|
import { UI_KEY_CONSTRUCTOR } from '../../config'
|
|
11
14
|
|
|
12
|
-
const
|
|
15
|
+
const dirnamePath = hasNativeDirname()
|
|
16
|
+
? __dirname
|
|
17
|
+
: dirname(fileURLToPath(import.meta.url))
|
|
18
|
+
|
|
19
|
+
const DIR_SAMPLE = [dirnamePath, '..', '..', 'media', 'templates']
|
|
13
20
|
|
|
14
21
|
/**
|
|
15
22
|
* Base abstract class for generating script files.
|
|
@@ -60,7 +60,9 @@ export class GitRead {
|
|
|
60
60
|
return forEach(
|
|
61
61
|
this.getFilesPorcelain(),
|
|
62
62
|
(file) => {
|
|
63
|
-
const data = file
|
|
63
|
+
const data = file
|
|
64
|
+
.replace(/ {2,}/, ' ')
|
|
65
|
+
.split(' ', 2)
|
|
64
66
|
|
|
65
67
|
const status = data[0] as GitStatus
|
|
66
68
|
const path: string = data[1] ?? ''
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
// export:none
|
|
2
2
|
|
|
3
3
|
import requirePath from 'node:path'
|
|
4
|
+
import { fileURLToPath } from 'node:url'
|
|
5
|
+
import { hasNativeDirname } from '../../functions/hasNativeDirname'
|
|
6
|
+
|
|
4
7
|
import { PropertiesConfig } from '../Properties/PropertiesConfig'
|
|
5
8
|
import { PropertiesFile } from '../Properties/PropertiesFile'
|
|
6
9
|
|
|
7
10
|
import { UI_DIR_PACKAGES, UI_DIRS_LIBRARY, UI_FILE_PACKAGE } from '../../config'
|
|
8
11
|
|
|
9
|
-
const
|
|
12
|
+
const dirnamePath = hasNativeDirname()
|
|
13
|
+
? __dirname
|
|
14
|
+
: requirePath.dirname(fileURLToPath(import.meta.url))
|
|
15
|
+
|
|
16
|
+
const DIR_SAMPLE = [dirnamePath, '..', '..', 'media', 'templates', 'packages']
|
|
10
17
|
const DIR_STORYBOOK = [
|
|
11
18
|
UI_DIR_PACKAGES,
|
|
12
19
|
'storybook',
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
import requireFs from 'node:fs'
|
|
2
|
+
import requirePath from 'node:path'
|
|
3
|
+
import { fileURLToPath } from 'node:url'
|
|
1
4
|
import { Datetime, forEach, toArray, toKebabCase, transformation } from '@dxtmisha/functional-basic'
|
|
2
|
-
import {
|
|
5
|
+
import { hasNativeDirname } from '../../functions/hasNativeDirname'
|
|
3
6
|
|
|
4
|
-
import requireFs from 'fs'
|
|
5
|
-
import requirePath from 'path'
|
|
6
7
|
import { UI_FILE_INDEX, UI_MODULES, UI_PROJECT_NAME } from '../../config'
|
|
7
8
|
|
|
8
9
|
export type PropertiesFilePath = string | string[]
|
|
9
10
|
export type PropertiesFileValue<T = any> = string | Record<string, T>
|
|
10
11
|
|
|
12
|
+
const dirnamePath = hasNativeDirname() ? __dirname : requirePath.dirname(fileURLToPath(import.meta.url))
|
|
13
|
+
|
|
11
14
|
/**
|
|
12
15
|
* A class for working with files.
|
|
13
16
|
*
|
|
@@ -127,7 +130,7 @@ export class PropertiesFile {
|
|
|
127
130
|
}
|
|
128
131
|
|
|
129
132
|
static getDirname(): string {
|
|
130
|
-
return
|
|
133
|
+
return dirnamePath
|
|
131
134
|
}
|
|
132
135
|
|
|
133
136
|
/**
|
|
@@ -517,7 +520,7 @@ export class PropertiesFile {
|
|
|
517
520
|
}
|
|
518
521
|
|
|
519
522
|
static {
|
|
520
|
-
this.module = Boolean(
|
|
523
|
+
this.module = Boolean(dirnamePath.match('node_modules'))
|
|
521
524
|
this.root = process.cwd()
|
|
522
525
|
}
|
|
523
526
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
// export:none
|
|
2
2
|
|
|
3
|
+
import { dirname } from 'node:path'
|
|
4
|
+
import { fileURLToPath } from 'node:url'
|
|
3
5
|
import { forEach } from '@dxtmisha/functional-basic'
|
|
6
|
+
import { hasNativeDirname } from './hasNativeDirname'
|
|
7
|
+
|
|
4
8
|
import { PropertiesFile } from '../classes/Properties/PropertiesFile'
|
|
5
9
|
import type { PropertyItem, PropertyList } from '../types/propertyTypes'
|
|
6
10
|
|
|
@@ -16,7 +20,9 @@ export const getConstructorProperties = (names: string[]): PropertyList => {
|
|
|
16
20
|
const data: PropertyList = {}
|
|
17
21
|
|
|
18
22
|
try {
|
|
19
|
-
const dir =
|
|
23
|
+
const dir = hasNativeDirname()
|
|
24
|
+
? __dirname
|
|
25
|
+
: dirname(fileURLToPath(import.meta.url))
|
|
20
26
|
|
|
21
27
|
forEach(
|
|
22
28
|
names,
|