Auto-merge for PR #524 via VersionBot

Use uglifyjs-webpack-plugin ^1.0.1 to optimize the supervisor code
This commit is contained in:
resin-io-versionbot[bot] 2017-11-09 04:45:05 +00:00 committed by GitHub
commit f9f0f220f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 50 additions and 39 deletions

View File

@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
This project adheres to [Semantic Versioning](http://semver.org/).
## v6.4.5 - 2017-11-09
* Use uglifyjs-webpack-plugin ^1.0.1 to optimize the supervisor code #524 [Pablo Carranza Velez]
## v6.4.4 - 2017-11-08
* Dindctl: Use balena to refresh the supervisor container #523 [Pablo Carranza Velez]

View File

@ -118,7 +118,7 @@ function buildSupervisorSrc {
( cd "$SUPERVISOR_BASE_DIR" && npm install && npm run build )
else
echo "Rebuilding supervisor source without optimizations"
( cd "$SUPERVISOR_BASE_DIR" && npm install && npm run build-no-optimize )
( cd "$SUPERVISOR_BASE_DIR" && npm install && npm run build -- --env.noOptimize )
fi
}

View File

@ -1,7 +1,7 @@
{
"name": "resin-supervisor",
"description": "This is resin.io's Supervisor, a program that runs on IoT devices and has the task of running user Apps (which are Docker containers), and updating them as Resin's API informs it to.",
"version": "6.4.4",
"version": "6.4.5",
"license": "Apache-2.0",
"repository": {
"type": "git",
@ -9,8 +9,7 @@
},
"scripts": {
"start": "./entry.sh",
"build": "webpack --optimize-minimize",
"build-no-optimize": "webpack",
"build": "webpack",
"lint": "resin-lint src/",
"versionist": "versionist"
},
@ -56,6 +55,7 @@
"semver": "^5.3.0",
"semver-regex": "^1.0.0",
"typed-error": "~0.1.0",
"uglifyjs-webpack-plugin": "^1.0.1",
"versionist": "^2.8.0",
"webpack": "^3.0.0"
}

View File

@ -2,7 +2,8 @@ var webpack = require('webpack');
var path = require('path');
var fs = require('fs');
var _ = require('lodash');
var path = require('path')
var path = require('path');
var UglifyPlugin = require("uglifyjs-webpack-plugin");
var externalModules = [
'mkfifo',
@ -49,41 +50,47 @@ externalModules.push(new RegExp('^(' + _.reject(maybeOptionalModules, requiredMo
console.log('Using the following dependencies as external:', externalModules);
module.exports = {
entry: './src/app.coffee',
output: {
filename: 'app.js',
path: path.resolve(__dirname, 'dist')
},
resolve: {
extensions: [".js", ".json", ".coffee"]
},
target: 'node',
module: {
rules: [
{
test: /JSONStream\/index\.js$/,
use: require.resolve('./fix-jsonstream')
},
{
test: /\.coffee$/,
use: require.resolve('coffee-loader')
}
]
},
externals: (context, request, callback) => {
for (let m of externalModules) {
if ((typeof m === 'string' && m === request) || (m instanceof RegExp && m.test(request))) {
return callback(null, 'commonjs ' + request);
} else if (typeof m != 'string' && !(m instanceof RegExp)) {
throw new Error('Invalid entry in external modules: ' + m);
}
}
return callback()
},
plugins: [
module.exports = function (env) {
let plugins = [
new webpack.DefinePlugin({
'process.env.NODE_ENV': '"production"',
})
]
};
if (env == null || !env.noOptimize) {
plugins.push(new UglifyPlugin())
}
return {
entry: './src/app.coffee',
output: {
filename: 'app.js',
path: path.resolve(__dirname, 'dist')
},
resolve: {
extensions: [".js", ".json", ".coffee"]
},
target: 'node',
module: {
rules: [
{
test: /JSONStream\/index\.js$/,
use: require.resolve('./fix-jsonstream')
},
{
test: /\.coffee$/,
use: require.resolve('coffee-loader')
}
]
},
externals: (context, request, callback) => {
for (let m of externalModules) {
if ((typeof m === 'string' && m === request) || (m instanceof RegExp && m.test(request))) {
return callback(null, 'commonjs ' + request);
} else if (typeof m != 'string' && !(m instanceof RegExp)) {
throw new Error('Invalid entry in external modules: ' + m);
}
}
return callback()
},
plugins: plugins
};
}