@@ -6,6 +6,8 @@ module.exports = function( grunt ) {
6
6
7
7
const gzip = require ( "gzip-js" ) ;
8
8
9
+ const oldNode = / ^ v 1 0 \. / . test ( process . version ) ;
10
+
9
11
const karmaFilesExceptJQuery = [
10
12
"external/npo/npo.js" ,
11
13
"dist/jquery-migrate.min.js" ,
@@ -31,6 +33,13 @@ module.exports = function( grunt ) {
31
33
{ pattern : "test/**/*.@(js|json|css|jpg|html|xml)" , included : false , served : true }
32
34
] ;
33
35
36
+ // Support: Node.js <12
37
+ // Skip running tasks that dropped support for Node.js 10
38
+ // in this Node version.
39
+ function runIfNewNode ( task ) {
40
+ return oldNode ? "print_old_node_message:" + task : task ;
41
+ }
42
+
34
43
// Project configuration.
35
44
grunt . initConfig ( {
36
45
pkg : grunt . file . readJSON ( "package.json" ) ,
@@ -141,17 +150,17 @@ module.exports = function( grunt ) {
141
150
sourceMapName : "dist/jquery-migrate.min.map" ,
142
151
report : "min" ,
143
152
output : {
144
- " ascii_only" : true ,
153
+ ascii_only : true ,
145
154
146
155
// Support: Android 4.0 only
147
156
// UglifyJS 3 breaks Android 4.0 if this option is not enabled.
148
- // This is in lieu of setting ie8 for all of mangle, compress, and output
149
- "ie8" : true
157
+ // This is in lieu of setting ie for all of mangle, compress, and output
158
+ ie : true
150
159
} ,
151
160
banner : "/*! jQuery Migrate v<%= pkg.version %>" +
152
161
" | (c) <%= pkg.author.name %> | jquery.org/license */" ,
153
162
compress : {
154
- " hoist_funs" : false ,
163
+ hoist_funs : false ,
155
164
loops : false ,
156
165
157
166
// Support: IE <11
@@ -230,6 +239,11 @@ module.exports = function( grunt ) {
230
239
// Integrate jQuery migrate specific tasks
231
240
grunt . loadTasks ( "build/tasks" ) ;
232
241
242
+ grunt . registerTask ( "print_old_node_message" , ( ...args ) => {
243
+ var task = args . join ( ":" ) ;
244
+ grunt . log . writeln ( "Old Node.js detected, running the task \"" + task + "\" skipped..." ) ;
245
+ } ) ;
246
+
233
247
// Just an alias
234
248
grunt . registerTask ( "test" , [
235
249
"karma:main" ,
@@ -242,8 +256,8 @@ module.exports = function( grunt ) {
242
256
// would run the dist target first which would point to errors in the built
243
257
// file, making it harder to fix them. We want to check the built file only
244
258
// if we already know the source files pass the linter.
245
- "eslint:dev" ,
246
- "eslint:dist"
259
+ runIfNewNode ( "eslint:dev" ) ,
260
+ runIfNewNode ( "eslint:dist" )
247
261
] ) ;
248
262
249
263
grunt . registerTask ( "default-no-test" , [
0 commit comments