createPackageJson.js 514 B

1234567891011121314151617181920
  1. #!/usr/bin/env node
  2. const { filter } = require('../dist/object');
  3. const ignoredFields = [
  4. 'private',
  5. 'devDependencies',
  6. 'scripts',
  7. 'babel'
  8. ];
  9. const isNotIgnored = (key, value) => ignoredFields.indexOf(key) < 0;
  10. const sourceFileContent = require('../package.json');
  11. const targetFileContent = filter(sourceFileContent, isNotIgnored);
  12. const { writeFileSync } = require('fs');
  13. const targetFilename = 'dist/package.json';
  14. writeFileSync(targetFilename, JSON.stringify(targetFileContent, null, 3));