@dxtmisha/scripts 0.5.20 → 0.5.22

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.20",
4
+ "version": "0.5.22",
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": [
@@ -25,6 +25,7 @@ const FILE_PROPERTIES = 'properties.json'
25
25
  const FILE_PROPS = 'props.ts'
26
26
  const FILE_STYLE = 'styleToken.scss'
27
27
  const FILE_CLASS = 'DesignComponent.vue'
28
+ const FILE_CLASS_AI = 'DesignComponentWikiAi.vue'
28
29
  const FILE_INDEX = 'index.ts'
29
30
  const FILE_WIKI = 'wiki.ts'
30
31
  const FILE_STORIES = 'DesignComponent.stories.ts'
@@ -72,6 +73,7 @@ export class DesignComponent extends DesignCommand {
72
73
  .makeProps()
73
74
  .makeStyle()
74
75
  .makeMain()
76
+ .makeMainAi()
75
77
  .makeIndex()
76
78
  .makeWiki()
77
79
  .makeStories()
@@ -145,6 +147,52 @@ export class DesignComponent extends DesignCommand {
145
147
  return this
146
148
  }
147
149
 
150
+ /**
151
+ * This code generates the DesignComponentWikiAi.vue.
152
+ *
153
+ * Генерация файла DesignComponentWikiAi.vue.
154
+ */
155
+ protected makeMainAi(): this {
156
+ const file = FILE_CLASS_AI
157
+ const sample = this.readDefinable(file)
158
+ const design = this.getStructure().getDesignFirst()
159
+ const componentName = this.getStructure().getComponentNameFirst()
160
+ const fullComponentName = this.getStructure().getFullComponentName()
161
+ const item = this.getWikiDescription()
162
+
163
+ if (
164
+ item?.ai
165
+ ) {
166
+ if (item.ai.render) {
167
+ const render = item.ai.render
168
+ .replace(`<${componentName}`, `<${fullComponentName}`)
169
+ .trim()
170
+
171
+ sample.replaceMark('component-render', [
172
+ '<template #render="{ args, classDemo }">',
173
+ render,
174
+ '</template>'
175
+ ])
176
+ }
177
+
178
+ if (item.ai.import) {
179
+ sample.replaceMark('component-import', [
180
+ '<template #render="{ args, classDemo }">',
181
+ ...item.ai.import,
182
+ '</template>'
183
+ ])
184
+ }
185
+ }
186
+
187
+ this.write(
188
+ sample.getNameFile(file),
189
+ sample.get()
190
+ .replace('design="Design"', `design="${design}"`)
191
+ )
192
+
193
+ return this
194
+ }
195
+
148
196
  /**
149
197
  * This code generates the index.ts.
150
198
  *
@@ -112,8 +112,16 @@ export class DesignReplace {
112
112
  data: string[],
113
113
  end = ''
114
114
  ): this {
115
- const regName = `\\[?\\/\\/[\\]: #\\(]+:${name} `
116
- const space = this.sample.match(new RegExp(`^( *)(${regName})`, 'm'))?.[1]
115
+ let regName = `\\[?\\/\\/[\\]: #\\(]+:${name} `
116
+ let space = this.sample.match(new RegExp(`^( *)(${regName})`, 'm'))?.[1]
117
+
118
+ if (
119
+ !space
120
+ && this.sample.match(name)
121
+ ) {
122
+ regName = `<!-- :${name} `
123
+ space = this.sample.match(new RegExp(`^( *)(${regName})`, 'm'))?.[1]
124
+ }
117
125
 
118
126
  if (typeof space === 'string') {
119
127
  const inString = `\r\n${space}`
@@ -60,7 +60,9 @@ export class GitRead {
60
60
  return forEach(
61
61
  this.getFilesPorcelain(),
62
62
  (file) => {
63
- const data = file.split(' ', 2)
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] ?? ''
@@ -235,13 +235,13 @@ export class PackageInitItem {
235
235
  let edit = false
236
236
 
237
237
  if (
238
- packageFile.match(/["']devDependencies["']/)
238
+ packageFile.match(/["']dependencies["']/)
239
239
  ) {
240
- console.log('Update package.json: devDependencies...')
240
+ console.log('Update package.json: dependencies...')
241
241
 
242
242
  edit = true
243
243
  packageFile = packageFile.replace(
244
- /(["']devDependencies["']:[^{]+{)/,
244
+ /(["']dependencies["']:[^{]+{)/,
245
245
  `$1
246
246
  "${this.getProjectName()}": "workspace:*",`
247
247
  )
@@ -0,0 +1,25 @@
1
+ <script setup lang="ts">
2
+ // :component.once import { DxtTestWiki } from '@dxtmisha/test'
3
+ // :component.once import { DesignComponent } from './index'
4
+ // :component.once import { ComponentWikiStorybook } from './wiki'
5
+
6
+ // :component-import [!] System label / Системная метка
7
+ // :component-import [!] System label / Системная метка
8
+
9
+ defineOptions({
10
+ name: 'DesignComponentWikiAi'
11
+ })
12
+ </script>
13
+
14
+ <!-- :component.once <template> -->
15
+ <!-- :component.once <DxtTestWiki -->
16
+ <!-- :component.once design="Design" -->
17
+ <!-- :component.once :wiki="ImageWikiStorybook" -->
18
+ <!-- :component.once :component="DesignComponent" -->
19
+ <!-- :component.once > -->
20
+ <!-- :component-render [!] System label / Системная метка -->
21
+ <!-- :component-render [!] System label / Системная метка -->
22
+ <!-- :component.once </DxtTestWiki> -->
23
+ <!-- :component.once </template> -->
24
+
25
+ <style lang="scss"></style>