Skip to content

Instantly share code, notes, and snippets.

@cortesben
Last active December 2, 2019 21:00
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 cortesben/55a32815a668e388b40c9caead6ca5c2 to your computer and use it in GitHub Desktop.
Save cortesben/55a32815a668e388b40c9caead6ca5c2 to your computer and use it in GitHub Desktop.
Prepare for npm publish
const path = require('path');
const fs = require('fs');
const file = path.join(__dirname, '../' + process.argv[2]);
const fileJSON = require(file);
delete fileJSON.dependencies;
delete fileJSON.eslintConfig;
delete fileJSON.devDependencies;
delete fileJSON.scripts;
delete fileJSON.postcss;
delete fileJSON.browserslist;
fileJSON.main = 'image-manager.js';
fs.writeFile(path.join(__dirname, `./../dist/package.json`), JSON.stringify(fileJSON, null, 4), err => {
if(err) {
return console.log(err);
}
console.log("package.json file was saved in dist!");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment