create-valaxy 0.0.5 → 0.0.6
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/index.js +8 -13
- package/package.json +1 -1
- package/template/package.json +4 -2
package/index.js
CHANGED
|
@@ -39,7 +39,7 @@ async function init() {
|
|
|
39
39
|
const packageName = await getValidPackageName(targetDir)
|
|
40
40
|
const root = path.join(cwd, targetDir)
|
|
41
41
|
|
|
42
|
-
if (fs.existsSync(root)) { fs.mkdirSync(root, { recursive: true }) }
|
|
42
|
+
if (!fs.existsSync(root)) { fs.mkdirSync(root, { recursive: true }) }
|
|
43
43
|
else {
|
|
44
44
|
const existing = fs.readdirSync(root)
|
|
45
45
|
if (existing.length) {
|
|
@@ -114,6 +114,7 @@ async function init() {
|
|
|
114
114
|
if (!agent)
|
|
115
115
|
return
|
|
116
116
|
|
|
117
|
+
console.log('root', root)
|
|
117
118
|
await execa(agent, ['install'], { stdio: 'inherit', cwd: root })
|
|
118
119
|
await execa(agent, ['run', 'dev'], { stdio: 'inherit', cwd: root })
|
|
119
120
|
}
|
|
@@ -178,21 +179,15 @@ async function getValidPackageName(projectName) {
|
|
|
178
179
|
}
|
|
179
180
|
}
|
|
180
181
|
|
|
182
|
+
/**
|
|
183
|
+
* @param {string} dir
|
|
184
|
+
* @returns
|
|
185
|
+
*/
|
|
181
186
|
function emptyDir(dir) {
|
|
182
187
|
if (!fs.existsSync(dir))
|
|
183
188
|
return
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
const abs = path.resolve(dir, file)
|
|
187
|
-
// baseline is Node 12 so can't use rmSync :(
|
|
188
|
-
if (fs.lstatSync(abs).isDirectory()) {
|
|
189
|
-
emptyDir(abs)
|
|
190
|
-
fs.rmdirSync(abs)
|
|
191
|
-
}
|
|
192
|
-
else {
|
|
193
|
-
fs.unlinkSync(abs)
|
|
194
|
-
}
|
|
195
|
-
}
|
|
189
|
+
console.log(chalk.red(' Remove ') + chalk.gray(dir))
|
|
190
|
+
fs.rmSync(dir, { recursive: true, force: true })
|
|
196
191
|
}
|
|
197
192
|
|
|
198
193
|
init().catch((e) => {
|
package/package.json
CHANGED
package/template/package.json
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
+
"name": "valaxy-blog",
|
|
3
|
+
"version": "0.0.0",
|
|
2
4
|
"private": true,
|
|
3
5
|
"scripts": {
|
|
4
6
|
"build": "valaxy build",
|
|
@@ -6,7 +8,7 @@
|
|
|
6
8
|
"serve": "vite preview"
|
|
7
9
|
},
|
|
8
10
|
"dependencies": {
|
|
9
|
-
"valaxy": "0.0.
|
|
10
|
-
"valaxy-theme-yun": "0.0.
|
|
11
|
+
"valaxy": "0.0.6",
|
|
12
|
+
"valaxy-theme-yun": "0.0.6"
|
|
11
13
|
}
|
|
12
14
|
}
|