pax_global_header00006660000000000000000000000064132741105560014516gustar00rootroot0000000000000052 comment=73a8298e80a73679afb0ecdc0d868608e2b47fe2 load-grunt-tasks-4.0.0/000077500000000000000000000000001327411055600147165ustar00rootroot00000000000000load-grunt-tasks-4.0.0/.editorconfig000066400000000000000000000002571327411055600173770ustar00rootroot00000000000000root = true [*] indent_style = tab end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [*.yml] indent_style = space indent_size = 2 load-grunt-tasks-4.0.0/.gitattributes000066400000000000000000000000351327411055600176070ustar00rootroot00000000000000* text=auto *.js text eol=lf load-grunt-tasks-4.0.0/.gitignore000066400000000000000000000000271327411055600167050ustar00rootroot00000000000000node_modules yarn.lock load-grunt-tasks-4.0.0/.npmrc000066400000000000000000000000231327411055600160310ustar00rootroot00000000000000package-lock=false load-grunt-tasks-4.0.0/.travis.yml000066400000000000000000000000641327411055600170270ustar00rootroot00000000000000language: node_js node_js: - '10' - '8' - '6' load-grunt-tasks-4.0.0/gruntfile.js000066400000000000000000000004311327411055600172510ustar00rootroot00000000000000'use strict'; module.exports = grunt => { require('.')(grunt, { pattern: ['grunt*'], config: require('./package'), scope: 'devDependencies', requireResolution: true }); grunt.initConfig({ svgmin: { noop: {} } }); grunt.registerTask('default', ['svgmin']); }; load-grunt-tasks-4.0.0/index.js000066400000000000000000000022661327411055600163710ustar00rootroot00000000000000'use strict'; const path = require('path'); const pkgUp = require('pkg-up'); const multimatch = require('multimatch'); const arrify = require('arrify'); const resolvePkg = require('resolve-pkg'); module.exports = (grunt, options = {}) => { const pattern = arrify(options.pattern || ['grunt-*', '@*/grunt-*']); const scope = arrify(options.scope || ['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies']); let cwd = process.cwd(); let config = options.config || pkgUp.sync(); if (typeof config === 'string') { const configPath = path.resolve(config); cwd = path.dirname(configPath); config = require(configPath); } pattern.push('!grunt', '!grunt-cli'); const names = scope.reduce((result, prop) => { const deps = config[prop] || []; return result.concat(Array.isArray(deps) ? deps : Object.keys(deps)); }, []); for (const packageName of multimatch(names, pattern)) { if (options.requireResolution === true) { try { grunt.loadTasks(resolvePkg(path.join(packageName, 'tasks'), {cwd})); } catch (err) { grunt.log.error(`npm package \`${packageName}\` not found. Is it installed?`); } } else { grunt.loadNpmTasks(packageName); } } }; load-grunt-tasks-4.0.0/license000066400000000000000000000021251327411055600162630ustar00rootroot00000000000000MIT License Copyright (c) Sindre Sorhus (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: 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. load-grunt-tasks-4.0.0/package.json000066400000000000000000000014471327411055600172120ustar00rootroot00000000000000{ "name": "load-grunt-tasks", "version": "4.0.0", "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" } } load-grunt-tasks-4.0.0/readme.md000066400000000000000000000070421327411055600165000ustar00rootroot00000000000000# load-grunt-tasks [![Build Status](https://travis-ci.org/sindresorhus/load-grunt-tasks.svg?branch=master)](https://travis-ci.org/sindresorhus/load-grunt-tasks) > Load multiple grunt tasks using globbing patterns ---

🔥 Want to strengthen your core JavaScript skills and master ES6?
I would personally recommend this awesome ES6 course by Wes Bos.

--- Usually you would have to load each task one by one, which is unnecessarily cumbersome. This module will read the `dependencies`/`devDependencies`/`peerDependencies`/`optionalDependencies` in your package.json and load grunt tasks that match the provided patterns. #### Before ```js grunt.loadNpmTasks('grunt-shell'); grunt.loadNpmTasks('grunt-sass'); grunt.loadNpmTasks('grunt-recess'); grunt.loadNpmTasks('grunt-sizediff'); grunt.loadNpmTasks('grunt-svgmin'); grunt.loadNpmTasks('grunt-styl'); grunt.loadNpmTasks('grunt-php'); grunt.loadNpmTasks('grunt-eslint'); grunt.loadNpmTasks('grunt-concurrent'); grunt.loadNpmTasks('grunt-bower-requirejs'); ``` #### After ```js require('load-grunt-tasks')(grunt); ``` ## Install ``` $ npm install --save-dev load-grunt-tasks ``` ## Usage ```js // Gruntfile.js module.exports = grunt => { // Load all grunt tasks matching the ['grunt-*', '@*/grunt-*'] patterns require('load-grunt-tasks')(grunt); grunt.initConfig({}); grunt.registerTask('default', []); }; ``` ## Examples ### Load all grunt tasks ```js require('load-grunt-tasks')(grunt); ``` Equivalent to: ```js require('load-grunt-tasks')(grunt, {pattern: ['grunt-*', '@*/grunt-*']}); ``` ### Load all grunt-contrib tasks ```js require('load-grunt-tasks')(grunt, {pattern: 'grunt-contrib-*'}); ``` ### Load all grunt-contrib tasks and another non-contrib task ```js require('load-grunt-tasks')(grunt, {pattern: ['grunt-contrib-*', 'grunt-shell']}); ``` ### Load all grunt-contrib tasks excluding one You can exclude tasks using the negate `!` globbing pattern: ```js require('load-grunt-tasks')(grunt, {pattern: ['grunt-contrib-*', '!grunt-contrib-coffee']}); ``` ### Set custom path to package.json ```js require('load-grunt-tasks')(grunt, {config: '../package'}); ``` ### Only load from `devDependencies` ```js require('load-grunt-tasks')(grunt, {scope: 'devDependencies'}); ``` ### Only load from `devDependencies` and `dependencies` ```js require('load-grunt-tasks')(grunt, {scope: ['devDependencies', 'dependencies']}); ``` ### All options in use ```js require('load-grunt-tasks')(grunt, { pattern: 'grunt-contrib-*', config: '../package.json', scope: 'devDependencies', requireResolution: true }); ``` ## Options ### pattern Type: `string`, `Array`
Default: `['grunt-*', '@*/grunt-*']` ([globbing pattern](https://github.com/isaacs/minimatch)) ### config Type: `string`, `Object`
Default: Path to nearest package.json ### scope Type: `string`, `Array`
Default: `['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies']`
Values: `'dependencies'`, `'devDependencies'`, `'peerDependencies'`, `'optionalDependencies'`, `'bundledDependencies'` ### requireResolution Type: `boolean`
Default: `false` Traverse up the file hierarchy looking for dependencies like `require()`, rather than the default grunt-like behavior of loading tasks only in the immediate `node_modules` directory. ## License MIT © [Sindre Sorhus](https://sindresorhus.com)