Skip to content

Commit

Permalink
Require Node.js 6 and bump dependencies
Browse files Browse the repository at this point in the history
Closes #56
  • Loading branch information
sindresorhus committed May 7, 2018
1 parent 626fe3b commit e6797ad
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 92 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
1 change: 1 addition & 0 deletions .gitattributes
@@ -1 +1,2 @@
* text=auto
*.js text eol=lf
1 change: 1 addition & 0 deletions .gitignore
@@ -1 +1,2 @@
node_modules
yarn.lock
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'
- '10'
- '8'
- '6'
4 changes: 2 additions & 2 deletions gruntfile.js
@@ -1,6 +1,6 @@
'use strict';
module.exports = function (grunt) {
require('./')(grunt, {
module.exports = grunt => {
require('.')(grunt, {
pattern: ['grunt*'],
config: require('./package'),
scope: 'devDependencies',
Expand Down
36 changes: 17 additions & 19 deletions index.js
@@ -1,37 +1,35 @@
'use strict';
var path = require('path');
var pkgUp = require('pkg-up');
var multimatch = require('multimatch');
var arrify = require('arrify');
var resolvePkg = require('resolve-pkg');
const path = require('path');
const pkgUp = require('pkg-up');
const multimatch = require('multimatch');
const arrify = require('arrify');
const resolvePkg = require('resolve-pkg');

module.exports = function (grunt, opts) {
opts = opts || {};

var pattern = arrify(opts.pattern || ['grunt-*', '@*/grunt-*']);
var config = opts.config || pkgUp.sync();
var scope = arrify(opts.scope || ['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies']);
module.exports = (grunt, options = {}) => {
const pattern = arrify(options.pattern || ['grunt-*', '@*/grunt-*']);
const scope = arrify(options.scope || ['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies']);
let config = options.config || pkgUp.sync();

if (typeof config === 'string') {
config = require(path.resolve(config));
}

pattern.push('!grunt', '!grunt-cli');

var names = scope.reduce(function (result, prop) {
var deps = config[prop] || [];
const names = scope.reduce((result, prop) => {
const deps = config[prop] || [];
return result.concat(Array.isArray(deps) ? deps : Object.keys(deps));
}, []);

multimatch(names, pattern).forEach(function (pkgName) {
if (opts.requireResolution === true) {
for (const packageName of multimatch(names, pattern)) {
if (options.requireResolution === true) {
try {
grunt.loadTasks(resolvePkg(path.join(pkgName, 'tasks')));
grunt.loadTasks(resolvePkg(path.join(packageName, 'tasks')));
} catch (err) {
grunt.log.error('npm package "' + pkgName + '" not found. Is it installed?');
grunt.log.error(`npm package \`${packageName}\` not found. Is it installed?`);
}
} else {
grunt.loadNpmTasks(pkgName);
grunt.loadNpmTasks(packageName);
}
});
}
};
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.
90 changes: 45 additions & 45 deletions package.json
@@ -1,47 +1,47 @@
{
"name": "load-grunt-tasks",
"version": "3.5.2",
"description": "Load multiple grunt tasks using globbing patterns",
"keywords": [
"dependencies",
"glob",
"grunt",
"load",
"match",
"matchdep",
"pattern",
"require",
"tasks"
],
"license": "MIT",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"files": [
"index.js"
],
"repository": "sindresorhus/load-grunt-tasks",
"scripts": {
"test": "xo && grunt"
},
"engines": {
"node": ">=0.10.0"
},
"dependencies": {
"arrify": "^1.0.0",
"multimatch": "^2.0.0",
"pkg-up": "^1.0.0",
"resolve-pkg": "^0.1.0"
},
"devDependencies": {
"grunt": "^1.0.1",
"grunt-cli": "^1.2.0",
"grunt-svgmin": "^3.1.0",
"xo": "*"
},
"peerDependencies": {
"grunt": ">=0.4.0"
}
"name": "load-grunt-tasks",
"version": "3.5.2",
"description": "Load multiple grunt tasks using globbing patterns",
"license": "MIT",
"repository": "sindresorhus/load-grunt-tasks",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=6"
},
"scripts": {
"test": "xo && grunt"
},
"files": [
"index.js"
],
"keywords": [
"dependencies",
"glob",
"grunt",
"load",
"match",
"matchdep",
"pattern",
"require",
"tasks"
],
"dependencies": {
"arrify": "^1.0.0",
"multimatch": "^2.0.0",
"pkg-up": "^2.0.0",
"resolve-pkg": "^1.0.0"
},
"devDependencies": {
"grunt": "^1.0.1",
"grunt-cli": "^1.2.0",
"grunt-svgmin": "^5.0.0",
"xo": "*"
},
"peerDependencies": {
"grunt": ">=1"
}
}
12 changes: 8 additions & 4 deletions readme.md
Expand Up @@ -40,13 +40,17 @@ require('load-grunt-tasks')(grunt);
$ npm install --save-dev load-grunt-tasks
```

<a href="https://www.patreon.com/sindresorhus">
<img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" width="160">
</a>


## Usage

```js
// Gruntfile.js
module.exports = grunt => {
// load all grunt tasks matching the ['grunt-*', '@*/grunt-*'] patterns
// Load all grunt tasks matching the ['grunt-*', '@*/grunt-*'] patterns
require('load-grunt-tasks')(grunt);

grunt.initConfig({});
Expand Down Expand Up @@ -123,17 +127,17 @@ require('load-grunt-tasks')(grunt, {

### pattern

Type: `string`, `array`<br>
Type: `string`, `Array`<br>
Default: `['grunt-*', '@*/grunt-*']` ([globbing pattern](https://github.com/isaacs/minimatch))

### config

Type: `string`, `object`<br>
Type: `string`, `Object`<br>
Default: Path to nearest package.json

### scope

Type: `string`, `array`<br>
Type: `string`, `Array`<br>
Default: `['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies']`<br>
Values: `'dependencies'`, `'devDependencies'`, `'peerDependencies'`, `'optionalDependencies'`, `'bundledDependencies'`

Expand Down

0 comments on commit e6797ad

Please sign in to comment.