@dxtmisha/scripts 0.5.17 → 0.5.19

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dxtmisha/scripts",
3
3
  "private": false,
4
- "version": "0.5.17",
4
+ "version": "0.5.19",
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,8 +1,7 @@
1
1
  import { AiDocItemAbstract } from './AiDocItemAbstract'
2
- import { getDirname } from '../../functions/getDirname'
3
2
 
4
3
  /** Sample prompt template path / Путь к шаблону промпта */
5
- const FILE_PROMPT_SAMPLE = [getDirname(), '..', '..', 'media', 'templates', 'prompts']
4
+ const FILE_PROMPT_SAMPLE = [__dirname, '..', '..', 'media', 'templates', 'prompts']
6
5
 
7
6
  /** Sample prompt template path for functions / Путь к шаблону промпта для функций */
8
7
  const FILE_PROMPT_SAMPLE_ITEM = [...FILE_PROMPT_SAMPLE, 'aiDocFunctionPrompt.en.txt']
@@ -1,8 +1,7 @@
1
1
  import { AiDocItemAbstract } from './AiDocItemAbstract'
2
- import { getDirname } from '../../functions/getDirname'
3
2
 
4
3
  /** Sample prompt template path / Путь к шаблону промпта */
5
- const FILE_PROMPT_SAMPLE = [getDirname(), '..', '..', 'media', 'templates', 'prompts']
4
+ const FILE_PROMPT_SAMPLE = [__dirname, '..', '..', 'media', 'templates', 'prompts']
6
5
 
7
6
  /** Sample prompt template for classes / Шаблон промпта для классов */
8
7
  const FILE_PROMPT_SAMPLE_CLASS = [...FILE_PROMPT_SAMPLE, 'aiDocClassPrompt.en.txt']
@@ -1,8 +1,7 @@
1
1
  import { AiDocItemAbstract } from './AiDocItemAbstract'
2
- import { getDirname } from '../../functions/getDirname'
3
2
 
4
3
  /** Sample prompt template path / Путь к шаблону промпта */
5
- const FILE_PROMPT_SAMPLE = [getDirname(), '..', '..', 'media', 'templates', 'prompts']
4
+ const FILE_PROMPT_SAMPLE = [__dirname, '..', '..', 'media', 'templates', 'prompts']
6
5
 
7
6
  const FILE_PROMPT_SAMPLE_COMPOSABLE = [...FILE_PROMPT_SAMPLE, 'aiDocComposablePrompt.en.txt']
8
7
 
@@ -1,6 +1,5 @@
1
1
  import { promisify } from 'node:util'
2
2
  import { exec } from 'node:child_process'
3
- import { getDirname } from '../functions/getDirname'
4
3
 
5
4
  import { PropertiesFile } from './Properties/PropertiesFile'
6
5
  import { ComponentWikiFile } from './Component/ComponentWikiFile'
@@ -8,7 +7,7 @@ import { ComponentWikiFile } from './Component/ComponentWikiFile'
8
7
  import { UI_DIR_DIST_TEMPORARY, UI_FILE_NAME_VITE, UI_FILE_NAME_VITE_WORKERS } from '../config'
9
8
 
10
9
  /** Template vite config file path / Путь к файлу шаблона vite-конфига */
11
- const FILE_VITE_SAMPLE = [getDirname(), '..', 'media', 'templates', 'viteComponentTemplateConfig.ts']
10
+ const FILE_VITE_SAMPLE = [__dirname, '..', 'media', 'templates', 'viteComponentTemplateConfig.ts']
12
11
 
13
12
  /** Async exec wrapper / Обёртка для асинхронного exec */
14
13
  const execAsync = promisify(exec)
@@ -2,13 +2,12 @@
2
2
 
3
3
  import { toKebabCase } from '@dxtmisha/functional-basic'
4
4
  import { getComponentPaths } from '../../functions/getComponentPaths'
5
- import { getDirname } from '../../functions/getDirname'
6
5
 
7
6
  import { PropertiesFile } from '../Properties/PropertiesFile'
8
7
 
9
8
  import { UI_FILE_PACKAGE } from '../../config'
10
9
 
11
- const DIR_SAMPLE = [getDirname(), '..', '..', 'media', 'templates', 'componentDoc']
10
+ const DIR_SAMPLE = [__dirname, '..', '..', 'media', 'templates', 'componentDoc']
12
11
 
13
12
  /**
14
13
  * Class for creating component files from templates.
@@ -1,6 +1,5 @@
1
1
  // export:none
2
2
 
3
- import { getDirname } from '../../functions/getDirname'
4
3
  import { getNameDirByPaths } from '../../functions/getNameDirByPaths'
5
4
  import { useAi } from '../../composables/useAi'
6
5
 
@@ -17,7 +16,7 @@ import {
17
16
  } from '../../config'
18
17
 
19
18
  /** Sample templates directory / Директория с шаблонами */
