@reactful/create 0.0.70 → 0.0.72
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +12 -5
- package/package.json +1 -1
package/index.js
CHANGED
@@ -41,8 +41,7 @@ inquirer.prompt(questions).then(async function (answers) {
|
|
41
41
|
|
42
42
|
renamingJSON(destination, answers.project)
|
43
43
|
|
44
|
-
execSync(`cd ${answers.project}`)
|
45
|
-
execSync(`bun install`)
|
44
|
+
execSync(`cd ${answers.project}; bun install`)
|
46
45
|
})
|
47
46
|
|
48
47
|
function renamingJSON(directory, projectName) {
|
@@ -60,14 +59,22 @@ function renamingJSON(directory, projectName) {
|
|
60
59
|
const downloadRepo = async (subfolder, destination) =>
|
61
60
|
downloadGitHub('jsenaribeiro', 'reactful', subfolder, destination)
|
62
61
|
|
63
|
-
async function downloadGitHub(user, repository,
|
62
|
+
async function downloadGitHub(user, repository, subdir, destination) {
|
64
63
|
const prefix = `https://api.github.com/repos/${user}/${repository}`
|
65
|
-
const url = `${prefix}/contents/installation/${
|
64
|
+
const url = `${prefix}/contents/installation/${subdir}`
|
66
65
|
const contents = await fetch(url).then(x => x.json())
|
67
66
|
|
68
|
-
|
67
|
+
if (Array.isArray(contents)) {
|
68
|
+
console.error('failed to download scafold from github...')
|
69
|
+
console.log('contents: ', JSON.stringify(contents))
|
70
|
+
console.log('url: ', url)
|
71
|
+
}
|
69
72
|
|
70
73
|
for (const item of contents) {
|
74
|
+
const from = `${subdir}/${item.name}`
|
75
|
+
const goto = `${destination}/${item.name}`
|
76
|
+
|
77
|
+
if (item.type === 'dir') await downloadGitHub(from, goto)
|
71
78
|
if (item.type != 'file') continue
|
72
79
|
|
73
80
|
const filename = path.join(destination, item.name)
|