build cmd module to neuron wrapped module
MIT License
build a module to neuron wrapping
npm install grunt-cortex-neuron-build --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-cortex-neuron-build');
In your project's Gruntfile, add a section named cortex_neuron_build
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
cortex_neuron_build: {
test: {
options: {
entries: {
"./input.js":"../expected/output-actual.js"
},
targetVersion: "latest",
cwd:"./test/fixtures"
}
}
}
});
Type: Object
Default value: {}
A object describe src and dest as key-value.
Type: String
Default value: pkg.version
A string value which will be use to describe the version of current module, default to package.version
.
Let's say we have such raw files:
package.json:
{
"name":"test-module",
"version":"0.1.0",
"cortex": {
"dependencies": {
"a": "0.0.1",
"b": "0.0.2"
}
}
}
input.js:
var a = require("a");
var b = require("b");
var c = require("./c");
var d = require("./d");
c.js:
var d = require("./d");
d.js:
module.exports = function(){
console.log("I'm d");
};
and give such config in Gruntfile.js
grunt.initConfig({
cortex_neuron_build: {
test: {
options: {
entries: {
"./input.js":"../expected/output-actual.js"
},
targetVersion: "latest",
cwd:"./test/fixtures"
}
}
}
});
then we will got output-actual.js as below:
define("test-module@latest/d", [], function(require, exports, module) {
module.exports = function(){
console.log("I'm d");
}
});
define("test-module@latest/c", ["./d"], function(require, exports, module) {
var d = require("./d");
});
define("test-module@latest", ["[email protected]", "[email protected]", "./c", "./d"], function(require, exports, module) {
var a = require("a");
var b = require("b");
var c = require("./c");
var d = require("./d");
});
2013-12-10 0.1.0 refactor code, add entries and targetVersion as option, add test cases