-
Notifications
You must be signed in to change notification settings - Fork 51
/
Gruntfile.js
72 lines (60 loc) · 2.44 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
const path = require("path");
const process = require("process");
const gruntBump = require("grunt-bump")
/**
* @param {IGrunt} grunt - Grunt instance
*/
module.exports = function (grunt) {
"use strict";
/** Version banner for static files (keep version format for "grunt-bump") */
const banner = "/*! github.com/micmro/PerfCascade Version:<%= package.version %> <%= grunt.template.today(\"(dd/mm/yyyy)\") %> */\n";
let releaseIncrement = ["major", "minor"]
.indexOf(grunt.option('release-increment')) != -1 ? grunt.option('release-increment') : "patch";
// manually load custom task
grunt.loadTasks('./build-utils/grunt-tasks')
// automatically loads configurations from `./grunt-config/*`
require('load-grunt-config')(grunt, {
configPath: path.join(process.cwd(), 'build-utils/grunt-config'),
/* data made availabe to the tasks */
data: {
banner: banner,
releaseIncrement: releaseIncrement
},
});
/*
* Helper Tasks
*/
//build for the file reader
grunt.registerTask("distFileReader", ["browserify:fileReader", "concat:fileReader"]);
// builds the TS into a single file
grunt.registerTask("distBase", ["clean:dist", "browserify:dist", "concat:demoCss", "distFileReader"]);
// builds npm package - relies on /stage to be populated
grunt.registerTask("buildNpm", ["copy:npmDist", "run:tscEs6", "copy:npmBase", "copy:npmZipLib"])
// Post build work, copying and combining files for NPM and regular release
grunt.registerTask("releasePrep", ["concat:mainCss", "uglify:dist", "copy:release"])
// build a single file and a library of ES6 Modules for the NPM package
grunt.registerTask("releaseBuild", ["distBase", "releasePrep", "buildNpm", "concat:pages", "copy:pages"]);
// All checks and cleanup
grunt.registerTask("preBuild", ["tslint", "clean:all"]);
// publish components (TODO: run in parallel)
grunt.registerTask("commitAndPush", [
"run:publishRelease",
"bump-commit",
"run:npmPublish",
"gh-pages"
])
/*
* Runnable Tasks
*/
//releases the current version on main to github-pages (gh-pages branch)
grunt.registerTask("ghPages", ["releaseBuild", "concat:pages", "copy:pages", "gh-pages"]);
//releases new version with auto-version bump
grunt.registerTask("release", [
"preBuild",
`bump-only:${releaseIncrement}`,
"releaseBuild",
"changelog-custom",
"commitAndPush"
]);
grunt.registerTask("default", ["clean:all", "distBase", "watch"]);
};