@reactful/create 0.0.69 → 0.0.70

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/index.js +10 -11
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { exec } from 'child_process'
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
- exec(`md ${answers.project}`)
36
- exec(`cd ${answers.project}`)
37
-
35
+ fs.mkdirSync(answers.project)
36
+
38
37
  const destination = path.join(process.cwd(), answers.project)
39
-
38
+
40
39
  await downloadRepo(`commons`, destination)
41
40
  await downloadRepo(`templates/${answers.template}`, destination)
42
-
41
+
43
42
  renamingJSON(destination, answers.project)
44
-
45
- exec(`bun install`)
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 content = await fetch(url).then(x => x.json())
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 content) {
70
+ for (const item of contents) {
72
71
  if (item.type != 'file') continue
73
72
 
74
73
  const filename = path.join(destination, item.name)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactful/create",
3
- "version": "0.0.69",
3
+ "version": "0.0.70",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "description": "reactful scafold tool",