@dxtmisha/scripts 0.5.22 → 0.6.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.
@@ -1,8 +1,10 @@
1
1
  #!/usr/bin/env vite-node
2
2
 
3
3
  import { PackageInit } from '../src/classes/Package/PackageInit'
4
+ import { UI_DIR_PACKAGES } from '../src/config'
4
5
 
5
6
  const type: string = process.argv?.[2] ?? 'library'
6
7
  const templates: string | undefined = process.argv?.[3]
8
+ const dir: string | undefined = process.argv?.[4] ?? UI_DIR_PACKAGES
7
9
 
8
- new PackageInit(type, templates).make()
10
+ new PackageInit(type, templates, dir).make()
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dxtmisha/scripts",
3
3
  "private": false,
4
- "version": "0.5.22",
4
+ "version": "0.6.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": [
@@ -105,7 +105,9 @@ export class LibraryExport {
105
105
  */
106
106
  protected initFile(): string {
107
107
  const files: LibraryFiles = this.getDirectory()
108
- const imports: string[] = []
108
+ const imports: string[] = [
109
+ this.initStyles()
110
+ ]
109
111
  const html: string[] = []
110
112
 
111
113
  files.forEach((file) => {
@@ -141,4 +143,27 @@ export class LibraryExport {
141
143
  + '\r\n'
142
144
  + html.join('\r\n').trim()
143
145
  }
146
+
147
+ /**
148
+ * Generates imports for global styles
149
+ *
150
+ * Генерация импортов для глобальных стилей
151
+ */
152
+ protected initStyles(): string {
153
+ const imports: string[] = []
154
+ const paths: string[] = [
155
+ 'style.scss',
156
+ 'style.css'
157
+ ]
158
+
159
+ paths.forEach((path) => {
160
+ const fullPath = [UI_DIR_IN, path]
161
+
162
+ if (PropertiesFile.is(fullPath)) {
163
+ imports.push(`import './${path}'`)
164
+ }
165
+ })
166
+
167
+ return imports.join('\r\n') + '\r\n'
168
+ }
144
169
  }
@@ -13,7 +13,8 @@ import { UI_DIR_PACKAGES } from '../../config'
13
13
  export class PackageInit {
14
14
  constructor(
15
15
  protected readonly type: string,
16
- protected readonly templates?: string
16
+ protected readonly templates?: string,
17
+ protected readonly dir: string = UI_DIR_PACKAGES
17
18
  ) {
18
19
  }
19
20
 
@@ -27,7 +28,7 @@ export class PackageInit {
27
28
 
28
29
  this.getDirs()
29
30
  .forEach((dir) => {
30
- new PackageInitItem(dir, [UI_DIR_PACKAGES, dir], this.type, this.templates).make()
31
+ new PackageInitItem(dir, [this.dir, dir], this.type, this.templates).make()
31
32
  })
32
33
  }
33
34
 
@@ -37,9 +38,9 @@ export class PackageInit {
37
38
  * Возвращает массив имен директорий для инициализации пакета.
38
39
  */
39
40
  protected getDirs(): string[] {
40
- return PropertiesFile.readDir(UI_DIR_PACKAGES)
41
+ return PropertiesFile.readDir(this.dir)
41
42
  .filter(
42
- path => PropertiesFile.readDir([UI_DIR_PACKAGES, path]).length === 0
43
+ path => PropertiesFile.readDir([this.dir, path]).length === 0
43
44
  )
44
45
  }
45
46
  }
@@ -211,7 +211,8 @@ export class PackageInitItem {
211
211
  ) {
212
212
  console.log('Generate library...')
213
213
 
214
- PropertiesFile.writeByPath(path, `export * from '${this.getProjectName()}'
214
+ PropertiesFile.writeByPath(path, `export * from '${this.getProjectName()}/style'
215
+ export * from '${this.getProjectName()}'
215
216
  `
216
217
  )
217
218
  }
@@ -1,4 +1,6 @@
1
1
  import { createApp } from 'vue'
2
2
  import App from './App.vue'
3
3
 
4
+ import './styles.scss'
5
+
4
6
  createApp(App).mount('#app')
@@ -1,4 +1,14 @@
1
- import { viteBasic } from '@dxtmisha/configuration/viteBasic'
1
+ import { viteBasicFunction } from '@dxtmisha/configuration/viteBasicFunction'
2
2
 
3
3
  // https://vite.dev/config/
4
- export default viteBasic
4
+ export default viteBasicFunction(
5
+ undefined,
6
+ undefined,
7
+ undefined,
8
+ undefined,
9
+ undefined,
10
+ undefined,
11
+ undefined,
12
+ undefined,
13
+ true
14
+ )