From aafde8986d679f8ee96133fcee75f53cbf25f904 Mon Sep 17 00:00:00 2001 From: d98762625 Date: Wed, 13 Feb 2019 14:48:55 +0000 Subject: [PATCH] tidy up gruntfile for node --- Gruntfile.js | 30 +++--------------------------- package.json | 4 ++-- 2 files changed, 5 insertions(+), 29 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index c80df6de..359723e5 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -28,11 +28,7 @@ module.exports = function (grunt) { grunt.registerTask("node", "Compiles CyberChef into a single NodeJS module.", - ["clean", "exec:generateConfig", "exec:generateNodeIndex", "webpack:node", "chmod:build"]); - - grunt.registerTask("node-prod", - "Compiles CyberChef into a single NodeJS module.", - ["clean", "exec:generateConfig", "exec:generateNodeIndex", "webpack:nodeProd", "webpack:nodeRepl", "chmod:build"]); + ["clean", "exec:generateConfig", "exec:generateNodeIndex", "webpack:node", "webpack:nodeRepl", "chmod:build"]); grunt.registerTask("test", "A task which runs all the operation tests in the tests directory.", @@ -275,27 +271,7 @@ module.exports = function (grunt) { ] }, node: { - mode: "development", - target: "node", - entry: "./src/node/index.mjs", - externals: [NodeExternals({ - whitelist: ["crypto-api/src/crypto-api"] - })], - output: { - filename: "CyberChef.js", - path: __dirname + "/build/node", - library: "CyberChef", - libraryTarget: "commonjs2" - }, - plugins: [ - new webpack.DefinePlugin(BUILD_CONSTANTS), - new webpack.optimize.LimitChunkCountPlugin({ - maxChunks: 1 - }) - ], - }, - nodeProd: { - mode: "production", + mode: process.env.NODE_ENV, target: "node", entry: "./src/node/index.mjs", externals: [NodeExternals({ @@ -326,7 +302,7 @@ module.exports = function (grunt) { } }, nodeRepl: { - mode: "production", + mode: process.env.NODE_ENV, target: "node", entry: "./src/node/repl-index.mjs", externals: [NodeExternals({ diff --git a/package.json b/package.json index d51ace98..9b578388 100644 --- a/package.json +++ b/package.json @@ -140,9 +140,9 @@ }, "scripts": { "start": "grunt dev", - "start-node": "grunt node", "build": "grunt prod", - "build-node": "grunt node-prod", + "node": "NODE_ENV=development grunt node", + "node-prod": "NODE_ENV=production grunt node", "test": "grunt test", "testui": "grunt testui", "docs": "grunt docs",