-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
executable file
·112 lines (107 loc) · 3.47 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
var version = require('./build/version'),
setup = require('./build/setup'),
path = require('path'),
gunify = require('grunt-fayde-unify');
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-typescript');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-symlink');
grunt.loadNpmTasks('grunt-contrib-uglify');
var unify = gunify(grunt);
var meta = {
name: 'perfex'
};
var dirs = {
test: {
root: 'test',
build: 'test/.build',
lib: 'test/lib'
}
};
grunt.initConfig({
meta: meta,
dirs: dirs,
pkg: grunt.file.readJSON('./package.json'),
clean: {
bower: ['./lib'],
test: [dirs.test.lib]
},
setup: {
base: {
cwd: '.'
}
},
symlink: {
options: {
overwrite: true
},
test: {
files: [
{
expand: true,
src: ['themes/', 'dist/', 'src/'],
dest: '<%= dirs.test.lib %>/<%= meta.name %>'
},
{
expand: true,
cwd: 'lib/',
src: ['*'],
dest: dirs.test.lib,
filter: 'isDirectory'
}
]
}
},
typescript: {
build: {
src: [
'typings/**/*.d.ts',
'./src/_Version.ts',
'./src/polyfill/**.ts',
'./src/*.ts',
'./src/**/*.ts'
].concat(unify.typings({includeSelf: false})),
dest: './dist/<%= meta.name %>.js',
options: {
target: 'es5',
declaration: true,
sourceMap: true
}
},
test: {
src: [
'typings/**/*.d.ts',
'<%= dirs.test.root %>/**/*.ts',
'!<%= dirs.test.lib %>/**/*.ts'
].concat(unify.typings()),
dest: dirs.test.build,
options: {
target: 'es5',
rootDir: dirs.test.root,
module: 'amd',
sourceMap: true
}
}
},
qunit: {
all: ['<%= dirs.test.root %>/*.html']
},
version: {
bump: {
},
apply: {
src: './build/_VersionTemplate._ts',
dest: './src/_Version.ts'
}
}
});
grunt.registerTask('default', ['typescript:build']);
grunt.registerTask('test', ['typescript:build', 'typescript:test', 'qunit']);
setup(grunt);
version(grunt);
grunt.registerTask('lib:reset', ['clean', 'setup', 'symlink:test']);
grunt.registerTask('dist:upbuild', ['version:bump', 'version:apply', 'typescript:build']);
grunt.registerTask('dist:upminor', ['version:bump:minor', 'version:apply', 'typescript:build']);
grunt.registerTask('dist:upmajor', ['version:bump:major', 'version:apply', 'typescript:build']);
};