create-lve 0.4.7 → 0.4.9
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/config.js +29 -5
- package/package.json +1 -1
- package/template-vue/vite.config.ts +1 -1
package/config.js
CHANGED
|
@@ -70,14 +70,19 @@ const FRAMEWORK_CONFIG = {
|
|
|
70
70
|
const CSS_STRATEGIES = {
|
|
71
71
|
unocss: {
|
|
72
72
|
pluginImport: "import UnoCSS from 'unocss/vite'\n",
|
|
73
|
-
pluginCode: 'UnoCSS(
|
|
73
|
+
pluginCode: 'UnoCSS(), ',
|
|
74
74
|
entryImport: "import '@unocss/reset/tailwind.css'\nimport 'virtual:uno.css'\n",
|
|
75
75
|
async setup(ctx) {
|
|
76
76
|
const unoConfig = `
|
|
77
|
-
import {
|
|
77
|
+
import {
|
|
78
|
+
defineConfig,
|
|
79
|
+
presetWind3,
|
|
80
|
+
transformerCompileClass,
|
|
81
|
+
type SourceCodeTransformer,
|
|
82
|
+
} from 'unocss'
|
|
83
|
+
import { createHash } from 'node:crypto'
|
|
78
84
|
|
|
79
85
|
declare const process: { env: { NODE_ENV: string } }
|
|
80
|
-
|
|
81
86
|
const isBuild = process.env.NODE_ENV === 'production'
|
|
82
87
|
|
|
83
88
|
export default defineConfig({
|
|
@@ -105,8 +110,12 @@ export default defineConfig({
|
|
|
105
110
|
},
|
|
106
111
|
transformerCompileClass({
|
|
107
112
|
classPrefix: '',
|
|
108
|
-
hashFn: (str) =>
|
|
109
|
-
|
|
113
|
+
hashFn: (str) => {
|
|
114
|
+
// return createHash('md5').update(str).digest('hex').slice(0, 8)
|
|
115
|
+
const hash = createHash('md5').update(str).digest('hex').slice(0, 8)
|
|
116
|
+
return /^\\d/.test(hash) ? 'v' + hash.slice(1, 8) : hash.slice(0, 8)
|
|
117
|
+
},
|
|
118
|
+
keepUnknown: true,
|
|
110
119
|
}),
|
|
111
120
|
]
|
|
112
121
|
: []) as SourceCodeTransformer[],
|
|
@@ -114,6 +123,21 @@ export default defineConfig({
|
|
|
114
123
|
|
|
115
124
|
`.trim()
|
|
116
125
|
await fs.writeFile(path.join(ctx.targetDir, 'uno.config.ts'), unoConfig + '\n')
|
|
126
|
+
|
|
127
|
+
const tsconfigPath = path.join(ctx.targetDir, 'tsconfig.node.json')
|
|
128
|
+
if (fs.existsSync(tsconfigPath)) {
|
|
129
|
+
try {
|
|
130
|
+
const tsconfig = await fs.readJson(tsconfigPath)
|
|
131
|
+
if (!tsconfig.include) {
|
|
132
|
+
tsconfig.include = []
|
|
133
|
+
}
|
|
134
|
+
if (Array.isArray(tsconfig.include) && !tsconfig.include.includes('uno.config.ts')) {
|
|
135
|
+
tsconfig.include.push('uno.config.ts')
|
|
136
|
+
await fs.writeJson(tsconfigPath, tsconfig, { spaces: 2 })
|
|
137
|
+
}
|
|
138
|
+
} catch {}
|
|
139
|
+
}
|
|
140
|
+
|
|
117
141
|
const stylePath = path.join(ctx.targetDir, 'src/style.css')
|
|
118
142
|
if (fs.existsSync(stylePath)) await fs.remove(stylePath)
|
|
119
143
|
},
|
package/package.json
CHANGED