forked from jquery/jquery-migrate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
183 lines (167 loc) · 4.13 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
/*global module:false*/
module.exports = function( grunt ) {
"use strict";
var isTravis = process.env.TRAVIS;
// Project configuration.
grunt.initConfig( {
pkg: grunt.file.readJSON( "package.json" ),
files: [
"src/intro.js",
"src/version.js",
"src/compareVersions.js",
"src/migrate.js",
"src/core.js",
"src/ajax.js",
"src/attributes.js",
"src/css.js",
"src/data.js",
"src/effects.js",
"src/event.js",
"src/offset.js",
"src/serialize.js",
"src/traversing.js",
"src/deferred.js",
"src/outro.js"
],
tests: {
"jquery": [
"dev+git",
"min+git.min",
"dev+3.2.1",
"dev+3.1.1",
"dev+3.0.0"
]
},
banners: {
tiny: "/*! <%= pkg.name %> <%= pkg.version %> - <%= pkg.homepage %> */"
},
concat: {
options: {
banner: "/*!\n * <%= pkg.title || pkg.name %> - v<%= pkg.version %> - " +
"<%= grunt.template.today('yyyy-mm-dd') %>\n" +
" * Copyright <%= pkg.author.name %>\n */\n"
},
dist: {
src: "<%= files %>",
dest: "dist/<%= pkg.name %>.js"
}
},
qunit: {
files: [ "test/**/index.html" ]
},
eslint: {
options: {
// See https://github.com/sindresorhus/grunt-eslint/issues/119
quiet: true
},
dist: {
src: "dist/jquery-migrate.js"
},
dev: {
src: [
"Gruntfile.js",
"build/**/*.js",
"src/**/*.js",
"test/**/*.js"
]
}
},
uglify: {
all: {
files: {
"dist/jquery-migrate.min.js": [ "src/migratemute.js", "dist/jquery-migrate.js" ]
}
},
options: {
banner: "/*! jQuery Migrate v<%= pkg.version %>" +
" | (c) <%= pkg.author.name %> | jquery.org/license */\n",
beautify: {
ascii_only: true
}
}
},
karma: {
options: {
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: "ChromeHeadless",
flags: [ "--no-sandbox" ]
}
},
frameworks: [ "qunit" ],
files: [
"https://code.jquery.com/jquery-git.min.js",
"dist/jquery-migrate.min.js",
"src/compareVersions.js",
"test/testinit.js",
"test/migrate.js",
"test/core.js",
"test/ajax.js",
"test/attributes.js",
"test/css.js",
"test/data.js",
"test/deferred.js",
"test/effects.js",
"test/event.js",
"test/offset.js",
"test/serialize.js",
"test/traversing.js",
{ pattern: "dist/jquery-migrate.js", included: false, served: true },
{ pattern: "test/**/*.@(js|css|jpg|html|xml)", included: false, served: true }
],
client: {
clearContext: false,
qunit: {
showUI: true,
testTimeout: 5000
}
},
reporters: [ "dots" ],
autoWatch: false,
concurrency: 3,
captureTimeout: 20 * 1000,
singleRun: true
},
main: {
// The Chrome sandbox doesn't work on Travis.
browsers: [ isTravis ? "ChromeHeadlessNoSandbox" : "ChromeHeadless" ]
},
// To debug tests with Karma:
// 1. Run 'grunt karma:chrome-debug' or 'grunt karma:firefox-debug'
// (any karma subtask that has singleRun=false)
// 2. Press "Debug" in the opened browser window to start
// the tests. Unlike the other karma tasks, the debug task will
// keep the browser window open.
"chrome-debug": {
browsers: [ "Chrome" ],
singleRun: false
},
"firefox-debug": {
browsers: [ "Firefox" ],
singleRun: false
}
},
watch: {
files: [ "src/*.js", "test/*.js" ],
tasks: [ "build" ]
}
} );
// Load grunt tasks from NPM packages
require( "load-grunt-tasks" )( grunt );
// Integrate jQuery migrate specific tasks
grunt.loadTasks( "build/tasks" );
// Just an alias
grunt.registerTask( "test", [ "karma:main" ] );
grunt.registerTask( "lint", [
// Running the full eslint task without breaking it down to targets
// would run the dist target first which would point to errors in the built
// file, making it harder to fix them. We want to check the built file only
// if we already know the source files pass the linter.
"eslint:dev",
"eslint:dist"
] );
grunt.registerTask( "build", [ "concat", "uglify", "lint" ] );
grunt.registerTask( "default", [ "build", "test" ] );
// For CI
grunt.registerTask( "ci", [ "build", "test" ] );
};