@dxtmisha/scripts 0.5.14 → 0.5.15
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 +2 -1
- package/src/classes/Ai/AiDocItemClasses.ts +2 -1
- package/src/classes/Ai/AiDocItemComposables.ts +2 -1
- package/src/classes/BuildItem.ts +2 -1
- package/src/classes/Component/ComponentItem.ts +2 -1
- package/src/classes/Component/ComponentWiki.ts +2 -1
- package/src/classes/Design/DesignCommand.ts +2 -1
- package/src/classes/Library/LibraryExport.ts +3 -1
- package/src/classes/Package/PackageItem.ts +3 -2
- package/src/classes/Properties/PropertiesFile.ts +3 -2
- package/src/functions/getConstructorProperties.ts +2 -1
- package/src/functions/getDirname.ts +17 -0
- package/src/functions/hasNativeDirname.ts +8 -0
- package/src/library.ts +2 -0
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.15",
|
|
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,8 @@
|
|
|
1
1
|
import { AiDocItemAbstract } from './AiDocItemAbstract'
|
|
2
|
+
import { getDirname } from '../../functions/getDirname'
|
|
2
3
|
|
|
3
4
|
/** Sample prompt template path / Путь к шаблону промпта */
|
|
4
|
-
const FILE_PROMPT_SAMPLE = [
|
|
5
|
+
const FILE_PROMPT_SAMPLE = [getDirname(), '..', '..', 'media', 'templates', 'prompts']
|
|
5
6
|
|
|
6
7
|
/** Sample prompt template path for functions / Путь к шаблону промпта для функций */
|
|
7
8
|
const FILE_PROMPT_SAMPLE_ITEM = [...FILE_PROMPT_SAMPLE, 'aiDocFunctionPrompt.en.txt']
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { AiDocItemAbstract } from './AiDocItemAbstract'
|
|
2
|
+
import { getDirname } from '../../functions/getDirname'
|
|
2
3
|
|
|
3
4
|
/** Sample prompt template path / Путь к шаблону промпта */
|
|
4
|
-
const FILE_PROMPT_SAMPLE = [
|
|
5
|
+
const FILE_PROMPT_SAMPLE = [getDirname(), '..', '..', 'media', 'templates', 'prompts']
|
|
5
6
|
|
|
6
7
|
/** Sample prompt template for classes / Шаблон промпта для классов */
|
|
7
8
|
const FILE_PROMPT_SAMPLE_CLASS = [...FILE_PROMPT_SAMPLE, 'aiDocClassPrompt.en.txt']
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { AiDocItemAbstract } from './AiDocItemAbstract'
|
|
2
|
+
import { getDirname } from '../../functions/getDirname'
|
|
2
3
|
|
|
3
4
|
/** Sample prompt template path / Путь к шаблону промпта */
|
|
4
|
-
const FILE_PROMPT_SAMPLE = [
|
|
5
|
+
const FILE_PROMPT_SAMPLE = [getDirname(), '..', '..', 'media', 'templates', 'prompts']
|
|
5
6
|
|
|
6
7
|
const FILE_PROMPT_SAMPLE_COMPOSABLE = [...FILE_PROMPT_SAMPLE, 'aiDocComposablePrompt.en.txt']
|
|
7
8
|
|
package/src/classes/BuildItem.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { promisify } from 'node:util'
|
|
2
2
|
import { exec } from 'node:child_process'
|
|
3
|
+
import { getDirname } from '../functions/getDirname'
|
|
3
4
|
|
|
4
5
|
import { PropertiesFile } from './Properties/PropertiesFile'
|
|
5
6
|
import { ComponentWikiFile } from './Component/ComponentWikiFile'
|
|
@@ -7,7 +8,7 @@ import { ComponentWikiFile } from './Component/ComponentWikiFile'
|
|
|
7
8
|
import { UI_DIR_DIST_TEMPORARY, UI_FILE_NAME_VITE, UI_FILE_NAME_VITE_WORKERS } from '../config'
|
|
8
9
|
|
|
9
10
|
/** Template vite config file path / Путь к файлу шаблона vite-конфига */
|
|
10
|
-
const FILE_VITE_SAMPLE = [
|
|
11
|
+
const FILE_VITE_SAMPLE = [getDirname(), '..', 'media', 'templates', 'viteComponentTemplateConfig.ts']
|
|
11
12
|
|
|
12
13
|
/** Async exec wrapper / Обёртка для асинхронного exec */
|
|
13
14
|
const execAsync = promisify(exec)
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import { toKebabCase } from '@dxtmisha/functional-basic'
|
|
4
4
|
import { getComponentPaths } from '../../functions/getComponentPaths'
|
|
5
|
+
import { getDirname } from '../../functions/getDirname'
|
|
5
6
|
|
|
6
7
|
import { PropertiesFile } from '../Properties/PropertiesFile'
|
|
7
8
|
|
|
8
9
|
import { UI_FILE_PACKAGE } from '../../config'
|
|
9
10
|
|
|
10
|
-
const DIR_SAMPLE = [
|
|
11
|
+
const DIR_SAMPLE = [getDirname(), '..', '..', 'media', 'templates', 'componentDoc']
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Class for creating component files from templates.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// export:none
|
|
2
2
|
|
|
3
|
+
import { getDirname } from '../../functions/getDirname'
|
|
3
4
|
import { getNameDirByPaths } from '../../functions/getNameDirByPaths'
|
|
4
5
|
import { useAi } from '../../composables/useAi'
|
|
5
6
|
|
|
@@ -16,7 +17,7 @@ import {
|
|
|
16
17
|
} from '../../config'
|
|
17
18
|
|
|
18
19
|
/** Sample templates directory / Директория с шаблонами */
|
|
19
|
-
const DIR_SAMPLE = [
|
|
20
|
+
const DIR_SAMPLE = [getDirname(), '..', '..', 'media', 'templates', 'prompts']
|
|
20
21
|
/** Sample AI prompt template path / Путь к шаблону AI-промпта */
|
|
21
22
|
const FILE_PROMPT_SAMPLE = [...DIR_SAMPLE, 'componentPrompt.en.txt']
|
|
22
23
|
/** Sample demo component MDX path / Путь к MDX демо-компоненту */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// export:none
|
|
2
2
|
|
|
3
3
|
import { toArray } from '@dxtmisha/functional-basic'
|
|
4
|
+
import { getDirname } from '../../functions/getDirname'
|
|
4
5
|
|
|
5
6
|
import { PropertiesConfig } from '../Properties/PropertiesConfig'
|
|
6
7
|
import { PropertiesFile } from '../Properties/PropertiesFile'
|
|
@@ -9,7 +10,7 @@ import { DesignReplace } from './DesignReplace'
|
|
|
9
10
|
|
|
10
11
|
import { UI_KEY_CONSTRUCTOR } from '../../config'
|
|
11
12
|
|
|
12
|
-
const DIR_SAMPLE = [
|
|
13
|
+
const DIR_SAMPLE = [getDirname(), '..', '..', 'media', 'templates']
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Base abstract class for generating script files.
|
|
@@ -124,7 +124,9 @@ export class LibraryExport {
|
|
|
124
124
|
if (item.match(/\.ts$/)) {
|
|
125
125
|
html.push(`export * from './${name}/${item.replace(/\.ts$/, '')}'`)
|
|
126
126
|
} else if (item.match(/\.vue$/)) {
|
|
127
|
-
const componentName = item
|
|
127
|
+
const componentName = item
|
|
128
|
+
.replace(/\.vue$/, '')
|
|
129
|
+
.replace(/^(.*?)([^/]+)$/, '$2')
|
|
128
130
|
|
|
129
131
|
imports.push(`import _${componentName} from './${name}/${item}'`)
|
|
130
132
|
html.push(`export const ${componentName} = _${componentName}`)
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
// export:none
|
|
2
2
|
|
|
3
|
-
import requirePath from 'path'
|
|
3
|
+
import requirePath from 'node:path'
|
|
4
|
+
import { getDirname } from '../../functions/getDirname'
|
|
4
5
|
import { PropertiesConfig } from '../Properties/PropertiesConfig'
|
|
5
6
|
import { PropertiesFile } from '../Properties/PropertiesFile'
|
|
6
7
|
|
|
7
8
|
import { UI_DIR_PACKAGES, UI_DIRS_LIBRARY, UI_FILE_PACKAGE } from '../../config'
|
|
8
9
|
|
|
9
|
-
const DIR_SAMPLE = [
|
|
10
|
+
const DIR_SAMPLE = [getDirname(), '..', '..', 'media', 'templates', 'packages']
|
|
10
11
|
const DIR_STORYBOOK = [
|
|
11
12
|
UI_DIR_PACKAGES,
|
|
12
13
|
'storybook',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Datetime, forEach, toArray, toKebabCase, transformation } from '@dxtmisha/functional-basic'
|
|
2
|
+
import { getDirname } from '../../functions/getDirname'
|
|
2
3
|
|
|
3
4
|
import requireFs from 'fs'
|
|
4
5
|
import requirePath from 'path'
|
|
@@ -126,7 +127,7 @@ export class PropertiesFile {
|
|
|
126
127
|
}
|
|
127
128
|
|
|
128
129
|
static getDirname(): string {
|
|
129
|
-
return
|
|
130
|
+
return getDirname()
|
|
130
131
|
}
|
|
131
132
|
|
|
132
133
|
/**
|
|
@@ -517,7 +518,7 @@ export class PropertiesFile {
|
|
|
517
518
|
}
|
|
518
519
|
|
|
519
520
|
static {
|
|
520
|
-
this.module = Boolean(
|
|
521
|
+
this.module = Boolean(getDirname().match('node_modules'))
|
|
521
522
|
this.root = process.cwd()
|
|
522
523
|
}
|
|
523
524
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// export:none
|
|
2
2
|
|
|
3
3
|
import { forEach } from '@dxtmisha/functional-basic'
|
|
4
|
+
import { getDirname } from './getDirname'
|
|
4
5
|
|
|
5
6
|
import { PropertiesFile } from '../classes/Properties/PropertiesFile'
|
|
6
7
|
import type { PropertyItem, PropertyList } from '../types/propertyTypes'
|
|
@@ -17,7 +18,7 @@ export const getConstructorProperties = (names: string[]): PropertyList => {
|
|
|
17
18
|
const data: PropertyList = {}
|
|
18
19
|
|
|
19
20
|
try {
|
|
20
|
-
const dir =
|
|
21
|
+
const dir = getDirname()
|
|
21
22
|
|
|
22
23
|
forEach(
|
|
23
24
|
names,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { dirname } from 'node:path'
|
|
2
|
+
import { fileURLToPath } from 'node:url'
|
|
3
|
+
|
|
4
|
+
import { hasNativeDirname } from './hasNativeDirname'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Gets the current directory name.
|
|
8
|
+
*
|
|
9
|
+
* Получает имя текущей директории.
|
|
10
|
+
*/
|
|
11
|
+
export function getDirname(): string {
|
|
12
|
+
if (hasNativeDirname()) {
|
|
13
|
+
return __dirname
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return dirname(fileURLToPath(import.meta.url))
|
|
17
|
+
}
|
package/src/library.ts
CHANGED
|
@@ -21,7 +21,9 @@ export * from './composables/useAi'
|
|
|
21
21
|
|
|
22
22
|
// Functions
|
|
23
23
|
export * from './functions/getConfigAi'
|
|
24
|
+
export * from './functions/getDirname'
|
|
24
25
|
export * from './functions/getPackageJson'
|
|
26
|
+
export * from './functions/hasNativeDirname'
|
|
25
27
|
|
|
26
28
|
// Types
|
|
27
29
|
export * from './types/aiTypes'
|