@reactful/create 0.0.88 → 0.0.89

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +10 -5
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -81,15 +81,19 @@ async function downloadGitHub(user, repository, subdir, destination) {
81
81
  if (item.type != 'file') continue
82
82
 
83
83
  try {
84
- const filename = path.join(destination, item.name)
84
+ const filePath = path.join(destination, item.name)
85
85
  const response = await fetch(item.download_url)
86
- const filetext = await response.text()
86
+ const fileText = await response.text()
87
+ const baseFile = path.dirname(filePath)
88
+ const notFound = fs.existsSync(baseFile) == false
87
89
 
88
- fs.writeFileSync(filename, filetext)
90
+ if (notFound) fs.mkdirSync(baseFile, { recursive: true })
91
+
92
+ fs.writeFileSync(filePath, fileText)
89
93
  }
90
94
  catch(ex) {
91
95
  console.log('MOMMENT: file...')
92
- logging(response, contents)
96
+ logging(response, contents, item.download_url)
93
97
  throw ex
94
98
  }
95
99
  }
@@ -102,9 +106,10 @@ async function downloadGitHub(user, repository, subdir, destination) {
102
106
  }
103
107
  }
104
108
 
105
- function logging(response, contents) {
109
+ function logging(response, contents, download) {
106
110
  console.log('url: ', response.url)
107
111
  console.log('code: ', response.status)
108
112
  console.log('array: ', Array.isArray(contents))
109
113
  console.log('textual: ', JSON.stringify(contents))
114
+ console.log('download: ', item.download_url)
110
115
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactful/create",
3
- "version": "0.0.88",
3
+ "version": "0.0.89",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "description": "reactful scafold tool",