Repository navigation
Expand file tree
/
Copy pathGruntfile.js
More file actions
113 lines (102 loc) · 3.64 KB
/
Copy pathGruntfile.js
File metadata and controls
113 lines (102 loc) · 3.64 KB
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
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
files: ['**/*.js'],
tasks: ['jasmine', 'jshint']
},
nugetpack: {
dist: {
src: 'nuget/backbone.hypermedia.nuspec',
dest: 'nuget/',
options: {
version: '<%= pkg.version %>'
}
}
},
nugetpush: {
dist: {
src: 'nuget/*.nupkg'
}
},
jasmine: {
src: 'src/*.js',
options: {
specs: 'spec/*.js',
template: require('grunt-template-jasmine-requirejs'),
templateOptions: {
requireConfig: {
baseUrl: 'src/',
paths: {
'jquery': '../node_modules/jquery/dist/jquery.min',
'backbone': '../node_modules/backbone/backbone-min',
'underscore': '../node_modules/underscore/underscore-min',
'backbone-hypermedia': '../src/backbone-hypermedia-amd'
},
shim: {
'underscore': {
exports: '_'
},
'backbone': {
deps: ['underscore', 'jquery'],
exports: 'Backbone'
}
}
}
}
}
},
jshint: {
all: ['Gruntfile.js', 'src/**/*.js', '!src/**/*.min.map', '!src/**/*.min.js', 'spec/**/*.js']
},
clean: ['nuget/*.nupkg'],
// pushes to npm
release: {
options: {
// we'll use grunt-bump to increment the version as it
// supports reloading the pkg config var which we need
// as it is referenced when the nuget tasks are run
bump: false,
commitMessage: 'Release <%= version %>'
/*github: {
repo: 'linn/backbone.hypermedia'
}*/
}
},
bump: {
options: {
// reload pkg config var after bump
updateConfigs: ['pkg'],
commit: false,
createTag: false,
push: false
}
},
uglify: {
my_target: {
options: {
sourceMap: true,
sourceMapName: 'src/backbone-hypermedia-amd.min.map'
},
files: {
'src/backbone-hypermedia-amd.min.js': ['src/backbone-hypermedia-amd.js']
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-jasmine');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-bump');
grunt.loadNpmTasks('grunt-nuget');
grunt.loadNpmTasks('grunt-release');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.registerTask('test', ['jshint', 'jasmine']);
grunt.registerTask('minify', ['uglify']);
grunt.registerTask('default', ['test', 'minify']);
grunt.registerTask('publish', ['publish:patch']);
grunt.registerTask('publish:patch', ['clean', 'minify', 'bump:patch', 'release', 'nugetpack', 'nugetpush']);
grunt.registerTask('publish:minor', ['clean', 'minify', 'bump:minor', 'release', 'nugetpack', 'nugetpush']);
grunt.registerTask('publish:major', ['clean', 'minify', 'bump:major', 'release', 'nugetpack', 'nugetpush']);
};