@reactful/create 0.0.68 → 0.0.70
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +11 -12
- package/package.json +1 -1
package/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env node
|
2
2
|
|
3
|
-
import {
|
3
|
+
import { execSync } from 'child_process'
|
4
4
|
import inquirer from 'inquirer'
|
5
5
|
import fetch from 'node-fetch'
|
6
6
|
import path from 'path'
|
@@ -32,17 +32,17 @@ const questions = [
|
|
32
32
|
]
|
33
33
|
|
34
34
|
inquirer.prompt(questions).then(async function (answers) {
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
fs.mkdirSync(answers.project)
|
36
|
+
|
38
37
|
const destination = path.join(process.cwd(), answers.project)
|
39
|
-
|
40
|
-
await downloadRepo(`
|
38
|
+
|
39
|
+
await downloadRepo(`commons`, destination)
|
41
40
|
await downloadRepo(`templates/${answers.template}`, destination)
|
42
|
-
|
41
|
+
|
43
42
|
renamingJSON(destination, answers.project)
|
44
|
-
|
45
|
-
|
43
|
+
|
44
|
+
execSync(`cd ${answers.project}`)
|
45
|
+
execSync(`bun install`)
|
46
46
|
})
|
47
47
|
|
48
48
|
function renamingJSON(directory, projectName) {
|
@@ -63,12 +63,11 @@ const downloadRepo = async (subfolder, destination) =>
|
|
63
63
|
async function downloadGitHub(user, repository, subfolder, destination) {
|
64
64
|
const prefix = `https://api.github.com/repos/${user}/${repository}`
|
65
65
|
const url = `${prefix}/contents/installation/${subfolder}`
|
66
|
-
const
|
66
|
+
const contents = await fetch(url).then(x => x.json())
|
67
67
|
|
68
68
|
console.log('- url', url)
|
69
|
-
console.log('- res', JSON.stringify(content))
|
70
69
|
|
71
|
-
for (const item of
|
70
|
+
for (const item of contents) {
|
72
71
|
if (item.type != 'file') continue
|
73
72
|
|
74
73
|
const filename = path.join(destination, item.name)
|