How to use the father.SpmPackage function in father

To help you get started, we’ve selected a few father examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github spmjs / spm-sea / lib / build.js View on Github external
parsePkg: function* () {
    var args = this.args;

    // Parse pkg
    var pkg = new Package(args.cwd, {
      ignore: args.ignore,
      skip: args.skip,
      moduleDir: spmrc.get('install.path'),
      entry: args.entry
    });
    args.pkg = pkg;
    log.debug('package', 'analyse infomation');
    log.debug('package', 'dependencies: ' + Object.keys(pkg.dependencies));
    log.debug('package', 'files: ' + Object.keys(pkg.files));

    // Get files to build
    var files = args.entry.length ? args.entry : getFiles(pkg);
    log.info('output', 'files: ' + files);

    // Check duplicate
    var dups = getDuplicate(files, pkg);
github spmjs / spm / lib / build.js View on Github external
function build(args, cb) {
  // add package info
  try {
    var pkg = new Package(args.cwd, {
      skip: args.skip || [],
      ignore: args.ignore || [],
      moduleDir: spmrc.get('install.path')
    });
    if (!args.noPkgLog) {
      log.info('package', 'analyse infomation');
      log.info('package', 'dependencies: ' + Object.keys(pkg.dependencies));
      log.info('package', 'files: ' + Object.keys(pkg.files));
    }
    args.pkg = pkg;
  } catch(err) {
    return cb(err);
  }

  // get build files
  var files = getFiles(pkg);
github spmjs / serve-spm / lib / util.js View on Github external
util.getPackage = function(root) {
  var file = join(root, 'package.json');
  if (!fs.existsSync(file)) {
    return null;
  }
  var mtime = +new Date(fs.statSync(file).mtime);
  var data = pkgCache[root];
  if (!data || data.mtime !== mtime) {
    var pkg;
    try {
      var originPkg = JSON.parse(fs.readFileSync(file, 'utf-8'));
      var args = mixarg(originPkg && originPkg.spm && originPkg.spm.buildArgs || '');
      pkg = new Package(root, {
        moduleDir: getModuleDir(root),
        skip: Object.keys(getGlobal(args.global))
      });
    } catch(e) {
      console.error(chalk.red('Package Parse Error:'), e.message);
      return null;
    }

    data = pkgCache[root] = {
      mtime: mtime,
      pkg: pkg
    };
  }
  return data.pkg;
};
github spmjs / spm / lib / sdk / module.js View on Github external
exports.getSourceFiles = function(root) {
  var pkg = new Package(root || process.cwd(), {
    moduleDir: spmrc.get('install.path')
  });
  return Object.keys(pkg.files).map(function(file) {
    return file.replace(/\.js$/, '');
  });
};

father

A bundless/bundle build tool

MIT
Latest version published 21 days ago

Package Health Score

76 / 100
Full package analysis

Popular father functions