20
- const DIR_SAMPLE = [getDirname(), '..', '..', 'media', 'templates', 'prompts']
19
+ const DIR_SAMPLE = [__dirname, '..', '..', 'media', 'templates', 'prompts']
21
20
  /** Sample AI prompt template path / Путь к шаблону AI-промпта */
22
21
  const FILE_PROMPT_SAMPLE = [...DIR_SAMPLE, 'componentPrompt.en.txt']
23
22
  /** Sample demo component MDX path / Путь к MDX демо-компоненту */
@@ -1,7 +1,6 @@
1
1
  // export:none
2
2
 
3
3
  import { toArray } from '@dxtmisha/functional-basic'
4
- import { getDirname } from '../../functions/getDirname'
5
4
 
6
5
  import { PropertiesConfig } from '../Properties/PropertiesConfig'
7
6
  import { PropertiesFile } from '../Properties/PropertiesFile'
@@ -10,7 +9,7 @@ import { DesignReplace } from './DesignReplace'
10
9
 
11
10
  import { UI_KEY_CONSTRUCTOR } from '../../config'
12
11
 
13
- const DIR_SAMPLE = [getDirname(), '..', '..', 'media', 'templates']
12
+ const DIR_SAMPLE = [__dirname, '..', '..', 'media', 'templates']
14
13
 
15
14
  /**
16
15
  * Base abstract class for generating script files.
@@ -37,7 +37,7 @@ export class PackageInit {
37
37
  * Возвращает массив имен директорий для инициализации пакета.
38
38
  */
39
39
  protected getDirs(): string[] {
40
- return PropertiesFile.readDirOnlyRecursive(UI_DIR_PACKAGES)
40
+ return PropertiesFile.readDir(UI_DIR_PACKAGES)
41
41
  .filter(
42
42
  path => PropertiesFile.readDir([UI_DIR_PACKAGES, path]).length === 0
43
43
  )
@@ -1,13 +1,12 @@
1
1
  // export:none
2
2
 
3
3
  import requirePath from 'node:path'
4
- import { getDirname } from '../../functions/getDirname'
5
4
  import { PropertiesConfig } from '../Properties/PropertiesConfig'
6
5
  import { PropertiesFile } from '../Properties/PropertiesFile'
7
6
 
8
7
  import { UI_DIR_PACKAGES, UI_DIRS_LIBRARY, UI_FILE_PACKAGE } from '../../config'
9
8
 
10
- const DIR_SAMPLE = [getDirname(), '..', '..', 'media', 'templates', 'packages']
9
+ const DIR_SAMPLE = [__dirname, '..', '..', 'media', 'templates', 'packages']
11
10
  const DIR_STORYBOOK = [
12
11
  UI_DIR_PACKAGES,
13
12
  'storybook',
@@ -119,6 +118,7 @@ export class PackageInitItem {
119
118
  */
120
119
  protected getFileByList(dir: string[]): PackageInitItemFile[] {
121
120
  const list = PropertiesFile.readDirRecursive(dir)
121
+
122
122
  const data: PackageInitItemFile[] = []
123
123
 
124
124
  list.forEach((item) => {
@@ -127,7 +127,7 @@ export class PropertiesFile {
127
127
  }
128
128
 
129
129
  static getDirname(): string {
130
- return getDirname()
130
+ return __dirname
131
131
  }
132
132
 
133
133
  /**
@@ -238,15 +238,14 @@ export class PropertiesFile {
238
238
  * Преобразует путь для использования текущего разделителя ОС.
239
239
  * @param path path to the directory/ путь к директории
240
240
  */
241
- static toSep(path: PropertiesFilePath): PropertiesFilePath {
241
+ static toSep(path: string): PropertiesFilePath {
242
242
  const sep = this.sep()
243
243
 
244
244
  if (sep === '/') {
245
245
  return path
246
246
  }
247
247
 
248
- return this.joinPath(path)
249
- .replace('/', this.sep())
248
+ return path.replace('/', this.sep())
250
249
  }
251
250
 
252
251
  /**
@@ -318,7 +317,7 @@ export class PropertiesFile {
318
317
  const data: string[] = []
319
318
 
320
319
  dirs.forEach((dir) => {
321
- const paths = [...path, dir]
320
+ const paths = [...toArray(path), dir]
322
321
  const fullPaths = [...fullPath, dir]
323
322
 
324
323
  data.push(this.joinPath(fullPaths))
@@ -1,8 +1,6 @@
1
1
  // export:none
2
2
 
3
3
  import { forEach } from '@dxtmisha/functional-basic'
4
- import { getDirname } from './getDirname'
5
-
6
4
  import { PropertiesFile } from '../classes/Properties/PropertiesFile'
7
5
  import type { PropertyItem, PropertyList } from '../types/propertyTypes'
8
6
 
@@ -18,7 +16,7 @@ export const getConstructorProperties = (names: string[]): PropertyList => {
18
16
  const data: PropertyList = {}
19
17
 
20
18
  try {
21
- const dir = getDirname()
19
+ const dir = __dirname
22
20
 
23
21
  forEach(
24
22
  names,