Skip to content

Commit

Permalink
Require Node.js 12
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Mar 19, 2022
1 parent 8251ed7 commit 70903c1
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 30 deletions.
4 changes: 0 additions & 4 deletions .github/funding.yml

This file was deleted.

6 changes: 2 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion license
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com)
Copyright (c) Sindre Sorhus <[email protected]> (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:

Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "[email protected]",
"url": "sindresorhus.com"
"url": "https://sindresorhus.com"
},
"engines": {
"node": ">=6"
"node": ">=12"
},
"scripts": {
"test": "xo && grunt"
Expand All @@ -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",
Expand Down
24 changes: 10 additions & 14 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -32,7 +30,6 @@ grunt.initConfig({
grunt.registerTask('default', ['shell']);
```


## Examples

### Run command
Expand Down Expand Up @@ -174,7 +171,7 @@ grunt.initConfig({

### command

*Required*<br>
*Required*\
Type: `string | Function`

Command to run or a function which returns the command. Supports underscore templates.
Expand All @@ -187,40 +184,39 @@ Type: `string`

Shortcut. Same as `options.execOptions.cwd` (see below).


## Options

### stdout

Type: `boolean`<br>
Type: `boolean`\
Default: `true`

Show stdout in the terminal.

### stderr

Type: `boolean`<br>
Type: `boolean`\
Default: `true`

Show stderr in the terminal.

### stdin

Type: `boolean`<br>
Type: `boolean`\
Default: `true`

Forward the terminal's stdin to the command.

### failOnError

Type: `boolean`<br>
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`<br>
Type: `boolean`\
Default: `false`

Set `stdin` to [act as a raw device](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode).
Expand All @@ -235,7 +231,7 @@ Lets you override the default callback with your own.

### preferLocal

Type: `boolean`<br>
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/).
Expand Down
6 changes: 3 additions & 3 deletions tasks/shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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});
Expand Down

0 comments on commit 70903c1

Please sign in to comment.