pkgfiles.js 700 B

1234567891011121314151617181920212223242526272829303132
  1. 'use strict';
  2. const Command = require('../command');
  3. class PkgfilesCommand extends Command {
  4. constructor(rawArgv) {
  5. super(rawArgv);
  6. this.usage = 'Usage: egg-bin pkgfiles';
  7. this.options = {
  8. check: {
  9. description: 'assert whether it\'s same',
  10. },
  11. };
  12. }
  13. get description() {
  14. return 'Generate pkg.files automatically';
  15. }
  16. * run({ cwd, argv }) {
  17. const args = [
  18. '--entry', 'app',
  19. '--entry', 'config',
  20. '--entry', '*.js',
  21. ];
  22. if (argv.check) args.push('--check');
  23. const pkgfiles = require.resolve('ypkgfiles/bin/ypkgfiles.js');
  24. yield this.helper.forkNode(pkgfiles, args, { cwd });
  25. }
  26. }
  27. module.exports = PkgfilesCommand;