@reactful/create 0.1.4 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +9 -5
- package/package.json +4 -2
package/index.js
CHANGED
@@ -33,14 +33,16 @@ const questions = [{
|
|
33
33
|
inquirer.prompt(questions).then(prompting)
|
34
34
|
|
35
35
|
async function prompting(answers) {
|
36
|
+
console.log('- preparing...')
|
37
|
+
|
36
38
|
if (!answers.project) throw 'Required project name!'
|
37
39
|
|
38
40
|
const destination = path.join(process.cwd(), answers.project)
|
39
41
|
const temporaryPath = path.join(destination, 'temp')
|
40
|
-
|
42
|
+
|
41
43
|
await createDirectory(destination)
|
42
44
|
|
43
|
-
console.log('-
|
45
|
+
console.log('- loading NPM...')
|
44
46
|
await download('@reactful/create', temporaryPath)
|
45
47
|
|
46
48
|
console.log('- copying template...')
|
@@ -48,6 +50,10 @@ async function prompting(answers) {
|
|
48
50
|
await copyTemplate(temporaryPath, `templates/${answers.template}`, destination)
|
49
51
|
await removeDirectory(temporaryPath)
|
50
52
|
|
53
|
+
console.log('- creating .env...')
|
54
|
+
const env = `PORT=333\nMINIFY=FALSE`
|
55
|
+
fs.writeFileSync(`${destination}/.env`, env)
|
56
|
+
|
51
57
|
console.log('- templating project...')
|
52
58
|
renamingJSON(destination, answers.project)
|
53
59
|
|
@@ -129,11 +135,9 @@ function removeDirectory(directory) {
|
|
129
135
|
}
|
130
136
|
|
131
137
|
function copyFolder(source, target) {
|
132
|
-
const flags = { withFileTypes: true }
|
133
|
-
|
134
138
|
if (!fs.existsSync(target)) fs.mkdirSync(target)
|
135
139
|
|
136
|
-
fs.readdirSync(source
|
140
|
+
fs.readdirSync(source).forEach(function (file) {
|
137
141
|
const currentPath = path.join(source, file)
|
138
142
|
const targetPath = path.join(target, file)
|
139
143
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@reactful/create",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.6",
|
4
4
|
"main": "index.js",
|
5
5
|
"type": "module",
|
6
6
|
"description": "reactful scafold tool",
|
@@ -16,7 +16,9 @@
|
|
16
16
|
],
|
17
17
|
"scripts": {
|
18
18
|
"start": "bun run index.js",
|
19
|
-
"
|
19
|
+
"patch": "npm version patch; npm publish --access public",
|
20
|
+
"minor": "npm version minor; npm publish --access public",
|
21
|
+
"major": "npm version major; npm publish --access public"
|
20
22
|
},
|
21
23
|
"license": "MIT",
|
22
24
|
"dependencies": {
|