Skip to content

Commit

Permalink
Require Node.js 8 and Grunt 1
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed May 29, 2019
1 parent a672f19 commit 468aec3
Show file tree
Hide file tree
Showing 12 changed files with 201 additions and 196 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Expand Up @@ -7,6 +7,6 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[{package.json,*.yml}]
[*.yml]
indent_style = space
indent_size = 2
2 changes: 1 addition & 1 deletion .gitattributes
@@ -1 +1 @@
* text=auto
* text=auto eol=lf
1 change: 1 addition & 0 deletions .gitignore
@@ -1,2 +1,3 @@
node_modules
yarn.lock
test/tmp
1 change: 1 addition & 0 deletions .npmrc
@@ -0,0 +1 @@
package-lock=false
8 changes: 3 additions & 5 deletions .travis.yml
@@ -1,7 +1,5 @@
sudo: false
language: node_js
node_js:
- '5'
- '4'
- '0.12'
- '0.10'
- '12'
- '10'
- '8'
75 changes: 49 additions & 26 deletions gruntfile.js
@@ -1,19 +1,36 @@
'use strict';
var supportsColor = require('supports-color');
const supportsColor = require('supports-color');

module.exports = function (grunt) {
module.exports = grunt => {
grunt.initConfig({
concurrent: {
test: ['test1', 'test2', 'test3'],
testSequence: ['test4', ['test5', 'test6']],
testargs: ['testargs1', 'testargs2'],
test: [
'test1',
'test2',
'test3'
],
testSequence: [
'test4', [
'test5',
'test6'
]
],
testargs: [
'testargs1',
'testargs2'
],
log: {
options: {
logConcurrentOutput: true
},
tasks: ['nodemon', 'watch']
tasks: [
'nodemon',
'watch'
]
},
colors: ['colorcheck']
colors: [
'colorcheck'
]
},
simplemocha: {
test: {
Expand All @@ -24,12 +41,18 @@ module.exports = function (grunt) {
}
},
clean: {
test: ['test/tmp']
test: [
'test/tmp'
]
},
watch: {
scripts: {
files: ['tasks/*.js'],
tasks: ['default']
files: [
'tasks/*.js'
],
tasks: [
'default'
]
}
},
nodemon: {
Expand All @@ -47,54 +70,54 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-simple-mocha');
grunt.loadNpmTasks('grunt-nodemon');

grunt.registerTask('test1', function () {
grunt.registerTask('test1', () => {
console.log('test1');
grunt.file.write('test/tmp/1');
});

grunt.registerTask('test2', function () {
var cb = this.async();
setTimeout(function () {
const cb = this.async();
setTimeout(() => {
console.log('test2');
grunt.file.write('test/tmp/2');
cb();
}, 1000);
});

grunt.registerTask('test3', function () {
grunt.registerTask('test3', () => {
console.log('test3');
grunt.file.write('test/tmp/3');
});

grunt.registerTask('test4', function () {
grunt.registerTask('test4', () => {
console.log('test4');
grunt.file.write('test/tmp/4');
});

grunt.registerTask('test5', function () {
grunt.registerTask('test5', () => {
console.log('test5');
grunt.file.write('test/tmp/5');
sleep(1000);
});

grunt.registerTask('test6', function () {
grunt.registerTask('test6', () => {
console.log('test6');
grunt.file.write('test/tmp/6');
});

grunt.registerTask('testargs1', function () {
var args = grunt.option.flags().join();
grunt.registerTask('testargs1', () => {
const args = grunt.option.flags().join();
grunt.file.write('test/tmp/args1', args);
});

grunt.registerTask('testargs2', function () {
var args = grunt.option.flags().join();
grunt.registerTask('testargs2', () => {
const args = grunt.option.flags().join();
grunt.file.write('test/tmp/args2', args);
});

grunt.registerTask('colorcheck', function () {
// writes 'true' or 'false' to the file
var supports = String(Boolean(supportsColor));
grunt.registerTask('colorcheck', () => {
// Writes 'true' or 'false' to the file
const supports = String(Boolean(supportsColor.stdout));
grunt.file.write('test/tmp/colors', supports);
});

Expand All @@ -108,8 +131,8 @@ module.exports = function (grunt) {
};

function sleep(milliseconds) {
var start = new Date().getTime();
for (var i = 0; i < 1e7; i++) {
const start = new Date().getTime();
for (let i = 0; i < 1e7; i++) {
if ((new Date().getTime() - start) > milliseconds) {
break;
}
Expand Down
20 changes: 4 additions & 16 deletions license
@@ -1,21 +1,9 @@
The MIT License (MIT)
MIT License

Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
106 changes: 53 additions & 53 deletions package.json
@@ -1,55 +1,55 @@
{
"name": "grunt-concurrent",
"version": "2.3.1",
"description": "Run grunt tasks concurrently",
"keywords": [
"gruntplugin",
"concurrent",
"parallel",
"simultaneous",
"optimize",
"speed",
"perf",
"performance",
"fast",
"faster"
],
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"repository": "sindresorhus/grunt-concurrent",
"scripts": {
"test": "xo && grunt"
},
"files": [
"tasks"
],
"engines": {
"node": ">=0.10.0"
},
"license": "MIT",
"dependencies": {
"arrify": "^1.0.1",
"async": "^1.2.1",
"indent-string": "^2.0.0",
"pad-stream": "^1.0.0"
},
"devDependencies": {
"cross-spawn": "^2.0.0",
"grunt": "^0.4.5",
"grunt-cli": "^0.1.13",
"grunt-contrib-clean": "^0.7.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-nodemon": "^0.4.0",
"grunt-simple-mocha": "^0.4.0",
"nodemon": "^1.2.1",
"path-exists": "^2.0.0",
"supports-color": "^3.1.2",
"xo": "*"
},
"peerDependencies": {
"grunt": ">=0.4.0"
}
"name": "grunt-concurrent",
"version": "2.3.1",
"description": "Run grunt tasks concurrently",
"license": "MIT",
"repository": "sindresorhus/grunt-concurrent",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=8"
},
"scripts": {
"test": "xo && grunt"
},
"files": [
"tasks"
],
"keywords": [
"gruntplugin",
"concurrent",
"parallel",
"simultaneous",
"optimize",
"speed",
"perf",
"performance",
"fast",
"faster"
],
"dependencies": {
"arrify": "^2.0.1",
"async": "^3.0.1",
"indent-string": "^4.0.0",
"pad-stream": "^2.0.0"
},
"devDependencies": {
"cross-spawn": "^6.0.5",
"grunt": "^1.0.4",
"grunt-cli": "^1.3.2",
"grunt-contrib-clean": "^2.0.0",
"grunt-contrib-watch": "^1.1.0",
"grunt-nodemon": "^0.4.0",
"grunt-simple-mocha": "^0.4.0",
"nodemon": "^1.2.1",
"path-exists": "^4.0.0",
"supports-color": "^6.1.0",
"xo": "^0.24.0"
},
"peerDependencies": {
"grunt": ">=1"
}
}
17 changes: 3 additions & 14 deletions readme.md
Expand Up @@ -2,12 +2,6 @@

> Run grunt tasks concurrently
---

<p align="center"><b>🔥 Want to strengthen your core JavaScript skills and master ES6?</b><br>I would personally recommend this awesome <a href="https://ES6.io/friend/AWESOME">ES6 course</a> by Wes Bos.</p>

---

<img src="screenshot.png" width="439">

Running slow tasks like Coffee and Sass concurrently can potentially improve your build time significantly. This task is also useful if you need to run [multiple blocking tasks](#logconcurrentoutput) like `nodemon` and `watch` at once.
Expand All @@ -23,7 +17,7 @@ $ npm install --save-dev grunt-concurrent
## Usage

```js
require('load-grunt-tasks')(grunt); // npm install --save-dev load-grunt-tasks
require('load-grunt-tasks')(grunt);

grunt.initConfig({
concurrent: {
Expand All @@ -32,8 +26,7 @@ grunt.initConfig({
}
});

// tasks of target1 run concurrently, after they all finished, tasks of target2 run concurrently,
// instead of target1 and target2 run concurrently.
// Tasks of target1 run concurrently, after they all finished, tasks of target2 run concurrently, instead of target1 and target2 running concurrently.
grunt.registerTask('default', ['concurrent:target1', 'concurrent:target2']);
```

Expand All @@ -46,6 +39,7 @@ grunt.initConfig({
}
});
```

Now `jshint` will always be done before `coffee` and `sass` runs independent of both of them.


Expand Down Expand Up @@ -82,8 +76,3 @@ grunt.registerTask('default', ['concurrent:target']);
```

*The output will be messy when combining certain tasks. This option is best used with tasks that don't exit like `watch` and `nodemon` to monitor the output of long-running concurrent tasks.*


## License

MIT © [Sindre Sorhus](http://sindresorhus.com)

0 comments on commit 468aec3

Please sign in to comment.