Browse Source

Fixing issue with init.

pull/1214/head
mike12345567 6 years ago
parent
commit
e0f4d05512
  1. 3
      packages/cli/src/hosting/index.js
  2. 6
      packages/cli/src/utils.js

3
packages/cli/src/hosting/index.js

@ -29,7 +29,8 @@ async function init() {
}
const promises = []
for (let url of FILE_URLS) {
promises.push(downloadFile(url, __dirname))
const fileName = url.split("/").slice(-1)[0]
promises.push(downloadFile(url, `./${fileName}`))
}
await Promise.all(promises)
console.log("Files have been downloaded, ready to start.")

6
packages/cli/src/utils.js

@ -1,9 +1,11 @@
const chalk = require("chalk")
const fs = require("fs")
const axios = require("axios")
const path = require("path")
exports.downloadFile = async (url, path) => {
const writer = fs.createWriteStream(path)
exports.downloadFile = async (url, filePath) => {
filePath = path.resolve(filePath)
const writer = fs.createWriteStream(filePath)
const response = await axios({
url,

Loading…
Cancel
Save