-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGruntfile.js
100 lines (93 loc) · 2.37 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
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
// configure the tasks
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
clean: {
dist: {
src: [ 'dist' ]
},
specs: {
src: 'spec/spec.js'
}
},
babel: {
options: {
presets: ['env'],
plugins: [
'transform-class-properties',
'transform-es2015-modules-umd',
'transform-object-rest-spread',
'transform-react-jsx'
]
},
build: {
files: {
'build/mitragyna.js': 'build/mitragyna.jsx'
}
},
specs: {
files: {
'spec/spec.js': [ 'spec/**/*.jsx' ]
}
}
},
concat: {
release: {
options: {
banner:
'/*\n' +
'\tmitragyna <%= pkg.version %>\n' +
'\t(c) <%= grunt.template.today("yyyy") %> Nick Landgrebe\n' +
'\tmitragyna may be freely distributed under the MIT license\n' +
'*/\n\n'
},
files: {
'dist/mitragyna.js': ['build/mitragyna.js'],
'dist/mitragyna.min.js': ['build/mitragyna.min.js'],
'dist/mitragyna.min.js.map': ['build/mitragyna.min.js.map']
}
},
build: {
files: {
'build/mitragyna.jsx': 'src/**/*.jsx'
}
}
},
connect: {
test: {
options: {
port: 8000
}
}
}
});
// load the tasks
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-umd');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-connect');
// define the tasks
grunt.registerTask(
'spec',
'Compiles and runs the Javascript spec files for source code.',
[ 'clean:specs', 'babel:specs', 'connect:test' ]
);
grunt.registerTask(
'build',
'Creates a build of the library in the build folder, then runs the specs on it.',
[ 'concat:build', 'babel:build' ]
);
grunt.registerTask(
'release',
'Creates a new release of the library in the dist folder',
[ 'clean:dist', 'build', 'concat:release' ]
);
grunt.registerTask(
'default',
'Watches the project for changes, automatically builds them and runs specs.',
[ 'build', 'watch' ]
);
};