create-valaxy 0.0.5 → 0.0.8
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 +9 -13
- package/package.json +1 -1
- package/template/_gitignore +2 -0
- 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) {
|
|
@@ -61,6 +61,8 @@ async function init() {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
console.log(` ${chalk.dim('📁')} ${chalk.dim(root)}`)
|
|
65
|
+
console.log()
|
|
64
66
|
console.log(chalk.dim(' Scaffolding project in ') + targetDir + chalk.dim(' ...'))
|
|
65
67
|
|
|
66
68
|
const templateDir = path.join(__dirname, 'template')
|
|
@@ -178,21 +180,15 @@ async function getValidPackageName(projectName) {
|
|
|
178
180
|
}
|
|
179
181
|
}
|
|
180
182
|
|
|
183
|
+
/**
|
|
184
|
+
* @param {string} dir
|
|
185
|
+
* @returns
|
|
186
|
+
*/
|
|
181
187
|
function emptyDir(dir) {
|
|
182
188
|
if (!fs.existsSync(dir))
|
|
183
189
|
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
|
-
}
|
|
190
|
+
console.log(chalk.red(' Remove ') + chalk.gray(dir))
|
|
191
|
+
fs.rmSync(dir, { recursive: true, force: true })
|
|
196
192
|
}
|
|
197
193
|
|
|
198
194
|
init().catch((e) => {
|
package/package.json
CHANGED
package/template/_gitignore
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.8",
|
|
12
|
+
"valaxy-theme-yun": "0.0.8"
|
|
11
13
|
}
|
|
12
14
|
}
|