Set NODE_ENV via js-extensions js-builder plugin

... defaulting to "production" mode so as to disable react dev tools, which seems to grind Firefox to a crawl
This commit is contained in:
tfennelly 2016-08-08 15:06:27 +01:00
parent 574aed8ce3
commit c32defba71
5 changed files with 24 additions and 5 deletions

View File

@ -36,7 +36,7 @@
},
"dependencies": {
"@jenkins-cd/design-language": "0.0.67",
"@jenkins-cd/js-extensions": "0.0.20",
"@jenkins-cd/js-extensions": "0.0.21-beta4",
"@jenkins-cd/js-modules": "0.0.5",
"@jenkins-cd/sse-gateway": "0.0.7",
"immutable": "3.8.1",

View File

@ -35,7 +35,7 @@
},
"dependencies": {
"@jenkins-cd/design-language": "0.0.67",
"@jenkins-cd/js-extensions": "0.0.20",
"@jenkins-cd/js-extensions": "0.0.21-beta4",
"@jenkins-cd/js-modules": "0.0.5",
"@jenkins-cd/sse-gateway": "0.0.7",
"immutable": "3.8.1",

View File

@ -26,7 +26,7 @@
},
"dependencies": {
"@jenkins-cd/design-language": "0.0.67",
"@jenkins-cd/js-extensions": "0.0.20",
"@jenkins-cd/js-extensions": "0.0.21-beta4",
"@jenkins-cd/js-modules": "0.0.5",
"history": "2.0.2",
"immutable": "3.8.1",

View File

@ -7,7 +7,7 @@
/**
* Install the js-builder plugin. This function will be called by js-builder.
*/
exports.install = function() {
exports.install = function(builder) {
var jsBundle = require('./subs/extensions-bundle');
var cssBundle = require('./subs/css-bundle');
@ -19,4 +19,22 @@ exports.install = function() {
// Save extensions JSON again.
jsBundle.setJSExtensionsJSON(extensionsJSON);
}
//
// Defaulting the NODE_ENV to "production" so as to optimize
// bundle generation. This ensures that e.g. the react dev tools are
// disabled by default.
//
// If you need a "development" bundle then build the bundle by hand,
// supplying a "NODE_ENV" arg e.g.
//
// $ gulp bundle --NODE_ENV development
//
// We can build this into the mvn build later if this proves to be
// a bit painful.
//
process.env.NODE_ENV = builder.args.argvValue('--NODE_ENV', 'production');
builder.onPreBundle(function (bundler) { // See https://github.com/jenkinsci/js-builder#onprebundle-listeners
bundler.transform(require('envify'));
});
};

View File

@ -1,6 +1,6 @@
{
"name": "@jenkins-cd/js-extensions",
"version": "0.0.20",
"version": "0.0.21-beta4",
"description": "Jenkins Extension Store",
"main": "index.js",
"files": [
@ -39,6 +39,7 @@
},
"dependencies": {
"js-yaml": "^3.6.0",
"envify": "3.4.1",
"@jenkins-cd/js-modules": "0.0.5"
}
}