2016-12-14 16:39:17 +00:00
|
|
|
/* eslint-env node */
|
|
|
|
|
2016-11-28 10:42:58 +00:00
|
|
|
module.exports = function(grunt) {
|
|
|
|
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-01-31 18:24:56 +00:00
|
|
|
["clean:dev", "concat:css", "concat:js", "copy:htmlDev", "copy:staticDev", "chmod:build", "watch"]);
|
2016-12-14 16:39:17 +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-01-31 18:24:56 +00:00
|
|
|
["eslint", "exec:stats", "clean", "jsdoc", "concat", "copy:htmlDev", "copy:htmlProd", "copy:htmlInline",
|
|
|
|
"copy:staticDev", "copy:staticProd", "cssmin", "uglify:prod", "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-01-31 18:24:56 +00:00
|
|
|
["concat:js", "uglify:prod", "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");
|
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");
|
|
|
|
grunt.loadNpmTasks("grunt-contrib-concat");
|
|
|
|
grunt.loadNpmTasks("grunt-contrib-copy");
|
|
|
|
grunt.loadNpmTasks("grunt-contrib-uglify");
|
|
|
|
grunt.loadNpmTasks("grunt-contrib-cssmin");
|
|
|
|
grunt.loadNpmTasks("grunt-contrib-htmlmin");
|
|
|
|
grunt.loadNpmTasks("grunt-inline-alt");
|
|
|
|
grunt.loadNpmTasks("grunt-chmod");
|
|
|
|
grunt.loadNpmTasks("grunt-exec");
|
|
|
|
grunt.loadNpmTasks("grunt-contrib-watch");
|
2016-12-14 16:39:17 +00:00
|
|
|
|
|
|
|
|
2016-11-28 10:42:58 +00:00
|
|
|
// JS includes
|
2017-01-31 18:24:56 +00:00
|
|
|
var jsFiles = [
|
2016-11-28 10:42:58 +00:00
|
|
|
// Third party framework libraries
|
|
|
|
"src/js/lib/jquery-2.1.1.js",
|
|
|
|
"src/js/lib/bootstrap-3.3.6.js",
|
|
|
|
"src/js/lib/split.js",
|
|
|
|
"src/js/lib/bootstrap-switch.js",
|
|
|
|
"src/js/lib/yahoo.js",
|
|
|
|
"src/js/lib/snowfall.jquery.js",
|
2016-12-14 16:39:17 +00:00
|
|
|
|
2016-11-28 10:42:58 +00:00
|
|
|
// Third party operation libraries
|
|
|
|
"src/js/lib/cryptojs/core.js",
|
|
|
|
"src/js/lib/cryptojs/x64-core.js",
|
|
|
|
"src/js/lib/cryptojs/enc-base64.js",
|
|
|
|
"src/js/lib/cryptojs/enc-utf16.js",
|
|
|
|
"src/js/lib/cryptojs/md5.js",
|
|
|
|
"src/js/lib/cryptojs/evpkdf.js",
|
|
|
|
"src/js/lib/cryptojs/cipher-core.js",
|
|
|
|
"src/js/lib/cryptojs/mode-cfb.js",
|
|
|
|
"src/js/lib/cryptojs/mode-ctr-gladman.js",
|
|
|
|
"src/js/lib/cryptojs/mode-ctr.js",
|
|
|
|
"src/js/lib/cryptojs/mode-ecb.js",
|
|
|
|
"src/js/lib/cryptojs/mode-ofb.js",
|
|
|
|
"src/js/lib/cryptojs/format-hex.js",
|
|
|
|
"src/js/lib/cryptojs/lib-typedarrays.js",
|
|
|
|
"src/js/lib/cryptojs/pad-ansix923.js",
|
|
|
|
"src/js/lib/cryptojs/pad-iso10126.js",
|
|
|
|
"src/js/lib/cryptojs/pad-iso97971.js",
|
|
|
|
"src/js/lib/cryptojs/pad-nopadding.js",
|
|
|
|
"src/js/lib/cryptojs/pad-zeropadding.js",
|
|
|
|
"src/js/lib/cryptojs/aes.js",
|
|
|
|
"src/js/lib/cryptojs/hmac.js",
|
|
|
|
"src/js/lib/cryptojs/rabbit-legacy.js",
|
|
|
|
"src/js/lib/cryptojs/rabbit.js",
|
|
|
|
"src/js/lib/cryptojs/ripemd160.js",
|
|
|
|
"src/js/lib/cryptojs/sha1.js",
|
|
|
|
"src/js/lib/cryptojs/sha256.js",
|
|
|
|
"src/js/lib/cryptojs/sha224.js",
|
|
|
|
"src/js/lib/cryptojs/sha512.js",
|
|
|
|
"src/js/lib/cryptojs/sha384.js",
|
|
|
|
"src/js/lib/cryptojs/sha3.js",
|
|
|
|
"src/js/lib/cryptojs/tripledes.js",
|
|
|
|
"src/js/lib/cryptojs/rc4.js",
|
|
|
|
"src/js/lib/cryptojs/pbkdf2.js",
|
2017-01-16 16:40:43 +00:00
|
|
|
"src/js/lib/cryptoapi/crypto-api.js",
|
|
|
|
"src/js/lib/cryptoapi/hasher.md2.js",
|
|
|
|
"src/js/lib/cryptoapi/hasher.md4.js",
|
|
|
|
"src/js/lib/cryptoapi/hasher.sha0.js",
|
2016-11-28 10:42:58 +00:00
|
|
|
"src/js/lib/jsbn/jsbn.js",
|
|
|
|
"src/js/lib/jsbn/jsbn2.js",
|
|
|
|
"src/js/lib/jsbn/base64.js",
|
|
|
|
"src/js/lib/jsbn/ec.js",
|
|
|
|
"src/js/lib/jsbn/prng4.js",
|
|
|
|
"src/js/lib/jsbn/rng.js",
|
|
|
|
"src/js/lib/jsbn/rsa.js",
|
|
|
|
"src/js/lib/jsbn/sec.js",
|
|
|
|
"src/js/lib/jsrasign/asn1-1.0.js",
|
|
|
|
"src/js/lib/jsrasign/asn1hex-1.1.js",
|
|
|
|
"src/js/lib/jsrasign/asn1x509-1.0.js",
|
|
|
|
"src/js/lib/jsrasign/base64x-1.1.js",
|
|
|
|
"src/js/lib/jsrasign/crypto-1.1.js",
|
|
|
|
"src/js/lib/jsrasign/dsa-modified-1.0.js",
|
|
|
|
"src/js/lib/jsrasign/ecdsa-modified-1.0.js",
|
|
|
|
"src/js/lib/jsrasign/ecparam-1.0.js",
|
|
|
|
"src/js/lib/jsrasign/keyutil-1.0.js",
|
|
|
|
"src/js/lib/jsrasign/x509-1.1.js",
|
|
|
|
"src/js/lib/blowfish.dojo.js",
|
|
|
|
"src/js/lib/rawdeflate.js",
|
|
|
|
"src/js/lib/rawinflate.js",
|
|
|
|
"src/js/lib/zip.js",
|
|
|
|
"src/js/lib/unzip.js",
|
|
|
|
"src/js/lib/zlib_and_gzip.js",
|
|
|
|
"src/js/lib/bzip2.js",
|
|
|
|
"src/js/lib/punycode.js",
|
|
|
|
"src/js/lib/uas_parser.js",
|
|
|
|
"src/js/lib/esprima.js",
|
|
|
|
"src/js/lib/escodegen.browser.js",
|
|
|
|
"src/js/lib/esmangle.min.js",
|
|
|
|
"src/js/lib/diff.js",
|
|
|
|
"src/js/lib/moment.js",
|
|
|
|
"src/js/lib/moment-timezone.js",
|
|
|
|
"src/js/lib/prettify.js",
|
|
|
|
"src/js/lib/vkbeautify.js",
|
|
|
|
"src/js/lib/Sortable.js",
|
|
|
|
"src/js/lib/bootstrap-colorpicker.js",
|
2016-12-16 23:33:47 +00:00
|
|
|
"src/js/lib/xpath.js",
|
2017-02-09 15:09:33 +00:00
|
|
|
|
2016-11-28 10:42:58 +00:00
|
|
|
// Custom libraries
|
|
|
|
"src/js/lib/canvas_components.js",
|
2016-12-14 16:39:17 +00:00
|
|
|
|
2016-11-28 10:42:58 +00:00
|
|
|
// Utility functions
|
|
|
|
"src/js/core/Utils.js",
|
2016-12-14 16:39:17 +00:00
|
|
|
|
2016-11-28 10:42:58 +00:00
|
|
|
// Operation objects
|
|
|
|
"src/js/operations/*.js",
|
2016-12-14 16:39:17 +00:00
|
|
|
|
2016-11-28 10:42:58 +00:00
|
|
|
// Core framework objects
|
|
|
|
"src/js/core/*.js",
|
|
|
|
"src/js/config/Categories.js",
|
|
|
|
"src/js/config/OperationConfig.js",
|
2016-12-14 16:39:17 +00:00
|
|
|
|
2016-11-28 10:42:58 +00:00
|
|
|
// HTML view objects
|
|
|
|
"src/js/views/html/*.js",
|
|
|
|
"!src/js/views/html/main.js",
|
2016-12-14 16:39:17 +00:00
|
|
|
|
2016-11-28 10:42:58 +00:00
|
|
|
// Start the app!
|
|
|
|
"src/js/views/html/main.js",
|
|
|
|
];
|
|
|
|
|
|
|
|
var 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';
|
|
|
|
|
2017-01-31 18:24:56 +00:00
|
|
|
var templateOptions = {
|
2016-11-28 10:42:58 +00:00
|
|
|
data: {
|
2017-02-07 20:31:15 +00:00
|
|
|
compileTime: grunt.template.today("dd/mm/yyyy HH:MM:ss") + " UTC",
|
2017-01-31 18:24:56 +00:00
|
|
|
compileMsg: grunt.option("compile-msg") || grunt.option("msg") || "",
|
|
|
|
codebaseStats: grunt.file.read("src/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: {
|
2016-12-14 16:39:17 +00:00
|
|
|
configFile: "src/js/.eslintrc.json"
|
2016-11-28 10:42:58 +00:00
|
|
|
},
|
|
|
|
gruntfile: ["Gruntfile.js"],
|
|
|
|
core: ["src/js/core/**/*.js"],
|
|
|
|
config: ["src/js/config/**/*.js"],
|
|
|
|
views: ["src/js/views/**/*.js"],
|
|
|
|
operations: ["src/js/operations/**/*.js"],
|
|
|
|
},
|
|
|
|
jsdoc: {
|
|
|
|
options: {
|
|
|
|
destination: "docs",
|
|
|
|
template: "node_modules/ink-docstrap/template",
|
|
|
|
recurse: true,
|
|
|
|
readme: "./README.md",
|
|
|
|
configure: "docs/jsdoc.conf.json"
|
|
|
|
},
|
|
|
|
all: {
|
|
|
|
src: [
|
|
|
|
"src/js/**/*.js",
|
|
|
|
"!src/js/lib/**/*",
|
|
|
|
],
|
|
|
|
}
|
|
|
|
},
|
|
|
|
clean: {
|
|
|
|
dev: ["build/dev/*"],
|
|
|
|
prod: ["build/prod/*"],
|
|
|
|
docs: ["docs/*", "!docs/*.conf.json", "!docs/*.ico"],
|
|
|
|
},
|
|
|
|
concat: {
|
|
|
|
options: {
|
2017-01-31 18:24:56 +00:00
|
|
|
process: templateOptions
|
2016-11-28 10:42:58 +00:00
|
|
|
},
|
|
|
|
css: {
|
|
|
|
options: {
|
|
|
|
banner: banner.replace(/\/\*\*/g, "/*!"),
|
|
|
|
process: function(content, srcpath) {
|
|
|
|
// Change special comments from /** to /*! to comply with cssmin
|
|
|
|
content = content.replace(/^\/\*\* /g, "/*! ");
|
|
|
|
return grunt.template.process(content);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
src: [
|
|
|
|
"src/css/lib/**/*.css",
|
|
|
|
"src/css/structure/**/*.css",
|
|
|
|
"src/css/themes/classic.css"
|
|
|
|
],
|
|
|
|
dest: "build/dev/styles.css"
|
|
|
|
},
|
|
|
|
js: {
|
|
|
|
options: {
|
|
|
|
banner: '"use strict";\n'
|
|
|
|
},
|
2017-01-31 18:24:56 +00:00
|
|
|
src: jsFiles,
|
2016-11-28 10:42:58 +00:00
|
|
|
dest: "build/dev/scripts.js"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
copy: {
|
2017-01-31 18:24:56 +00:00
|
|
|
htmlDev: {
|
2016-11-28 10:42:58 +00:00
|
|
|
options: {
|
|
|
|
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
|
|
|
}
|
|
|
|
},
|
|
|
|
src: "src/html/index.html",
|
|
|
|
dest: "build/dev/index.html"
|
|
|
|
},
|
2017-01-31 18:24:56 +00:00
|
|
|
htmlProd: {
|
2016-11-28 10:42:58 +00:00
|
|
|
options: {
|
|
|
|
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
|
|
|
}
|
|
|
|
},
|
|
|
|
src: "src/html/index.html",
|
|
|
|
dest: "build/prod/index.html"
|
|
|
|
},
|
2017-01-31 18:24:56 +00:00
|
|
|
htmlInline: {
|
2016-11-28 10:42:58 +00:00
|
|
|
options: {
|
|
|
|
process: function(content, srcpath) {
|
|
|
|
// 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
|
|
|
}
|
|
|
|
},
|
|
|
|
src: "src/html/index.html",
|
|
|
|
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,
|
|
|
|
cwd: "src/static/",
|
|
|
|
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,
|
|
|
|
cwd: "src/static/",
|
|
|
|
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: {
|
|
|
|
process: function(content, srcpath) {
|
|
|
|
// 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
|
|
|
}
|
|
|
|
},
|
|
|
|
uglify: {
|
|
|
|
options: {
|
|
|
|
preserveComments: function(node, comment) {
|
|
|
|
if (comment.value.indexOf("* @license") === 0) return true;
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
screwIE8: true,
|
|
|
|
ASCIIOnly: true,
|
|
|
|
beautify: {
|
|
|
|
beautify: false,
|
2017-01-31 18:24:56 +00:00
|
|
|
inline_script: true, // eslint-disable-line camelcase
|
|
|
|
ascii_only: true, // eslint-disable-line camelcase
|
|
|
|
screw_ie8: true // eslint-disable-line camelcase
|
2016-11-28 10:42:58 +00:00
|
|
|
},
|
|
|
|
compress: {
|
2017-01-31 18:24:56 +00:00
|
|
|
screw_ie8: true // eslint-disable-line camelcase
|
2016-11-28 10:42:58 +00:00
|
|
|
},
|
|
|
|
banner: banner
|
|
|
|
},
|
|
|
|
prod: {
|
|
|
|
src: "build/dev/scripts.js",
|
|
|
|
dest: "build/prod/scripts.js"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
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: {
|
2016-12-14 16:39:17 +00:00
|
|
|
command: "rm src/static/stats.txt;" +
|
2016-11-28 10:42:58 +00:00
|
|
|
[
|
|
|
|
"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'",
|
|
|
|
|
|
|
|
"ls src/js/ -R1 | grep '\.js$' | wc -l | xargs printf '\n%b\tJavaScript source files\n'",
|
|
|
|
"find src/js/ -regex '.*\.js' -print | xargs cat | wc -l | xargs printf '%b\tlines\n'",
|
|
|
|
"find src/js/ -regex '.*\.js' -exec du -hcs {} \+ | tail -n1 | egrep -o '^[^\t]*' | xargs printf '%b\tsize\n'",
|
|
|
|
|
|
|
|
"find src/js/ -regex '.*/lib/.*\.js' -print | wc -l | xargs printf '\n%b\tthird party JavaScript source files\n'",
|
|
|
|
"find src/js/ -regex '.*/lib/.*\.js' -print | xargs cat | wc -l | xargs printf '%b\tlines\n'",
|
|
|
|
"find src/js/ -regex '.*/lib/.*\.js' -exec du -hcs {} \+ | tail -n1 | egrep -o '^[^\t]*' | xargs printf '%b\tsize\n'",
|
|
|
|
|
|
|
|
"find src/js/ -regex '.*\.js' -not -regex '.*/lib/.*' -print | wc -l | xargs printf '\n%b\tfirst party JavaScript source files\n'",
|
|
|
|
"find src/js/ -regex '.*\.js' -not -regex '.*/lib/.*' -print | xargs cat | wc -l | xargs printf '%b\tlines\n'",
|
|
|
|
"find src/js/ -regex '.*\.js' -not -regex '.*/lib/.*' -exec du -hcs {} \+ | tail -n1 | egrep -o '^[^\t]*' | xargs printf '%b\tsize\n'",
|
|
|
|
|
|
|
|
"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-12-14 16:39:17 +00:00
|
|
|
|
2016-11-28 10:42:58 +00:00
|
|
|
"grep -E '^\\s+name: ' src/js/config/Categories.js | wc -l | xargs printf '\n%b\tcategories\n'",
|
|
|
|
"grep -E '^\\s+\"[A-Za-z0-9 \\-]+\": {' src/js/config/OperationConfig.js | wc -l | xargs printf '%b\toperations\n'",
|
2016-12-14 16:39:17 +00:00
|
|
|
|
2016-11-28 10:42:58 +00:00
|
|
|
].join(" >> src/static/stats.txt;") + " >> src/static/stats.txt;",
|
|
|
|
stderr: false
|
|
|
|
},
|
2017-01-31 18:24:56 +00:00
|
|
|
displayStats: {
|
2016-11-28 10:42:58 +00:00
|
|
|
command: "cat src/static/stats.txt"
|
|
|
|
},
|
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: [
|
|
|
|
"git add build/prod/index.html -v",
|
2016-12-03 01:42:23 +00:00
|
|
|
"COMMIT_HASH=$(git rev-parse HEAD)",
|
|
|
|
"git commit -m \"GitHub Pages release for ${COMMIT_HASH}\"",
|
2016-12-03 00:37:38 +00:00
|
|
|
"git push origin `git subtree split --prefix build/prod master`:gh-pages --force",
|
|
|
|
"git reset HEAD~",
|
|
|
|
"git checkout build/prod/index.html"
|
|
|
|
].join(";")
|
|
|
|
}
|
2016-11-28 10:42:58 +00:00
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
css: {
|
|
|
|
files: "src/css/**/*.css",
|
|
|
|
tasks: ["concat:css", "chmod:build"]
|
|
|
|
},
|
|
|
|
js: {
|
|
|
|
files: "src/js/**/*.js",
|
2016-11-30 23:11:06 +00:00
|
|
|
tasks: ["concat:js", "chmod:build"]
|
2016-11-28 10:42:58 +00:00
|
|
|
},
|
|
|
|
html: {
|
|
|
|
files: "src/html/**/*.html",
|
2017-01-31 18:24:56 +00:00
|
|
|
tasks: ["copy:htmlDev", "chmod:build"]
|
2016-11-28 10:42:58 +00:00
|
|
|
},
|
|
|
|
static: {
|
|
|
|
files: ["src/static/**/*", "src/static/**/.*"],
|
2017-01-31 18:24:56 +00:00
|
|
|
tasks: ["copy:staticDev", "chmod:build"]
|
2016-11-28 10:42:58 +00:00
|
|
|
},
|
|
|
|
grunt: {
|
|
|
|
files: "Gruntfile.js",
|
2017-01-31 18:24:56 +00:00
|
|
|
tasks: ["clean:dev", "concat:css", "concat:js", "copy:htmlDev", "copy:staticDev", "chmod:build"]
|
2016-11-28 10:42:58 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|