Skip to content

Instantly share code, notes, and snippets.

@goldzulu
Last active May 21, 2020 10:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goldzulu/3e41a864de6fd5e2b9a9fb3b7cf9bacc to your computer and use it in GitHub Desktop.
Save goldzulu/3e41a864de6fd5e2b9a9fb3b7cf9bacc to your computer and use it in GitHub Desktop.
Scripts to help update the latest ask-cli, change it to be called askx and then install the package (locally) for those of you using method 2 https://gist.github.com/germanviscuso/48f5c68f876b31b51ba59f91b49a253f
const fs = require('fs');
const fileName = './package.json';
let file = require(fileName);
console.log(file.name);
if (file.name == "ask-cli") {
file.name="ask-cli-x";
console.log("Changed name ask-cli to name ask-cli-x");
}
if (file.bin.ask) {
delete file.bin.ask;
file.bin = {
"askx": "bin/ask.js"
}
console.log("Changed bin from ask to askx");
}
fs.writeFile(fileName, JSON.stringify(file, null, 4), function writeJSON(err) {
if (err) return console.log(err);
console.log(JSON.stringify(file,null,4));
console.log('Updating ' + fileName + ' successful');
});
#!/bin/bash
#comment out below if you don't want to remove the package.json.. e.g. you might want to use git stash instead
git fetch --all
git reset --hard origin/master
node ./changeAskToAskX.js
npm install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment