require-from-package
generate requires from Grunt + package.json
Last updated 3 years ago by lunhg .
ISC · Repository · Original npm · Tarball · package.json
$ cnpm install require-from-package 
SYNC missed versions from official npm registry.

Require from package

This package enable a node.js project powered by grunt-contrib-concat to inject dependencies and devDependencies from a package.json in a unified source code.

Install

npm i --save-dev require-from-package

Run

This module will create the files dependencies.js and devDependencies.js, in the folder boot/, where boot/ is located according the current working directory.

grunt.registerTask('libs', 'An async library maker task', function(){
  let done = this.async();
  require_from_package({
    path: process.cwd(),
    destination: "boot"
    pkg: grunt.file.readJSON('package.json'),
    core: ['fs', 'path'],
    validate: function(name){
      let regexp = new RegExp("(grunt.*|check_node|require_from_package)");
      return !name.match(regexp);
    }
  }, done);
});

### Options

- `path`: a working directory string ;
- `destination`: the folder where you put the files;
- `pkg`: a Object corresponding to `package.json`, with the dependencies and devDependencies,
- `core`: an Array of strings to add node.js core modules
- `core`: a Function to validate modules. All `-` characters will be tranformed to `_`

Current Tags

  • 0.0.5                                ...           latest (3 years ago)

5 Versions

  • 0.0.5                                ...           3 years ago
  • 0.0.4                                ...           3 years ago
  • 0.0.3                                ...           3 years ago
  • 0.0.2                                ...           3 years ago
  • 0.0.1                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 0
Last Day 1
Last Week 1
Last Month 2
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |