MDL-66265 javascript: Add jshint ignore for ES6 files in root dir
[moodle.git] / Gruntfile.js
CommitLineData
adeb96d2
DW
1// This file is part of Moodle - http://moodle.org/
2//
3// Moodle is free software: you can redistribute it and/or modify
4// it under the terms of the GNU General Public License as published by
5// the Free Software Foundation, either version 3 of the License, or
6// (at your option) any later version.
7//
8// Moodle is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11// GNU General Public License for more details.
12//
13// You should have received a copy of the GNU General Public License
14// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
0b777a06 15/* jshint node: true, browser: false */
3adb62b7 16/* eslint-env node */
adeb96d2
DW
17
18/**
19 * @copyright 2014 Andrew Nicols
20 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
21 */
22
23/**
24 * Grunt configuration
25 */
26
f59ac416 27/* eslint-env node */
adeb96d2
DW
28module.exports = function(grunt) {
29 var path = require('path'),
e67585f8 30 tasks = {},
30db70ab
DP
31 cwd = process.env.PWD || process.cwd(),
32 async = require('async'),
33 DOMParser = require('xmldom').DOMParser,
d2c7175a 34 xpath = require('xpath'),
38d4f754
RW
35 semver = require('semver'),
36 watchman = require('fb-watchman'),
37 watchmanClient = new watchman.Client(),
38 gruntFilePath = process.cwd();
d2c7175a
DP
39
40 // Verify the node version is new enough.
41 var expected = semver.validRange(grunt.file.readJSON('package.json').engines.node);
42 var actual = semver.valid(process.version);
43 if (!semver.satisfies(actual, expected)) {
fbd1877f 44 grunt.fail.fatal('Node version not satisfied. Require ' + expected + ', version installed: ' + actual);
d2c7175a 45 }
00cceb7f
DP
46
47 // Windows users can't run grunt in a subdirectory, so allow them to set
48 // the root by passing --root=path/to/dir.
49 if (grunt.option('root')) {
50 var root = grunt.option('root');
51 if (grunt.file.exists(__dirname, root)) {
52 cwd = path.join(__dirname, root);
b18478b9 53 grunt.log.ok('Setting root to ' + cwd);
00cceb7f 54 } else {
b18478b9 55 grunt.fail.fatal('Setting root to ' + root + ' failed - path does not exist');
00cceb7f
DP
56 }
57 }
58
38d4f754
RW
59 var files = null;
60 if (grunt.option('files')) {
61 // Accept a comma separated list of files to process.
62 files = grunt.option('files').split(',');
63 }
64
00cceb7f 65 var inAMD = path.basename(cwd) == 'amd';
adeb96d2 66
5cc5f311 67 // Globbing pattern for matching all AMD JS source files.
9ea892d2
AN
68 var amdSrc = [];
69 if (inAMD) {
70 amdSrc.push(cwd + "/src/*.js");
71 amdSrc.push(cwd + "/src/**/*.js");
72 } else {
73 amdSrc.push("**/amd/src/*.js");
74 amdSrc.push("**/amd/src/**/*.js");
75 }
5cc5f311
DP
76
77 /**
78 * Function to generate the destination for the uglify task
79 * (e.g. build/file.min.js). This function will be passed to
80 * the rename property of files array when building dynamically:
81 * http://gruntjs.com/configuring-tasks#building-the-files-object-dynamically
82 *
83 * @param {String} destPath the current destination
84 * @param {String} srcPath the matched src path
85 * @return {String} The rewritten destination path.
86 */
c53f86d4 87 var babelRename = function(destPath, srcPath) {
5cc5f311
DP
88 destPath = srcPath.replace('src', 'build');
89 destPath = destPath.replace('.js', '.min.js');
5cc5f311
DP
90 return destPath;
91 };
92
30db70ab
DP
93 /**
94 * Find thirdpartylibs.xml and generate an array of paths contained within
95 * them (used to generate ignore files and so on).
96 *
97 * @return {array} The list of thirdparty paths.
98 */
99 var getThirdPartyPathsFromXML = function() {
100 var thirdpartyfiles = grunt.file.expand('*/**/thirdpartylibs.xml');
101 var libs = ['node_modules/', 'vendor/'];
102
b18478b9 103 thirdpartyfiles.forEach(function(file) {
30db70ab
DP
104 var dirname = path.dirname(file);
105
106 var doc = new DOMParser().parseFromString(grunt.file.read(file));
107 var nodes = xpath.select("/libraries/library/location/text()", doc);
108
109 nodes.forEach(function(node) {
110 var lib = path.join(dirname, node.toString());
111 if (grunt.file.isDir(lib)) {
112 // Ensure trailing slash on dirs.
113 lib = lib.replace(/\/?$/, '/');
114 }
115
116 // Look for duplicate paths before adding to array.
117 if (libs.indexOf(lib) === -1) {
118 libs.push(lib);
119 }
120 });
121 });
122 return libs;
123 };
124
adeb96d2
DW
125 // Project configuration.
126 grunt.initConfig({
3adb62b7 127 eslint: {
30db70ab
DP
128 // Even though warnings dont stop the build we don't display warnings by default because
129 // at this moment we've got too many core warnings.
037de719 130 options: {quiet: !grunt.option('show-lint-warnings')},
38d4f754 131 amd: {src: files ? files : amdSrc},
be4b3cc6 132 // Check YUI module source files.
38d4f754 133 yui: {src: files ? files : ['**/yui/src/**/*.js', '!*/**/yui/src/*/meta/*.js']}
3adb62b7 134 },
c53f86d4
RW
135 babel: {
136 options: {
137 sourceMaps: true,
138 comments: false,
139 plugins: [
140 'transform-es2015-modules-amd-lazy',
141 // This plugin modifies the Babel transpiling for "export default"
142 // so that if it's used then only the exported value is returned
143 // by the generated AMD module.
144 //
145 // It also adds the Moodle plugin name to the AMD module definition
146 // so that it can be imported as expected in other modules.
147 path.resolve('babel-plugin-add-module-to-define.js'),
148 '@babel/plugin-syntax-dynamic-import',
149 '@babel/plugin-syntax-import-meta',
150 ['@babel/plugin-proposal-class-properties', {'loose': false}],
151 '@babel/plugin-proposal-json-strings'
152 ],
153 presets: [
154 ['minify', {
155 // This minification plugin needs to be disabled because it breaks the
156 // source map generation and causes invalid source maps to be output.
157 simplify: false,
158 builtIns: false
159 }],
160 ['@babel/preset-env', {
161 targets: {
162 browsers: [
163 ">0.25%",
164 "last 2 versions",
165 "not ie <= 10",
166 "not op_mini all",
167 "not Opera > 0",
168 "not dead"
169 ]
170 },
171 modules: false,
172 useBuiltIns: false
173 }]
174 ]
175 },
176 dist: {
5cc5f311
DP
177 files: [{
178 expand: true,
38d4f754 179 src: files ? files : amdSrc,
c53f86d4
RW
180 rename: babelRename
181 }]
adeb96d2 182 }
a4a52e56 183 },
af9edb2e
BB
184 sass: {
185 dist: {
186 files: {
de213bf0
BB
187 "theme/boost/style/moodle.css": "theme/boost/scss/preset/default.scss",
188 "theme/classic/style/moodle.css": "theme/classic/scss/classicgrunt.scss"
af9edb2e
BB
189 }
190 },
191 options: {
de213bf0 192 includePaths: ["theme/boost/scss/", "theme/classic/scss/"]
af9edb2e
BB
193 }
194 },
8efbb7b1
DP
195 watch: {
196 options: {
197 nospawn: true // We need not to spawn so config can be changed dynamically.
198 },
199 amd: {
200 files: ['**/amd/src/**/*.js'],
201 tasks: ['amd']
202 },
38d4f754
RW
203 boost: {
204 files: ['**/theme/boost/scss/**/*.scss'],
205 tasks: ['scss']
206 },
207 rawcss: {
208 files: ['**/*.css', '**/theme/**/!(moodle.css|editor.css)'],
209 tasks: ['rawcss']
210 },
8efbb7b1
DP
211 yui: {
212 files: ['**/yui/src/**/*.js'],
a1587268 213 tasks: ['yui']
8efbb7b1 214 },
d44f7e46
RT
215 gherkinlint: {
216 files: ['**/tests/behat/*.feature'],
217 tasks: ['gherkinlint']
218 }
1aa454ed
DP
219 },
220 shifter: {
221 options: {
222 recursive: true,
38d4f754 223 paths: files ? files : [cwd]
1aa454ed 224 }
855fc5d8 225 },
8b02e2d9
DP
226 gherkinlint: {
227 options: {
38d4f754 228 files: files ? files : ['**/tests/behat/*.feature'],
8b02e2d9
DP
229 }
230 },
855fc5d8 231 stylelint: {
773e68b0 232 scss: {
5142f564 233 options: {syntax: 'scss'},
38d4f754 234 src: files ? files : ['*/**/*.scss']
d5dff631
DP
235 },
236 css: {
38d4f754 237 src: files ? files : ['*/**/*.css'],
d5dff631
DP
238 options: {
239 configOverrides: {
240 rules: {
241 // These rules have to be disabled in .stylelintrc for scss compat.
242 "at-rule-no-unknown": true,
d5dff631
DP
243 }
244 }
245 }
855fc5d8 246 }
adeb96d2
DW
247 }
248 });
249
30db70ab
DP
250 /**
251 * Generate ignore files (utilising thirdpartylibs.xml data)
252 */
253 tasks.ignorefiles = function() {
f8731225
DP
254 // An array of paths to third party directories.
255 var thirdPartyPaths = getThirdPartyPathsFromXML();
30db70ab
DP
256 // Generate .eslintignore.
257 var eslintIgnores = ['# Generated by "grunt ignorefiles"', '*/**/yui/src/*/meta/', '*/**/build/'].concat(thirdPartyPaths);
258 grunt.file.write('.eslintignore', eslintIgnores.join('\n'));
a26d3673 259 // Generate .stylelintignore.
36650f11
DP
260 var stylelintIgnores = [
261 '# Generated by "grunt ignorefiles"',
3951d50a 262 '**/yui/build/*',
de213bf0
BB
263 'theme/boost/style/moodle.css',
264 'theme/classic/style/moodle.css',
36650f11 265 ].concat(thirdPartyPaths);
a26d3673 266 grunt.file.write('.stylelintignore', stylelintIgnores.join('\n'));
30db70ab
DP
267 };
268
1aa454ed
DP
269 /**
270 * Shifter task. Is configured with a path to a specific file or a directory,
271 * in the case of a specific file it will work out the right module to be built.
272 *
273 * Note that this task runs the invidiaul shifter jobs async (becase it spawns
274 * so be careful to to call done().
275 */
adeb96d2 276 tasks.shifter = function() {
30db70ab 277 var done = this.async(),
1aa454ed 278 options = grunt.config('shifter.options');
adeb96d2 279
1aa454ed 280 // Run the shifter processes one at a time to avoid confusing output.
b18478b9 281 async.eachSeries(options.paths, function(src, filedone) {
1aa454ed 282 var args = [];
b18478b9 283 args.push(path.normalize(__dirname + '/node_modules/shifter/bin/shifter'));
e67585f8 284
1aa454ed
DP
285 // Always ignore the node_modules directory.
286 args.push('--excludes', 'node_modules');
287
adeb96d2 288 // Determine the most appropriate options to run with based upon the current location.
1aa454ed
DP
289 if (grunt.file.isMatch('**/yui/**/*.js', src)) {
290 // When passed a JS file, build our containing module (this happen with
291 // watch).
292 grunt.log.debug('Shifter passed a specific JS file');
293 src = path.dirname(path.dirname(src));
294 options.recursive = false;
295 } else if (grunt.file.isMatch('**/yui/src', src)) {
296 // When in a src directory --walk all modules.
adeb96d2
DW
297 grunt.log.debug('In a src directory');
298 args.push('--walk');
1aa454ed
DP
299 options.recursive = false;
300 } else if (grunt.file.isMatch('**/yui/src/*', src)) {
301 // When in module, only build our module.
adeb96d2 302 grunt.log.debug('In a module directory');
adeb96d2 303 options.recursive = false;
1aa454ed
DP
304 } else if (grunt.file.isMatch('**/yui/src/*/js', src)) {
305 // When in module src, only build our module.
306 grunt.log.debug('In a source directory');
307 src = path.dirname(src);
308 options.recursive = false;
adeb96d2
DW
309 }
310
1aa454ed
DP
311 if (grunt.option('watch')) {
312 grunt.fail.fatal('The --watch option has been removed, please use `grunt watch` instead');
adeb96d2
DW
313 }
314
adeb96d2
DW
315 // Add the stderr option if appropriate
316 if (grunt.option('verbose')) {
317 args.push('--lint-stderr');
318 }
319
a07afffc
DP
320 if (grunt.option('no-color')) {
321 args.push('--color=false');
322 }
323
8f76bfb6
DM
324 var execShifter = function() {
325
1aa454ed
DP
326 grunt.log.ok("Running shifter on " + src);
327 grunt.util.spawn({
328 cmd: "node",
329 args: args,
330 opts: {cwd: src, stdio: 'inherit', env: process.env}
b18478b9 331 }, function(error, result, code) {
8f76bfb6
DM
332 if (code) {
333 grunt.fail.fatal('Shifter failed with code: ' + code);
334 } else {
335 grunt.log.ok('Shifter build complete.');
1aa454ed 336 filedone();
8f76bfb6
DM
337 }
338 });
339 };
340
adeb96d2 341 // Actually run shifter.
8f76bfb6
DM
342 if (!options.recursive) {
343 execShifter();
344 } else {
345 // Check that there are yui modules otherwise shifter ends with exit code 1.
1aa454ed
DP
346 if (grunt.file.expand({cwd: src}, '**/yui/src/**/*.js').length > 0) {
347 args.push('--recursive');
348 execShifter();
349 } else {
350 grunt.log.ok('No YUI modules to build.');
351 filedone();
352 }
8f76bfb6 353 }
1aa454ed 354 }, done);
adeb96d2
DW
355 };
356
8b02e2d9
DP
357 tasks.gherkinlint = function() {
358 var done = this.async(),
359 options = grunt.config('gherkinlint.options');
360
361 var args = grunt.file.expand(options.files);
362 args.unshift(path.normalize(__dirname + '/node_modules/.bin/gherkin-lint'));
363 grunt.util.spawn({
364 cmd: 'node',
365 args: args,
366 opts: {stdio: 'inherit', env: process.env}
367 }, function(error, result, code) {
368 // Propagate the exit code.
58923606 369 done(code === 0);
8b02e2d9
DP
370 });
371 };
372
adeb96d2
DW
373 tasks.startup = function() {
374 // Are we in a YUI directory?
e67585f8 375 if (path.basename(path.resolve(cwd, '../../')) == 'yui') {
a1587268 376 grunt.task.run('yui');
adeb96d2 377 // Are we in an AMD directory?
c9b6feea 378 } else if (inAMD) {
65d070ae 379 grunt.task.run('amd');
adeb96d2
DW
380 } else {
381 // Run them all!.
65d070ae
DP
382 grunt.task.run('css');
383 grunt.task.run('js');
d44f7e46 384 grunt.task.run('gherkinlint');
adeb96d2
DW
385 }
386 };
387
38d4f754
RW
388 /**
389 * This is a wrapper task to handle the grunt watch command. It attempts to use
390 * Watchman to monitor for file changes, if it's installed, because it's much faster.
391 *
392 * If Watchman isn't installed then it falls back to the grunt-contrib-watch file
393 * watcher for backwards compatibility.
394 */
395 tasks.watch = function() {
396 var watchTaskDone = this.async();
397 var watchInitialised = false;
398 var watchTaskQueue = {};
399 var processingQueue = false;
400
401 // Grab the tasks and files that have been queued up and execute them.
402 var processWatchTaskQueue = function() {
403 if (!Object.keys(watchTaskQueue).length || processingQueue) {
404 // If there is nothing in the queue or we're already processing then wait.
405 return;
406 }
407
408 processingQueue = true;
409
410 // Grab all tasks currently in the queue.
411 var queueToProcess = watchTaskQueue;
412 // Reset the queue.
413 watchTaskQueue = {};
414
415 async.forEachSeries(
416 Object.keys(queueToProcess),
417 function(task, next) {
418 var files = queueToProcess[task];
419 var filesOption = '--files=' + files.join(',');
420 grunt.log.ok('Running task ' + task + ' for files ' + filesOption);
421
422 // Spawn the task in a child process so that it doesn't kill this one
423 // if it failed.
424 grunt.util.spawn(
425 {
426 // Spawn with the grunt bin.
427 grunt: true,
428 // Run from current working dir and inherit stdio from process.
429 opts: {
430 cwd: cwd,
431 stdio: 'inherit'
432 },
433 args: [task, filesOption]
434 },
435 function(err, res, code) {
436 if (code !== 0) {
437 // The grunt task failed.
438 grunt.log.error(err);
439 }
440
441 // Move on to the next task.
442 next();
443 }
444 );
445 },
446 function() {
447 // No longer processing.
448 processingQueue = false;
449 // Once all of the tasks are done then recurse just in case more tasks
450 // were queued while we were processing.
451 processWatchTaskQueue();
452 }
453 );
454 };
455
456 var watchConfig = grunt.config.get(['watch']);
457 watchConfig = Object.keys(watchConfig).reduce(function(carry, key) {
458 if (key == 'options') {
459 return carry;
460 }
461
462 var value = watchConfig[key];
463 var fileGlobs = value.files;
464 var taskNames = value.tasks;
465
466 taskNames.forEach(function(taskName) {
467 carry[taskName] = fileGlobs;
468 });
469
470 return carry;
471 }, {});
472
473 watchmanClient.on('error', function(error) {
474 // We have to add an error handler here and parse the error string because the
475 // example way from the docs to check if Watchman is installed doesn't actually work!!
476 // See: https://github.com/facebook/watchman/issues/509
477 if (error.message.match('Watchman was not found')) {
478 // If watchman isn't installed then we should fallback to the other watch task.
479 grunt.log.ok('It is recommended that you install Watchman for better performance using the "watch" command.');
480
481 // Fallback to the old grunt-contrib-watch task.
482 grunt.renameTask('watch-grunt', 'watch');
483 grunt.task.run(['watch']);
484 // This task is finished.
485 watchTaskDone(0);
486 } else {
487 grunt.log.error(error);
488 // Fatal error.
489 watchTaskDone(1);
490 }
491 });
492
493 watchmanClient.on('subscription', function(resp) {
494 if (resp.subscription !== 'grunt-watch') {
495 return;
496 }
497
498 resp.files.forEach(function(file) {
499 grunt.log.ok('File changed: ' + file.name);
500
501 var fullPath = cwd + '/' + file.name;
502 Object.keys(watchConfig).forEach(function(task) {
503 var fileGlobs = watchConfig[task];
504 var match = fileGlobs.every(function(fileGlob) {
505 return grunt.file.isMatch(fileGlob, fullPath);
506 });
507 if (match) {
508 // If we are watching a subdirectory then the file.name will be relative
509 // to that directory. However the grunt tasks expect the file paths to be
510 // relative to the Gruntfile.js location so let's normalise them before
511 // adding them to the queue.
512 var relativePath = fullPath.replace(gruntFilePath + '/', '');
513 if (task in watchTaskQueue) {
514 if (!watchTaskQueue[task].includes(relativePath)) {
515 watchTaskQueue[task] = watchTaskQueue[task].concat(relativePath);
516 }
517 } else {
518 watchTaskQueue[task] = [relativePath];
519 }
520 }
521 });
522 });
523
524 processWatchTaskQueue();
525 });
526
527 process.on('SIGINT', function() {
528 // Let the user know that they may need to manually stop the Watchman daemon if they
529 // no longer want it running.
530 if (watchInitialised) {
531 grunt.log.ok('The Watchman daemon may still be running and may need to be stopped manually.');
532 }
533
534 process.exit();
535 });
536
537 // Initiate the watch on the current directory.
538 watchmanClient.command(['watch-project', cwd], function(watchError, watchResponse) {
539 if (watchError) {
540 grunt.log.error('Error initiating watch:', watchError);
541 watchTaskDone(1);
542 return;
543 }
544
545 if ('warning' in watchResponse) {
546 grunt.log.error('warning: ', watchResponse.warning);
547 }
548
549 var watch = watchResponse.watch;
550 var relativePath = watchResponse.relative_path;
551 watchInitialised = true;
552
553 watchmanClient.command(['clock', watch], function(clockError, clockResponse) {
554 if (clockError) {
555 grunt.log.error('Failed to query clock:', clockError);
556 watchTaskDone(1);
557 return;
558 }
559
560 // Use the matching patterns specified in the watch config.
561 var matches = Object.keys(watchConfig).map(function(task) {
562 var fileGlobs = watchConfig[task];
563 var fileGlobMatches = fileGlobs.map(function(fileGlob) {
564 return ['match', fileGlob, 'wholename'];
565 });
566
567 return ['allof'].concat(fileGlobMatches);
568 });
569
570 var sub = {
571 expression: ["anyof"].concat(matches),
572 // Which fields we're interested in.
573 fields: ["name", "size", "type"],
574 // Add our time constraint.
575 since: clockResponse.clock
576 };
577
578 if (relativePath) {
579 sub.relative_root = relativePath;
580 }
581
582 watchmanClient.command(['subscribe', watch, 'grunt-watch', sub], function(subscribeError) {
583 if (subscribeError) {
584 // Probably an error in the subscription criteria.
585 grunt.log.error('failed to subscribe: ', subscribeError);
586 watchTaskDone(1);
587 return;
588 }
589
590 grunt.log.ok('Listening for changes to files in ' + cwd);
591 });
592 });
593 });
594 };
595
1aa454ed
DP
596 // On watch, we dynamically modify config to build only affected files. This
597 // method is slightly complicated to deal with multiple changed files at once (copied
598 // from the grunt-contrib-watch readme).
599 var changedFiles = Object.create(null);
600 var onChange = grunt.util._.debounce(function() {
38d4f754
RW
601 var files = Object.keys(changedFiles);
602 grunt.config('eslint.amd.src', files);
603 grunt.config('eslint.yui.src', files);
604 grunt.config('shifter.options.paths', files);
605 grunt.config('gherkinlint.options.files', files);
606 grunt.config('babel.dist.files', [{expand: true, src: files, rename: babelRename}]);
607 changedFiles = Object.create(null);
1aa454ed 608 }, 200);
adeb96d2 609
8efbb7b1 610 grunt.event.on('watch', function(action, filepath) {
38d4f754
RW
611 changedFiles[filepath] = action;
612 onChange();
8efbb7b1
DP
613 });
614
adeb96d2
DW
615 // Register NPM tasks.
616 grunt.loadNpmTasks('grunt-contrib-uglify');
8efbb7b1 617 grunt.loadNpmTasks('grunt-contrib-watch');
af9edb2e 618 grunt.loadNpmTasks('grunt-sass');
3adb62b7 619 grunt.loadNpmTasks('grunt-eslint');
855fc5d8 620 grunt.loadNpmTasks('grunt-stylelint');
c53f86d4 621 grunt.loadNpmTasks('grunt-babel');
adeb96d2 622
38d4f754
RW
623 // Rename the grunt-contrib-watch "watch" task because we're going to wrap it.
624 grunt.renameTask('watch', 'watch-grunt');
625
65d070ae 626 // Register JS tasks.
adeb96d2 627 grunt.registerTask('shifter', 'Run Shifter against the current directory', tasks.shifter);
8b02e2d9 628 grunt.registerTask('gherkinlint', 'Run gherkinlint against the current directory', tasks.gherkinlint);
30db70ab 629 grunt.registerTask('ignorefiles', 'Generate ignore files for linters', tasks.ignorefiles);
38d4f754 630 grunt.registerTask('watch', 'Run tasks on file changes', tasks.watch);
a1587268 631 grunt.registerTask('yui', ['eslint:yui', 'shifter']);
c53f86d4 632 grunt.registerTask('amd', ['eslint:amd', 'babel']);
a1587268 633 grunt.registerTask('js', ['amd', 'yui']);
65d070ae
DP
634
635 // Register CSS taks.
cf89ac3d 636 grunt.registerTask('css', ['stylelint:scss', 'sass', 'stylelint:css']);
38d4f754
RW
637 grunt.registerTask('scss', ['stylelint:scss', 'sass']);
638 grunt.registerTask('rawcss', ['stylelint:css']);
adeb96d2
DW
639
640 // Register the startup task.
641 grunt.registerTask('startup', 'Run the correct tasks for the current directory', tasks.startup);
642
643 // Register the default task.
644 grunt.registerTask('default', ['startup']);
645};