blixai / blix

⚙️🔧 CLI tool and scripting library to create, automate, and enhance Javascript applications
https://docs.blixjs.com
MIT License
26 stars 2 forks source link

Refactor writeFile helpers to write file to check for project name or not in store. #285

Closed DBULL7 closed 6 years ago

DBULL7 commented 6 years ago
exports.writeFile = (filePath, file, message) => {
  // check if store.name if there is add it to the filePath argument. 
  fs.writeFile(filePath, file, err => {
    if (err) console.error(err);
    message ? log(message) : "";
  });
};

exports.writeFileSync = (filePath, file, message) => {
  try {
    fs.writeFileSync(filePath, file)
    message ? log(message) : "";
  } catch (err) {
    console.error("Couldn't create file", err)
  }
}

This could allow for the addBackend to be refactored to use the current new/backend.js file. And it could change the use of name in the project. We can ask for it if it's not a process.argv argument and then put it in the store.