@reactful/create 0.0.102 → 0.0.104
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 +11 -2
- package/package.json +1 -1
package/index.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env node
|
2
2
|
|
3
3
|
import npmRegistryFetch from 'npm-registry-fetch'
|
4
|
-
import { execSync } from 'child_process'
|
4
|
+
import { spawn , execSync } from 'child_process'
|
5
5
|
import inquirer from 'inquirer'
|
6
6
|
import path from 'path'
|
7
7
|
import * as tar from 'tar'
|
@@ -55,15 +55,24 @@ async function prompting(answers) {
|
|
55
55
|
console.log('- installing dependencies...\n')
|
56
56
|
process.chdir(answers.project)
|
57
57
|
execSync(`bun install`)
|
58
|
+
|
59
|
+
try {
|
60
|
+
answers.vscode
|
61
|
+
? spawn("code", ['.'])
|
62
|
+
: spawn("cd", [answers.project])
|
63
|
+
}
|
64
|
+
catch (ex) {
|
65
|
+
console.error('prompting', ex)
|
66
|
+
}
|
58
67
|
}
|
59
68
|
|
60
69
|
function renamingJSON(directory, projectName) {
|
61
70
|
const url = `${directory}/package.json`
|
62
|
-
console.log('renameJSON', url)
|
63
71
|
const txt = fs.readFileSync(url, { encoding: 'utf-8' })
|
64
72
|
const obj = JSON.parse(txt)
|
65
73
|
|
66
74
|
obj.name = projectName
|
75
|
+
|
67
76
|
fs.writeFileSync(url, JSON.stringify(obj, null, 3))
|
68
77
|
}
|
69
78
|
|