From 70903c1ecc9eb705918ff28cf676098b57efdf87 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Sun, 20 Mar 2022 01:02:29 +0700 Subject: [PATCH] Require Node.js 12 --- .github/funding.yml | 4 ---- .github/workflows/main.yml | 6 ++---- license | 2 +- package.json | 9 +++++---- readme.md | 24 ++++++++++-------------- tasks/shell.js | 6 +++--- 6 files changed, 21 insertions(+), 30 deletions(-) delete mode 100644 .github/funding.yml diff --git a/.github/funding.yml b/.github/funding.yml deleted file mode 100644 index 15edf6e..0000000 --- a/.github/funding.yml +++ /dev/null @@ -1,4 +0,0 @@ -github: sindresorhus -open_collective: sindresorhus -patreon: sindresorhus -custom: https://sindresorhus.com/donate diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b85fc2a..3b8aa86 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,14 +10,12 @@ jobs: fail-fast: false matrix: node-version: + - 16 - 14 - 12 - - 10 - - 8 - - 6 steps: - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/setup-node@v2 with: node-version: ${{ matrix.node-version }} - run: npm install diff --git a/license b/license index e7af2f7..fa7ceba 100644 --- a/license +++ b/license @@ -1,6 +1,6 @@ MIT License -Copyright (c) Sindre Sorhus (sindresorhus.com) +Copyright (c) Sindre Sorhus (https://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: diff --git a/package.json b/package.json index 02b6c0d..2ac3287 100644 --- a/package.json +++ b/package.json @@ -4,13 +4,14 @@ "description": "Run shell commands", "license": "MIT", "repository": "sindresorhus/grunt-shell", + "funding": "https://github.com/sponsors/sindresorhus", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" + "url": "https://sindresorhus.com" }, "engines": { - "node": ">=6" + "node": ">=12" }, "scripts": { "test": "xo && grunt" @@ -30,9 +31,9 @@ "cli" ], "dependencies": { - "chalk": "^2.4.1", + "chalk": "^3.0.0", "npm-run-path": "^2.0.0", - "strip-ansi": "^5.0.0" + "strip-ansi": "^6.0.1" }, "devDependencies": { "grunt": "^1.0.1", diff --git a/readme.md b/readme.md index 33fcfaf..138a414 100644 --- a/readme.md +++ b/readme.md @@ -4,13 +4,11 @@ A good way to interact with other CLI tools. For example, get the current Git branch with `git branch`. - ## Install +```sh +npm install --save-dev grunt-shell ``` -$ npm install --save-dev grunt-shell -``` - ## Usage @@ -32,7 +30,6 @@ grunt.initConfig({ grunt.registerTask('default', ['shell']); ``` - ## Examples ### Run command @@ -174,7 +171,7 @@ grunt.initConfig({ ### command -*Required*
+*Required*\ Type: `string | Function` Command to run or a function which returns the command. Supports underscore templates. @@ -187,40 +184,39 @@ Type: `string` Shortcut. Same as `options.execOptions.cwd` (see below). - ## Options ### stdout -Type: `boolean`
+Type: `boolean`\ Default: `true` Show stdout in the terminal. ### stderr -Type: `boolean`
+Type: `boolean`\ Default: `true` Show stderr in the terminal. ### stdin -Type: `boolean`
+Type: `boolean`\ Default: `true` Forward the terminal's stdin to the command. ### failOnError -Type: `boolean`
+Type: `boolean`\ Default: `true` -Fail task if it encounters an error. Doesn't apply if you specify a `callback`. +Fail task if it encounters an error. Does not apply if you specify a `callback`. ### stdinRawMode -Type: `boolean`
+Type: `boolean`\ Default: `false` Set `stdin` to [act as a raw device](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode). @@ -235,7 +231,7 @@ Lets you override the default callback with your own. ### preferLocal -Type: `boolean`
+Type: `boolean`\ Default: `true` Execute local binaries by name like [`$ npm run-script`](https://www.keithcirkel.co.uk/how-to-use-npm-as-a-build-tool/). diff --git a/tasks/shell.js b/tasks/shell.js index 1b588b6..cadbbde 100644 --- a/tasks/shell.js +++ b/tasks/shell.js @@ -7,7 +7,7 @@ const npmRunPath = require('npm-run-path'); const TEN_MEGABYTES = 1000 * 1000 * 10; module.exports = grunt => { - grunt.registerMultiTask('shell', 'Run shell commands', function (...args) { + grunt.registerMultiTask('shell', 'Run shell commands', function (...arguments_) { const callback = this.async(); const options = this.options({ stdout: true, @@ -30,10 +30,10 @@ module.exports = grunt => { } // Increase max buffer - options.execOptions = Object.assign({}, options.execOptions); + options.execOptions = {...options.execOptions}; options.execOptions.maxBuffer = options.execOptions.maxBuffer || TEN_MEGABYTES; - cmd = grunt.template.process(typeof cmd === 'function' ? cmd.apply(grunt, args) : cmd); + cmd = grunt.template.process(typeof cmd === 'function' ? cmd.apply(grunt, arguments_) : cmd); if (options.preferLocal === true) { options.execOptions.env = npmRunPath.env({env: options.execOptions.env || process.env});