2017-03-22 16:12:53 +00:00
|
|
|
var webpack = require("webpack"),
|
|
|
|
ExtractTextPlugin = require("extract-text-webpack-plugin");
|
2016-12-14 16:39:17 +00:00
|
|
|
|
2017-03-23 00:33:40 +00:00
|
|
|
module.exports = function (grunt) {
|
2016-11-28 10:42:58 +00:00
|
|
|
grunt.file.defaultEncoding = "utf8";
|
|
|
|
grunt.file.preserveBOM = false;
|
2016-12-14 16:39:17 +00:00
|
|
|
|
2016-11-28 10:42:58 +00:00
|
|
|
// Tasks
|
|
|
|
grunt.registerTask("dev",
|
|
|
|
"A persistent task which creates a development build whenever source files are modified.",
|
2017-03-23 18:41:36 +00:00
|
|
|
["clean:dev", "copy:htmlDev", "copy:staticDev", "chmod:build", "webpack:webDev", "watch"]);
|
2017-03-21 22:41:44 +00:00
|
|
|
|
|
|
|
grunt.registerTask("node",
|
|
|
|
"Compiles CyberChef into a single NodeJS module.",
|
|
|
|
["clean:node", "webpack:node", "chmod:build"]);
|
2016-12-14 16:39:17 +00:00
|
|
|
|
2017-02-23 18:59:58 +00:00
|
|
|
grunt.registerTask("test",
|
2017-02-24 23:50:17 +00:00
|
|
|
"A task which runs all the tests in test/tests.",
|
2017-03-21 22:41:44 +00:00
|
|
|
["clean:test", "webpack:tests", "chmod:build", "execute:test"]);
|
2017-02-23 18:59:58 +00:00
|
|
|
|
2016-11-28 10:42:58 +00:00
|
|
|
grunt.registerTask("prod",
|
|
|
|
"Creates a production-ready build. Use the --msg flag to add a compile message.",
|
2017-03-23 18:41:36 +00:00
|
|
|
["eslint", "test", "exec:stats", "clean", "jsdoc", "webpack:webProd", "copy:htmlDev", "copy:htmlProd", "copy:htmlInline",
|
|
|
|
"copy:staticDev", "copy:staticProd", "cssmin", "inline", "htmlmin", "chmod"]);
|
2016-12-14 16:39:17 +00:00
|
|
|
|
2016-11-28 10:42:58 +00:00
|
|
|
grunt.registerTask("docs",
|
|
|
|
"Compiles documentation in the /docs directory.",
|
|
|
|
["clean:docs", "jsdoc", "chmod:docs"]);
|
2016-12-14 16:39:17 +00:00
|
|
|
|
2016-11-28 10:42:58 +00:00
|
|
|
grunt.registerTask("stats",
|
|
|
|
"Provides statistics about the code base such as how many lines there are as well as details of file sizes before and after compression.",
|
2017-03-23 18:41:36 +00:00
|
|
|
["webpack:webDev", "webpack:webProd", "exec:stats", "exec:repoSize", "exec:displayStats"]);
|
2016-12-03 00:37:38 +00:00
|
|
|
|
|
|
|
grunt.registerTask("release",
|
|
|
|
"Prepares and deploys a production version of CyberChef to the gh-pages branch.",
|
2017-01-31 18:24:56 +00:00
|
|
|
["copy:ghPages", "exec:deployGhPages"]);
|
2016-12-14 16:39:17 +00:00
|
|
|
|
2016-11-28 10:42:58 +00:00
|
|
|
grunt.registerTask("default",
|
|
|
|
"Lints the code base and shows stats",
|
2017-01-31 18:24:56 +00:00
|
|
|
["eslint", "exec:stats", "exec:displayStats"]);
|
2016-12-14 16:39:17 +00:00
|
|
|
|
2016-11-28 10:42:58 +00:00
|
|
|
grunt.registerTask("doc", "docs");
|
2017-02-28 17:08:36 +00:00
|
|
|
grunt.registerTask("tests", "test");
|
2016-12-14 16:39:17 +00:00
|
|
|
grunt.registerTask("lint", "eslint");
|
|
|
|
|
|
|
|
|
2016-11-28 10:42:58 +00:00
|
|
|
// Load tasks provided by each plugin
|
2016-12-14 16:39:17 +00:00
|
|
|
grunt.loadNpmTasks("grunt-eslint");
|
2016-11-28 10:42:58 +00:00
|
|
|
grunt.loadNpmTasks("grunt-jsdoc");
|
|
|
|
grunt.loadNpmTasks("grunt-contrib-clean");
|
2017-03-21 22:41:44 +00:00
|
|
|
grunt.loadNpmTasks("grunt-webpack");
|
2016-11-28 10:42:58 +00:00
|
|
|
grunt.loadNpmTasks("grunt-contrib-copy");
|
|
|
|
grunt.loadNpmTasks("grunt-contrib-cssmin");
|
|
|
|
grunt.loadNpmTasks("grunt-contrib-htmlmin");
|
|
|
|
grunt.loadNpmTasks("grunt-inline-alt");
|
|
|
|
grunt.loadNpmTasks("grunt-chmod");
|
|
|
|
grunt.loadNpmTasks("grunt-exec");
|
2017-02-28 17:08:36 +00:00
|
|
|
grunt.loadNpmTasks("grunt-execute");
|
2016-11-28 10:42:58 +00:00
|
|
|
grunt.loadNpmTasks("grunt-contrib-watch");
|
2016-12-14 16:39:17 +00:00
|
|
|
|
|
|
|
|
2017-03-22 16:55:21 +00:00
|
|
|
var compileTime = grunt.template.today("dd/mm/yyyy HH:MM:ss") + " UTC",
|
2017-03-23 00:33:40 +00:00
|
|
|
banner = "/**\n" +
|
|
|
|
"* CyberChef - The Cyber Swiss Army Knife\n" +
|
|
|
|
"*\n" +
|
|
|
|
"* @copyright Crown Copyright 2016\n" +
|
|
|
|
"* @license Apache-2.0\n" +
|
|
|
|
"*\n" +
|
|
|
|
"* Copyright 2016 Crown Copyright\n" +
|
|
|
|
"*\n" +
|
|
|
|
'* Licensed under the Apache License, Version 2.0 (the "License");\n' +
|
|
|
|
"* you may not use this file except in compliance with the License.\n" +
|
|
|
|
"* You may obtain a copy of the License at\n" +
|
|
|
|
"*\n" +
|
|
|
|
"* http://www.apache.org/licenses/LICENSE-2.0\n" +
|
|
|
|
"*\n" +
|
|
|
|
"* Unless required by applicable law or agreed to in writing, software\n" +
|
|
|
|
'* distributed under the License is distributed on an "AS IS" BASIS,\n' +
|
|
|
|
"* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +
|
|
|
|
"* See the License for the specific language governing permissions and\n" +
|
|
|
|
"* limitations under the License.\n" +
|
|
|
|
"*/\n";
|
2016-11-28 10:42:58 +00:00
|
|
|
|
2017-01-31 18:24:56 +00:00
|
|
|
var templateOptions = {
|
2016-11-28 10:42:58 +00:00
|
|
|
data: {
|
2017-03-22 16:55:21 +00:00
|
|
|
compileTime: compileTime,
|
2017-01-31 18:24:56 +00:00
|
|
|
compileMsg: grunt.option("compile-msg") || grunt.option("msg") || "",
|
2017-03-23 00:33:40 +00:00
|
|
|
codebaseStats: grunt.file.read("src/web/static/stats.txt").split("\n").join("<br>")
|
2016-11-28 10:42:58 +00:00
|
|
|
}
|
|
|
|
};
|
2016-12-14 16:39:17 +00:00
|
|
|
|
2016-11-28 10:42:58 +00:00
|
|
|
// Project configuration
|
|
|
|
grunt.initConfig({
|
2016-12-14 16:39:17 +00:00
|
|
|
eslint: {
|
2016-11-28 10:42:58 +00:00
|
|
|
options: {
|
2017-03-23 00:33:40 +00:00
|
|
|
configFile: "src/.eslintrc.json"
|
2016-11-28 10:42:58 +00:00
|
|
|
},
|
|
|
|
gruntfile: ["Gruntfile.js"],
|
2017-03-23 00:33:40 +00:00
|
|
|
core: ["src/core/**/*.js", "!src/core/lib/**/*"],
|
|
|
|
web: ["src/web/**/*.js"],
|
|
|
|
node: ["src/node/**/*.js"],
|
2017-02-28 17:08:36 +00:00
|
|
|
tests: ["test/**/*.js"],
|
2016-11-28 10:42:58 +00:00
|
|
|
},
|
|
|
|
jsdoc: {
|
|
|
|
options: {
|
|
|
|
destination: "docs",
|
|
|
|
template: "node_modules/ink-docstrap/template",
|
|
|
|
recurse: true,
|
|
|
|
readme: "./README.md",
|
|
|
|
configure: "docs/jsdoc.conf.json"
|
|
|
|
},
|
|
|
|
all: {
|
|
|
|
src: [
|
2017-03-23 00:33:40 +00:00
|
|
|
"src/**/*.js",
|
|
|
|
"!src/core/lib/**/*",
|
2016-11-28 10:42:58 +00:00
|
|
|
],
|
|
|
|
}
|
|
|
|
},
|
|
|
|
clean: {
|
|
|
|
dev: ["build/dev/*"],
|
|
|
|
prod: ["build/prod/*"],
|
2017-02-28 17:08:36 +00:00
|
|
|
test: ["build/test/*"],
|
2017-03-21 22:41:44 +00:00
|
|
|
node: ["build/node/*"],
|
2016-11-28 10:42:58 +00:00
|
|
|
docs: ["docs/*", "!docs/*.conf.json", "!docs/*.ico"],
|
|
|
|
},
|
2017-03-21 22:41:44 +00:00
|
|
|
webpack: {
|
|
|
|
options: {
|
|
|
|
plugins: [
|
|
|
|
new webpack.ProvidePlugin({
|
|
|
|
$: "jquery",
|
|
|
|
jQuery: "jquery",
|
|
|
|
moment: "moment-timezone"
|
2017-03-22 16:55:21 +00:00
|
|
|
}),
|
|
|
|
new webpack.BannerPlugin({
|
|
|
|
"banner": banner,
|
|
|
|
"raw": true,
|
|
|
|
"entryOnly": true
|
|
|
|
}),
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
COMPILE_TIME: JSON.stringify(compileTime),
|
|
|
|
COMPILE_MSG: JSON.stringify(grunt.option("compile-msg") || grunt.option("msg") || "")
|
|
|
|
}),
|
2017-03-23 18:41:36 +00:00
|
|
|
new ExtractTextPlugin("styles.css"),
|
2017-03-21 22:41:44 +00:00
|
|
|
],
|
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
jquery: "jquery/src/jquery"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
module: {
|
2017-03-22 16:12:53 +00:00
|
|
|
loaders: [
|
|
|
|
{
|
|
|
|
test: /\.js$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
loader: "babel-loader?compact=false"
|
|
|
|
}
|
2017-03-23 18:41:36 +00:00
|
|
|
],
|
2017-03-22 16:12:53 +00:00
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.css$/,
|
|
|
|
use: ExtractTextPlugin.extract({
|
|
|
|
use: "css-loader"
|
|
|
|
})
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.less$/,
|
|
|
|
use: ExtractTextPlugin.extract({
|
|
|
|
use: [
|
|
|
|
{ loader: "css-loader" },
|
|
|
|
{ loader: "less-loader" }
|
|
|
|
]
|
|
|
|
})
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/,
|
|
|
|
loader: "url-loader",
|
|
|
|
options: {
|
|
|
|
limit: 10000
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2017-03-23 18:41:36 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
webDev: {
|
|
|
|
target: "web",
|
|
|
|
entry: "./src/web/index.js",
|
|
|
|
output: {
|
|
|
|
filename: "scripts.js",
|
|
|
|
path: "build/dev"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
webProd: {
|
|
|
|
target: "web",
|
|
|
|
entry: "./src/web/index.js",
|
|
|
|
output: {
|
|
|
|
filename: "scripts.js",
|
|
|
|
path: "build/prod"
|
2017-03-22 16:12:53 +00:00
|
|
|
},
|
|
|
|
plugins: [
|
2017-03-23 18:41:36 +00:00
|
|
|
new webpack.optimize.UglifyJsPlugin({
|
|
|
|
compress: {
|
|
|
|
"screw_ie8": true,
|
|
|
|
"dead_code": true,
|
|
|
|
"unused": true,
|
|
|
|
"warnings": false
|
|
|
|
},
|
|
|
|
comments: false,
|
|
|
|
}),
|
2017-03-22 16:12:53 +00:00
|
|
|
]
|
2017-03-21 22:41:44 +00:00
|
|
|
},
|
|
|
|
tests: {
|
|
|
|
target: "node",
|
2017-03-21 23:56:46 +00:00
|
|
|
entry: ["babel-polyfill", "./test/TestRunner.js"],
|
2017-03-21 22:41:44 +00:00
|
|
|
output: {
|
|
|
|
filename: "index.js",
|
|
|
|
path: "build/test"
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
loaders: [{
|
|
|
|
test: /prettify\.min\.js$/,
|
|
|
|
use: "imports-loader?window=>global"
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
node: {
|
|
|
|
target: "node",
|
2017-03-23 00:33:40 +00:00
|
|
|
entry: ["babel-polyfill", "./src/node/index.js"],
|
2017-03-21 22:41:44 +00:00
|
|
|
output: {
|
|
|
|
filename: "CyberChef.js",
|
|
|
|
path: "build/node",
|
|
|
|
library: "CyberChef",
|
|
|
|
libraryTarget: "commonjs2"
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
loaders: [{
|
|
|
|
test: /prettify\.min\.js$/,
|
|
|
|
use: "imports-loader?window=>global"
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2016-11-28 10:42:58 +00:00
|
|
|
copy: {
|
2017-01-31 18:24:56 +00:00
|
|
|
htmlDev: {
|
2016-11-28 10:42:58 +00:00
|
|
|
options: {
|
2017-03-23 00:33:40 +00:00
|
|
|
process: function (content, srcpath) {
|
2017-01-31 18:24:56 +00:00
|
|
|
return grunt.template.process(content, templateOptions);
|
2016-11-28 10:42:58 +00:00
|
|
|
}
|
|
|
|
},
|
2017-03-23 00:33:40 +00:00
|
|
|
src: "src/web/html/index.html",
|
2016-11-28 10:42:58 +00:00
|
|
|
dest: "build/dev/index.html"
|
|
|
|
},
|
2017-01-31 18:24:56 +00:00
|
|
|
htmlProd: {
|
2016-11-28 10:42:58 +00:00
|
|
|
options: {
|
2017-03-23 00:33:40 +00:00
|
|
|
process: function (content, srcpath) {
|
2017-01-31 18:24:56 +00:00
|
|
|
return grunt.template.process(content, templateOptions);
|
2016-11-28 10:42:58 +00:00
|
|
|
}
|
|
|
|
},
|
2017-03-23 00:33:40 +00:00
|
|
|
src: "src/web/html/index.html",
|
2016-11-28 10:42:58 +00:00
|
|
|
dest: "build/prod/index.html"
|
|
|
|
},
|
2017-01-31 18:24:56 +00:00
|
|
|
htmlInline: {
|
2016-11-28 10:42:58 +00:00
|
|
|
options: {
|
2017-03-23 00:33:40 +00:00
|
|
|
process: function (content, srcpath) {
|
2016-11-28 10:42:58 +00:00
|
|
|
// TODO: Do all this in Jade
|
|
|
|
content = content.replace(
|
2016-12-03 00:40:51 +00:00
|
|
|
'<a href="cyberchef.htm" style="float: left; margin-left: 10px; margin-right: 80px;" download>Download CyberChef<img src="images/download-24x24.png" /></a>',
|
2016-12-14 16:39:17 +00:00
|
|
|
'<span style="float: left; margin-left: 10px;">Compile time: ' + grunt.template.today("dd/mm/yyyy HH:MM:ss") + " UTC</span>");
|
2017-01-31 18:24:56 +00:00
|
|
|
return grunt.template.process(content, templateOptions);
|
2016-11-28 10:42:58 +00:00
|
|
|
}
|
|
|
|
},
|
2017-03-23 00:33:40 +00:00
|
|
|
src: "src/web/html/index.html",
|
2016-11-28 10:42:58 +00:00
|
|
|
dest: "build/prod/cyberchef.htm"
|
|
|
|
},
|
2017-01-31 18:24:56 +00:00
|
|
|
staticDev: {
|
2016-11-28 10:42:58 +00:00
|
|
|
files: [
|
|
|
|
{
|
|
|
|
expand: true,
|
2017-03-23 00:33:40 +00:00
|
|
|
cwd: "src/web/static/",
|
2016-11-28 10:42:58 +00:00
|
|
|
src: [
|
|
|
|
"**/*",
|
|
|
|
"**/.*",
|
2016-12-03 00:37:38 +00:00
|
|
|
"!stats.txt",
|
|
|
|
"!ga.html"
|
2016-11-28 10:42:58 +00:00
|
|
|
],
|
|
|
|
dest: "build/dev/"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2017-01-31 18:24:56 +00:00
|
|
|
staticProd: {
|
2016-11-28 10:42:58 +00:00
|
|
|
files: [
|
|
|
|
{
|
|
|
|
expand: true,
|
2017-03-23 00:33:40 +00:00
|
|
|
cwd: "src/web/static/",
|
2016-11-28 10:42:58 +00:00
|
|
|
src: [
|
|
|
|
"**/*",
|
|
|
|
"**/.*",
|
2016-12-03 00:37:38 +00:00
|
|
|
"!stats.txt",
|
|
|
|
"!ga.html"
|
2016-11-28 10:42:58 +00:00
|
|
|
],
|
|
|
|
dest: "build/prod/"
|
|
|
|
}
|
|
|
|
]
|
2016-12-03 00:37:38 +00:00
|
|
|
},
|
2017-01-31 18:24:56 +00:00
|
|
|
ghPages: {
|
2016-12-03 00:37:38 +00:00
|
|
|
options: {
|
2017-03-23 00:33:40 +00:00
|
|
|
process: function (content, srcpath) {
|
2016-12-03 00:37:38 +00:00
|
|
|
// Add Google Analytics code to index.html
|
|
|
|
content = content.replace("</body></html>",
|
|
|
|
grunt.file.read("src/static/ga.html") + "</body></html>");
|
2017-01-31 18:24:56 +00:00
|
|
|
return grunt.template.process(content, templateOptions);
|
2016-12-03 00:37:38 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
src: "build/prod/index.html",
|
|
|
|
dest: "build/prod/index.html"
|
2016-11-28 10:42:58 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
cssmin: {
|
|
|
|
prod: {
|
|
|
|
src: "build/dev/styles.css",
|
|
|
|
dest: "build/prod/styles.css"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
htmlmin: {
|
|
|
|
prod: {
|
|
|
|
options: {
|
|
|
|
removeComments: true,
|
|
|
|
collapseWhitespace: true,
|
|
|
|
minifyJS: true,
|
|
|
|
minifyCSS: true
|
|
|
|
},
|
|
|
|
src: "build/prod/index.html",
|
|
|
|
dest: "build/prod/index.html"
|
|
|
|
},
|
|
|
|
inline: {
|
|
|
|
options: {
|
|
|
|
removeComments: true,
|
|
|
|
collapseWhitespace: true,
|
|
|
|
minifyJS: false,
|
|
|
|
minifyCSS: false
|
|
|
|
},
|
|
|
|
src: "build/prod/cyberchef.htm",
|
|
|
|
dest: "build/prod/cyberchef.htm"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
inline: {
|
|
|
|
options: {
|
|
|
|
tag: "",
|
|
|
|
inlineTagAttributes: {
|
|
|
|
js: "type='application/javascript'",
|
|
|
|
css: "type='text/css'"
|
|
|
|
}
|
|
|
|
},
|
2016-11-30 19:50:21 +00:00
|
|
|
compiled: {
|
2016-11-28 10:42:58 +00:00
|
|
|
src: "build/prod/cyberchef.htm",
|
|
|
|
dest: "build/prod/cyberchef.htm"
|
2016-11-30 19:50:21 +00:00
|
|
|
},
|
|
|
|
prod: {
|
|
|
|
options: {
|
|
|
|
tag: "__inline"
|
|
|
|
},
|
|
|
|
src: "build/prod/index.html",
|
|
|
|
dest: "build/prod/index.html"
|
2016-11-28 10:42:58 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
chmod: {
|
|
|
|
build: {
|
|
|
|
options: {
|
|
|
|
mode: "755",
|
|
|
|
},
|
|
|
|
src: ["build/**/*", "build/**/.htaccess", "build/"]
|
|
|
|
},
|
|
|
|
docs: {
|
|
|
|
options: {
|
|
|
|
mode: "755",
|
|
|
|
},
|
|
|
|
src: ["docs/**/*", "docs/"]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
exec: {
|
2017-01-31 18:24:56 +00:00
|
|
|
repoSize: {
|
2016-11-28 10:42:58 +00:00
|
|
|
command: [
|
2016-12-14 16:39:17 +00:00
|
|
|
"git ls-files | wc -l | xargs printf '\n%b\ttracked files\n'",
|
|
|
|
"du -hs | egrep -o '^[^\t]*' | xargs printf '%b\trepository size\n'"
|
|
|
|
].join(";"),
|
2016-11-28 10:42:58 +00:00
|
|
|
stderr: false
|
|
|
|
},
|
|
|
|
stats: {
|
2017-03-23 00:33:40 +00:00
|
|
|
command: "rm src/web/static/stats.txt;" +
|
|
|
|
[
|
|
|
|
"ls src/ -R1 | grep '^$' -v | grep ':$' -v | wc -l | xargs printf '%b\tsource files\n'",
|
|
|
|
"find src/ -regex '.*\..*' -print | xargs cat | wc -l | xargs printf '%b\tlines\n'",
|
|
|
|
"du -hs src/ | pcregrep -o '^[^\t]*' | xargs printf '%b\tsize\n'",
|
2016-11-28 10:42:58 +00:00
|
|
|
|
2017-03-23 00:33:40 +00:00
|
|
|
"find src/ -regex '.*\.js' -not -regex '.*/lib/.*' -print | wc -l | xargs printf '\n%b\tJavaScript source files\n'",
|
|
|
|
"find src/ -regex '.*\.js' -not -regex '.*/lib/.*' -print | xargs cat | wc -l | xargs printf '%b\tlines\n'",
|
|
|
|
"find src/ -regex '.*\.js' -not -regex '.*/lib/.*' -exec du -hcs {} \+ | tail -n1 | egrep -o '^[^\t]*' | xargs printf '%b\tsize\n'",
|
2016-11-28 10:42:58 +00:00
|
|
|
|
2017-03-23 00:33:40 +00:00
|
|
|
"du build/dev/scripts.js -h | egrep -o '^[^\t]*' | xargs printf '\n%b\tuncompressed JavaScript size\n'",
|
|
|
|
"du build/prod/scripts.js -h | egrep -o '^[^\t]*' | xargs printf '%b\tcompressed JavaScript size\n'",
|
2016-11-28 10:42:58 +00:00
|
|
|
|
2017-03-23 00:33:40 +00:00
|
|
|
"grep -E '^\\s+name: ' src/core/config/Categories.js | wc -l | xargs printf '\n%b\tcategories\n'",
|
|
|
|
"grep -E '^\\s+\"[A-Za-z0-9 \\-]+\": {' src/core/config/OperationConfig.js | wc -l | xargs printf '%b\toperations\n'",
|
2016-11-28 10:42:58 +00:00
|
|
|
|
2017-03-23 00:33:40 +00:00
|
|
|
].join(" >> src/web/static/stats.txt;") + " >> src/web/static/stats.txt;",
|
2016-11-28 10:42:58 +00:00
|
|
|
stderr: false
|
|
|
|
},
|
2017-01-31 18:24:56 +00:00
|
|
|
displayStats: {
|
2017-03-23 00:33:40 +00:00
|
|
|
command: "cat src/web/static/stats.txt"
|
2016-11-28 10:42:58 +00:00
|
|
|
},
|
2017-01-31 18:24:56 +00:00
|
|
|
cleanGit: {
|
2016-11-28 10:42:58 +00:00
|
|
|
command: "git gc --prune=now --aggressive"
|
|
|
|
},
|
2017-01-31 18:24:56 +00:00
|
|
|
deployGhPages: {
|
2016-12-03 00:37:38 +00:00
|
|
|
command: [
|
2017-03-23 00:33:40 +00:00
|
|
|
"git add build/prod/index.html -v",
|
|
|
|
"COMMIT_HASH=$(git rev-parse HEAD)",
|
|
|
|
"git commit -m \"GitHub Pages release for ${COMMIT_HASH}\"",
|
|
|
|
"git push origin `git subtree split --prefix build/prod master`:gh-pages --force",
|
|
|
|
"git reset HEAD~",
|
|
|
|
"git checkout build/prod/index.html"
|
2016-12-03 00:37:38 +00:00
|
|
|
].join(";")
|
|
|
|
}
|
2016-11-28 10:42:58 +00:00
|
|
|
},
|
2017-02-28 17:08:36 +00:00
|
|
|
execute: {
|
2017-03-21 22:41:44 +00:00
|
|
|
test: "build/test/index.js"
|
2017-02-28 17:08:36 +00:00
|
|
|
},
|
2016-11-28 10:42:58 +00:00
|
|
|
watch: {
|
|
|
|
css: {
|
2017-03-23 00:33:40 +00:00
|
|
|
files: ["src/web/css/**/*.css", "src/web/css/**/*.less"],
|
2017-03-23 18:41:36 +00:00
|
|
|
tasks: ["webpack:webDev", "chmod:build"]
|
2016-11-28 10:42:58 +00:00
|
|
|
},
|
|
|
|
js: {
|
2017-03-23 00:33:40 +00:00
|
|
|
files: "src/**/*.js",
|
2017-03-23 18:41:36 +00:00
|
|
|
tasks: ["webpack:webDev", "chmod:build"]
|
2016-11-28 10:42:58 +00:00
|
|
|
},
|
|
|
|
html: {
|
2017-03-23 00:33:40 +00:00
|
|
|
files: "src/web/html/**/*.html",
|
2017-02-24 23:50:17 +00:00
|
|
|
tasks: ["copy:htmlDev", "chmod:build"]
|
2016-11-28 10:42:58 +00:00
|
|
|
},
|
|
|
|
static: {
|
2017-03-23 00:33:40 +00:00
|
|
|
files: ["src/web/static/**/*", "src/web/static/**/.*"],
|
2017-02-24 23:50:17 +00:00
|
|
|
tasks: ["copy:staticDev", "chmod:build"]
|
2016-11-28 10:42:58 +00:00
|
|
|
},
|
|
|
|
grunt: {
|
|
|
|
files: "Gruntfile.js",
|
2017-03-23 18:41:36 +00:00
|
|
|
tasks: ["clean:dev", "webpack:webDev", "copy:htmlDev", "copy:staticDev", "chmod:build"]
|
2016-11-28 10:42:58 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|