@dxtmisha/configuration 0.3.11 → 0.3.18

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/configuration",
3
3
  "private": false,
4
- "version": "0.3.11",
4
+ "version": "0.3.18",
5
5
  "type": "module",
6
6
  "description": "Shared configuration files for DXT UI - Vite configs and TypeScript configs for building UI components",
7
7
  "keywords": [
@@ -59,8 +59,8 @@
59
59
  "node": ">=18.0.0"
60
60
  },
61
61
  "peerDependencies": {
62
- "vite": ">=4.0.0",
63
- "typescript": ">=4.5.0"
62
+ "vite": "*",
63
+ "typescript": "*"
64
64
  },
65
65
  "dependencies": {}
66
66
  }
@@ -10,30 +10,26 @@ import dts from 'vite-plugin-dts'
10
10
  *
11
11
  * Создаёт базовую конфигурацию Vite для библиотек с функциями/композаблами/классами.
12
12
  * @param name global library name / глобальное имя библиотеки
13
+ * @param target build target / цель сборки
13
14
  * @param entry entry points / входные точки сборки
14
15
  * @param include glob patterns for d.ts / паттерны для генерации d.ts
15
16
  * @param includeExtended extra patterns / дополнительные паттерны
16
17
  * @param external external dependencies / внешние зависимости
17
18
  * @param externalExtended extra dependencies / дополнительные зависимости
19
+ * @param fileCssName name of the output CSS file / имя выходного CSS файла
20
+ * @param rollupTypes whether to use rollupTypes in dts plugin / использовать ли rollupTypes в плагине dts
18
21
  * @returns Vite config / конфигурация Vite
19
22
  */
20
23
  export const viteBasicFunction = (
21
24
  name = 'dxt-ui',
25
+ target = 'es2018',
22
26
  entry = [
23
27
  'src/library.ts'
24
28
  ],
25
29
  include = [
26
- 'src/classes/**/*.ts',
27
- 'src/composables/**/*.ts',
28
- 'src/documentation/**/*.ts',
29
- 'src/documentation/**/*.tsx',
30
- 'src/functions/**/*.ts',
31
- 'src/media/**/*.ts',
32
- 'src/types/**/*.ts',
33
- 'src/flags.ts',
34
- 'src/library.ts',
35
- 'src/media.ts',
36
- 'src/storybook.tsx'
30
+ 'src/**/*.ts',
31
+ 'src/**/*.tsx',
32
+ 'src/**/*.vue'
37
33
  ],
38
34
  includeExtended = [],
39
35
  external = [
@@ -58,9 +54,12 @@ export const viteBasicFunction = (
58
54
  '@emotion/react',
59
55
  '@emotion/styled'
60
56
  ],
61
- externalExtended = []
57
+ externalExtended = [],
58
+ fileCssName = 'style.css',
59
+ rollupTypes = false
62
60
  ) => defineConfig({
63
61
  build: {
62
+ target,
64
63
  lib: {
65
64
  entry,
66
65
  name,
@@ -79,6 +78,21 @@ export const viteBasicFunction = (
79
78
  ]
80
79
 
81
80
  return externalsList.some(ext => id === ext || id.startsWith(ext + '/'))
81
+ },
82
+ output: {
83
+ assetFileNames: (assetInfo) => {
84
+ const fileName = assetInfo.names?.[0] || assetInfo.originalFileName
85
+
86
+ if (
87
+ fileCssName
88
+ && fileName
89
+ && fileName.endsWith('.css')
90
+ ) {
91
+ return fileCssName
92
+ }
93
+
94
+ return '[name]-[hash][extname]'
95
+ }
82
96
  }
83
97
  }
84
98
  },
@@ -86,13 +100,29 @@ export const viteBasicFunction = (
86
100
  vue(),
87
101
  dts({
88
102
  clearPureImport: false,
89
- copyDtsFiles: true,
103
+ copyDtsFiles: false,
104
+ exclude: [
105
+ '**/__tests__/**',
106
+ '**/*.test.ts',
107
+ '**/*.spec.ts',
108
+ '**/*.stories.ts',
109
+ '**/*.stories.tsx',
110
+ '**/*.json',
111
+ '**/node_modules/**',
112
+ '**/dist/**',
113
+ '**/dist-temporary/**',
114
+ '**/*.config.ts',
115
+ '**/*.config.js',
116
+ '**/vite-env.d.ts'
117
+ ],
90
118
  include: [
119
+ ...entry,
91
120
  ...include,
92
121
  ...includeExtended
93
122
  ],
94
123
  insertTypesEntry: true,
95
124
  outDir: 'dist',
125
+ rollupTypes,
96
126
  staticImport: true,
97
127
  tsconfigPath: './tsconfig.app.json'
98
128
  })
@@ -1,7 +1,8 @@
1
- import nodePath from 'node:path'
1
+ // import nodePath from 'node:path'
2
2
  import { defineConfig } from 'vite'
3
3
 
4
4
  import vue from '@vitejs/plugin-vue'
5
+ import dts from 'vite-plugin-dts'
5
6
 
6
7
  /**
7
8
  * Creates a base Vite config for libraries with only Vue components.
@@ -15,11 +16,11 @@ export const viteComponentOnly = (
15
16
  path,
16
17
  packages
17
18
  ) => {
18
- return defineConfig({
19
- plugins: [vue()],
19
+ const outDir = 'dist-temporary'
20
20
 
21
+ return defineConfig({
21
22
  build: {
22
- outDir: nodePath.join(nodePath.dirname(path), 'wiki', 'temporary', 'dist'),
23
+ outDir,
23
24
 
24
25
  lib: {
25
26
  entry: path,
@@ -46,6 +47,37 @@ export const viteComponentOnly = (
46
47
  alias: {
47
48
  '@': packages
48
49
  }
49
- }
50
+ },
51
+
52
+ plugins: [
53
+ vue()/* ,
54
+ dts({
55
+ clearPureImport: false,
56
+ copyDtsFiles: true,
57
+ insertTypesEntry: true,
58
+ outDir,
59
+ include: [
60
+ 'src/!**!/!*.ts',
61
+ 'src/!**!/!*.tsx',
62
+ 'src/!**!/!*.vue'
63
+ ],
64
+ exclude: [
65
+ '**!/__tests__/!**',
66
+ '**!/!*.test.ts',
67
+ '**!/!*.spec.ts',
68
+ '**!/!*.stories.ts',
69
+ '**!/!*.stories.tsx',
70
+ '**!/!*.json',
71
+ '**!/node_modules/!**',
72
+ '**!/dist/!**',
73
+ '**!/dist-temporary/!**',
74
+ '**!/!*.config.ts',
75
+ '**!/!*.config.js',
76
+ '**!/vite-env.d.ts'
77
+ ],
78
+ staticImport: true,
79
+ tsconfigPath: './tsconfig.app.json'
80
+ }) */
81
+ ]
50
82
  })
51
83
  }