This repository has been archived by the owner on Mar 10, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
117 lines (113 loc) · 4.23 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/**
* Created by lindem on 12/4/13.
*/
module.exports = function (grunt) {
"use strict";
grunt.initConfig({
ts: {
// use to override the default options, See: http://gruntjs.com/configuring-tasks#options
// these are the default options to the typescript compiler for grunt-ts:
// see `tsc --help` for a list of supported options.
options: {
compile: true, // perform compilation. [true (default) | false]
comments: false, // same as !removeComments. [true | false (default)]
target: 'es5', // target javascript language. [es3 (default) | es5]
module: 'commonjs', // target javascript module style. [amd (default) | commonjs]
sourceMap: true, // generate a source map for every output js file. [true (default) | false]
sourceRoot: '', // where to locate TypeScript files. [(default) '' == source ts location]
mapRoot: '', // where to locate .map.js files. [(default) '' == generated js location.]
declaration: false // generate a declaration .d.ts file for every output js file. [true | false (default)]
},
// a particular target
cjsbuild: {
src: ["src/FirstContract.ts"], // The source typescript files, http://gruntjs.com/configuring-tasks#files
//outDir: 'commonjs', // If specified, generate an out.js file which is the merged js file
outDir: 'commonjs',
//watch: 'src', // If specified, watches this directory for changes, and re-runs the current target
// use to override the grunt-ts project options above for this target
options: {
module: 'commonjs'
}
},
amdbuild: {
src: ["src/FirstContract.ts"],
outDir: 'amd',
options: {
module: "amd",
sourceMap: false
}
},
plainjsbuild: {
src: ["src/fc-script.ts"],
options: {
module: "commonjs"
}
}
},
clean: {
commonjs: ["commonjs"],
amd: ["amd"],
plainjs: ["plainjs"]
},
mochaTest: {
test: {
options: {
reporter: "spec",
ui: "tdd"
},
src: ["tests/*js"]
}
},
browserify: {
browsersuite: {
files: {
"browser/build.js": ["browser/alltests.js"]
}
},
plainjsbuild: {
files: {
"plainjs/firstcontract.js": ["commonjs/FirstContract.js"]
}
}
},
mocha_phantomjs: {
browsersuite: ["browser/*.html"]
},
gitpush: {
"github": {
options: {
remote: "github",
branch: "master"
}
},
"tixn": {
options: {
remote: "origin",
branch: "master"
}
}
}
});
grunt.loadNpmTasks("grunt-ts");
grunt.loadNpmTasks("grunt-contrib-clean");
grunt.loadNpmTasks("grunt-mocha-test");
grunt.loadNpmTasks("grunt-mocha-phantomjs");
grunt.loadNpmTasks("grunt-browserify");
grunt.loadNpmTasks("grunt-git");
grunt.registerTask("browsersuite", [
"browserify:browsersuite",
"mocha_phantomjs:browsersuite"
]);
grunt.registerTask("gitpush", ["gitpush:tixn", "gitpush:github"]);
grunt.registerTask("test", ["mochaTest"]);
grunt.registerTask("default", [
"clean:commonjs",
"clean:amd",
"clean:plainjs",
"ts:cjsbuild",
"ts:amdbuild",
// plain javascript is built with browserify.
"ts:plainjsbuild",
"browserify:plainjsbuild",
"mochaTest"]);
};