forked from prismicio/javascript-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
126 lines (107 loc) · 3.79 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
118
119
120
121
122
123
124
125
126
module.exports = function(grunt) {
/**
* Ideally, someday, it would be good to bump like that:
* > grunt
* > grunt bump
* > grunt copy
* > git push prismicio master --tags
* But grunt bump doesn't quite work, so for now:
* * change version number in package.json, bower.json, and README.md
* * run `grunt`
* * run `cp dist/prismic.io.min.js dist/prismic.io-x.x.x.min.js` to freeze the right minified version
* * run `git add .` then `git commit -m "Release vx.x.x"` and finally `git tag x.x.x`
* * run `git push https://github.com/prismicio/javascript-kit.git master --tags`
* Once you're done, update npm and bower, and update the release's description if needed
*/
grunt.initConfig({
VERSION: grunt.file.readJSON('bower.json').version,
pkg: grunt.file.readJSON('package.json'),
qunit: {
local: ['./test/**/*.html'],
int: { options: { urls: ['http://localhost:8888/test/test.html'] }},
unit: { options: { urls: ['http://localhost:8888/test/unit.html'] }}
},
clean: {
src: ['dist/prismic.io.js','dist/prismic.io.min.js', 'doc']
},
concat: {
dist: {
src: ['src/api.js', 'src/fragments.js'],
dest: 'dist/prismic.io.js'
}
},
uglify: {
options: {
banner: '/*!\n * <%= pkg.name %> <%= VERSION %>\n * See release notes: https://github.com/prismicio/javascript-kit/releases\n */\n'
},
build: {
src: 'dist/prismic.io.js',
dest: 'dist/prismic.io.min.js'
}
},
copy: {
main: {
src: 'dist/prismic.io.min.js',
dest: 'dist/prismic.io-<%= VERSION %>.min.js'
}
},
bump: {
options: {
files: ['package.json', 'bower.json', 'README.md'],
updateConfigs: [],
commit: false,
commitMessage: 'Release v%VERSION%',
commitFiles: ['-a'], // '-a' for all files
createTag: true,
tagName: '%VERSION%',
tagMessage: 'Version %VERSION%',
push: false,
pushTo: 'upstream',
gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d' // options to use with '$ git describe'
}
},
jsdoc : {
dist : {
src: ['src/*.js', 'README.md'],
options: {
destination: 'doc'
}
}
},
connect: {
options: {
hostname: 'localhost',
port: 8888,
base: '.'
},
testAuto: {},
test: {
options: {
keepalive: true
}
}
}
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-bump');
grunt.loadNpmTasks('grunt-jsdoc');
// Default task.
grunt.registerTask('default', ['qunit', 'clean', 'concat', 'uglify']);
// bump task to increment version numbers in bower.json and package.json, and create a git tag. Remember to push your tag if you want a release available on bower.
grunt.registerTask('bump', ['bump']);
// copying the minified file to freeze it as this version on the master (can not be done before bump)
grunt.registerTask('copy', ['copy']);
// Launch a local test server and run the tests on it
// or keep the server running so you can debug on your browser
grunt.registerTask('test', ['connect:testAuto', 'qunit:int', 'qunit:unit']);
grunt.registerTask('test:local', ['qunit:local']);
grunt.registerTask('test:int', ['connect:testAuto', 'qunit:int']);
grunt.registerTask('test:unit', ['connect:testAuto', 'qunit:unit']);
grunt.registerTask('test:browser', ['connect:test']);
};