update travis build to include node tests. Minor refactor to grunt jobs for node

This commit is contained in:
d98762625 2019-03-20 15:10:16 +00:00
parent aad1bc898e
commit a1b116d2f5
3 changed files with 12 additions and 6 deletions

View File

@ -1,6 +1,8 @@
language: node_js language: node_js
node_js: node_js:
- node - node
env:
- NODE_ENV=production
cache: npm cache: npm
addons: addons:
chrome: stable chrome: stable
@ -11,6 +13,7 @@ before_script:
script: script:
- grunt lint - grunt lint
- grunt test - grunt test
- grunt test-node
- grunt docs - grunt docs
- grunt node - grunt node
- grunt prod --msg="$COMPILE_MSG" - grunt prod --msg="$COMPILE_MSG"

View File

@ -17,6 +17,8 @@ const UglifyJSWebpackPlugin = require("uglifyjs-webpack-plugin");
* @license Apache-2.0 * @license Apache-2.0
*/ */
const NODE_PROD = process.env.NODE_ENV === "production";
module.exports = function (grunt) { module.exports = function (grunt) {
grunt.file.defaultEncoding = "utf8"; grunt.file.defaultEncoding = "utf8";
grunt.file.preserveBOM = false; grunt.file.preserveBOM = false;
@ -271,7 +273,7 @@ module.exports = function (grunt) {
] ]
}, },
node: { node: {
mode: process.env.NODE_ENV === "prodction" ? "production" : "development", mode: NODE_PROD ? "production" : "development",
target: "node", target: "node",
entry: "./src/node/index.mjs", entry: "./src/node/index.mjs",
externals: [NodeExternals({ externals: [NodeExternals({
@ -290,7 +292,7 @@ module.exports = function (grunt) {
}) })
], ],
optimization: { optimization: {
minimizer: [ minimizer: NODE_PROD ? [
new UglifyJSWebpackPlugin({ new UglifyJSWebpackPlugin({
cache: true, cache: true,
parallel: true, parallel: true,
@ -298,11 +300,11 @@ module.exports = function (grunt) {
"keep_fnames": true, "keep_fnames": true,
} }
}) })
] ] : []
} }
}, },
nodeRepl: { nodeRepl: {
mode: process.env.NODE_ENV === "prodction" ? "production" : "development", mode: NODE_PROD ? "production" : "development",
target: "node", target: "node",
entry: "./src/node/repl-index.mjs", entry: "./src/node/repl-index.mjs",
externals: [NodeExternals({ externals: [NodeExternals({
@ -321,7 +323,7 @@ module.exports = function (grunt) {
}) })
], ],
optimization: { optimization: {
minimizer: [ minimizer: NODE_PROD ? [
new UglifyJSWebpackPlugin({ new UglifyJSWebpackPlugin({
parallel: true, parallel: true,
cache: true, cache: true,
@ -329,7 +331,7 @@ module.exports = function (grunt) {
"keep_fnames": true, "keep_fnames": true,
} }
}) })
] ] : []
} }
} }
}, },

View File

@ -146,6 +146,7 @@
"node-prod": "NODE_ENV=production grunt node", "node-prod": "NODE_ENV=production grunt node",
"repl": "grunt node && node build/node/CyberChef-repl.js", "repl": "grunt node && node build/node/CyberChef-repl.js",
"test": "grunt test", "test": "grunt test",
"test-node": "grunt test-node",
"testui": "grunt testui", "testui": "grunt testui",
"docs": "grunt docs", "docs": "grunt docs",
"lint": "grunt lint", "lint": "grunt lint",