@reactful/create 0.0.89 → 0.0.91

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 -12
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -39,27 +39,32 @@ inquirer.prompt(questions).then(async function (answers) {
39
39
  await downloadRepo(`commons`, destination)
40
40
  await downloadRepo(`templates/${answers.template}`, destination)
41
41
 
42
+ console.log('- templating project...')
42
43
  renamingJSON(destination, answers.project)
44
+
43
45
 
44
- execSync(`cd ${answers.project}; bun install`)
46
+ console.log('- installing dependencies...')
47
+ console.log('')
48
+ execSync(`cd ${answers.project}`)
49
+ execSync(`bun install`)
45
50
  })
46
51
 
47
52
  function renamingJSON(directory, projectName) {
48
53
  const url = `${directory}/package.json`
54
+ console.log('renameJSON', url)
49
55
  const txt = fs.readFileSync(url, { encoding: 'utf-8' })
50
56
  const obj = JSON.parse(txt)
51
57
 
52
58
  obj.name = projectName
53
-
54
59
  fs.writeFileSync(url, JSON.stringify(obj, null, 3))
55
-
56
- console.log('')
57
60
  }
58
61
 
59
62
  const downloadRepo = async (subfolder, destination) =>
60
63
  downloadGitHub('jsenaribeiro', 'reactful', subfolder, destination)
61
64
 
62
65
  async function downloadGitHub(user, repository, subdir, destination) {
66
+ console.log(`- downloading ${subdir}...`)
67
+
63
68
  const prefix = `https://api.github.com/repos/${user}/${repository}`
64
69
  const address = `${prefix}/contents/installation/${subdir}`
65
70
  const response = await fetch(address)
@@ -88,7 +93,7 @@ async function downloadGitHub(user, repository, subdir, destination) {
88
93
  const notFound = fs.existsSync(baseFile) == false
89
94
 
90
95
  if (notFound) fs.mkdirSync(baseFile, { recursive: true })
91
-
96
+
92
97
  fs.writeFileSync(filePath, fileText)
93
98
  }
94
99
  catch(ex) {
@@ -96,13 +101,6 @@ async function downloadGitHub(user, repository, subdir, destination) {
96
101
  logging(response, contents, item.download_url)
97
102
  throw ex
98
103
  }
99
- }
100
-
101
- try {
102
- }
103
- catch(ex) {
104
- console.log('fetching: ', address)
105
- throw ex
106
104
  }
107
105
  }
108
106
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactful/create",
3
- "version": "0.0.89",
3
+ "version": "0.0.91",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "description": "reactful scafold tool",