@reactful/create 0.0.103 → 0.0.105
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 +23 -14
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -18,17 +18,16 @@ console.log(`${decor}( ${GREEN}reactful${RESET}.js )${decor}`)
|
|
|
18
18
|
console.log(line)
|
|
19
19
|
|
|
20
20
|
const templates = ['empty', 'minimal', 'sampling']
|
|
21
|
-
|
|
22
21
|
const questions = [{
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
{ type: 'input', name: 'project', message: 'Project name?', prefix, default: 'Sample' },
|
|
30
|
-
{ type: 'confirm', name: 'vscode', message: 'VS Code IDE?', prefix },
|
|
31
|
-
{ type: 'confirm', name: 'install', message: 'Install?', prefix },
|
|
22
|
+
type: 'list',
|
|
23
|
+
name: 'template',
|
|
24
|
+
message: 'Which template?',
|
|
25
|
+
choices: templates,
|
|
26
|
+
prefix
|
|
27
|
+
},
|
|
28
|
+
{ type: 'input', name: 'project', message: 'Project name?', prefix, default: 'Sample' },
|
|
29
|
+
{ type: 'confirm', name: 'vscode', message: 'VS Code IDE?', prefix },
|
|
30
|
+
{ type: 'confirm', name: 'install', message: 'Install?', prefix },
|
|
32
31
|
]
|
|
33
32
|
|
|
34
33
|
inquirer.prompt(questions).then(prompting)
|
|
@@ -53,18 +52,26 @@ async function prompting(answers) {
|
|
|
53
52
|
renamingJSON(destination, answers.project)
|
|
54
53
|
|
|
55
54
|
console.log('- installing dependencies...\n')
|
|
56
|
-
process.chdir(answers.project)
|
|
55
|
+
process.chdir(answers.project)
|
|
57
56
|
execSync(`bun install`)
|
|
58
|
-
|
|
57
|
+
|
|
58
|
+
try {
|
|
59
|
+
answers.vscode
|
|
60
|
+
? spawn("code", ['.'])
|
|
61
|
+
: spawn("cd", [answers.project])
|
|
62
|
+
}
|
|
63
|
+
catch (ex) {
|
|
64
|
+
console.error('prompting', ex)
|
|
65
|
+
}
|
|
59
66
|
}
|
|
60
67
|
|
|
61
68
|
function renamingJSON(directory, projectName) {
|
|
62
69
|
const url = `${directory}/package.json`
|
|
63
|
-
console.log('renameJSON', url)
|
|
64
70
|
const txt = fs.readFileSync(url, { encoding: 'utf-8' })
|
|
65
71
|
const obj = JSON.parse(txt)
|
|
66
72
|
|
|
67
73
|
obj.name = projectName
|
|
74
|
+
|
|
68
75
|
fs.writeFileSync(url, JSON.stringify(obj, null, 3))
|
|
69
76
|
}
|
|
70
77
|
|
|
@@ -122,9 +129,11 @@ function removeDirectory(directory) {
|
|
|
122
129
|
}
|
|
123
130
|
|
|
124
131
|
function copyFolder(source, target) {
|
|
132
|
+
const flags = { withFileTypes: true }
|
|
133
|
+
|
|
125
134
|
if (!fs.existsSync(target)) fs.mkdirSync(target)
|
|
126
135
|
|
|
127
|
-
fs.readdirSync(source).forEach(function (file) {
|
|
136
|
+
fs.readdirSync(source, flags).forEach(function (file) {
|
|
128
137
|
const currentPath = path.join(source, file)
|
|
129
138
|
const targetPath = path.join(target, file)
|
|
130
139
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactful/create",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.105",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "reactful scafold tool",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
],
|
|
15
15
|
"scripts": {
|
|
16
16
|
"start": "bun run index.js",
|
|
17
|
-
"deploy": "npm publish --access public"
|
|
17
|
+
"deploy": "bunx npm-version minor; npm publish --access public"
|
|
18
18
|
},
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"dependencies": {
|