Skip to content

Commit

Permalink
## [2.1.1] - 2020-12-25
Browse files Browse the repository at this point in the history
### Removed
- package-lock.json

## [2.1.0] - 2020-12-25

### Changed
- use spawn by default

### Removed
- remove os check
  • Loading branch information
s00d committed Dec 25, 2020
1 parent fc004ee commit 5f95c7b
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 8,431 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ node_modules
npm-debug.log
*.swf
.idea/
dist/
dist/
package-lock.json
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.1.1] - 2020-12-25

### Removed
- package-lock.json

## [2.1.0] - 2020-12-25

### Changed
- use spawn by default

### Removed
- remove os check

## [2.0.5] - 2020-11-10

### Added
Expand Down
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,24 @@ how to use functions in the queue?
console.log('run async tTimeout');
setTimeout(() => {
console.log('end async tTimeout');
resolve();
resolve('ok');
}, 1000);
}),
],
blocking: true
}
```

```js
// use exec
import * as os from 'os'
{
safe: os.platform() === 'win32', // by default spawn is used everywhere. If you have problems try using safe: true
scripts: [
...
}
```

### Developing

If opening a pull request, create an issue describing a fix or feature. Have your pull request point to the issue by writing your commits with the issue number in the message.
Expand Down
39 changes: 8 additions & 31 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,6 @@
* @extends Object
* Run shell commands before and after webpack builds
*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
Expand Down Expand Up @@ -61,7 +42,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
};
Object.defineProperty(exports, "__esModule", { value: true });
var child_process_1 = require("child_process");
var os = __importStar(require("os"));
var defaultTask = {
scripts: [],
blocking: false,
Expand Down Expand Up @@ -313,7 +293,7 @@ var WebpackShellPlugin = /** @class */ (function () {
if (error && !_this.swallowError) {
throw error;
}
resolve();
resolve(error);
};
};
WebpackShellPlugin.prototype.puts = function (error, stdout, stderr) {
Expand All @@ -336,21 +316,18 @@ var WebpackShellPlugin = /** @class */ (function () {
return { command: command, args: args };
};
WebpackShellPlugin.prototype.handleScript = function (script) {
if (os.platform() === 'win32' || this.safe) {
child_process_1.execSync(script, { maxBuffer: Number.MAX_SAFE_INTEGER, stdio: this.logging ? [0, 1, 2] : undefined });
}
else {
var _a = this.serializeScript(script), command = _a.command, args = _a.args;
var env = Object.create(global.process.env);
env = Object.assign(env, this.env);
child_process_1.spawnSync(command, args, { stdio: this.logging ? 'inherit' : undefined, env: env });
if (this.safe) {
return child_process_1.execSync(script, { maxBuffer: Number.MAX_SAFE_INTEGER, stdio: this.logging ? [0, 1, 2] : undefined });
}
var _a = this.serializeScript(script), command = _a.command, args = _a.args;
var env = Object.create(global.process.env);
env = Object.assign(env, this.env);
return child_process_1.spawnSync(command, args, { stdio: this.logging ? 'inherit' : undefined, env: env });
};
WebpackShellPlugin.prototype.handleScriptAsync = function (script) {
var _this = this;
if (os.platform() === 'win32' || this.safe) {
if (this.safe) {
return new Promise(function (resolve) {
// @ts-ignore
_this.spreadStdoutAndStdErr(child_process_1.exec(script, _this.putsAsync(resolve)));
});
}
Expand Down
Loading

0 comments on commit 5f95c7b

Please sign in to comment.