Socket
Socket
Sign inDemoInstall

gulp-shell

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-shell - npm Package Compare versions

Comparing version 0.7.0 to 0.7.1

3

lib/index.d.ts
/// <reference types="node" />
import { TaskFunction } from 'undertaker';
interface Options {

@@ -15,5 +14,5 @@ cwd?: string;

(commands: string | string[], options?: Options | undefined): NodeJS.ReadWriteStream;
task(commands: string | string[], options?: Options | undefined): TaskFunction;
task(commands: string | string[], options?: Options | undefined): () => Promise<void>;
};
export = shell;
//# sourceMappingURL=index.d.ts.map
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
var async_1 = require("async");
var chalk_1 = __importDefault(require("chalk"));
var _this = this;
var tslib_1 = require("tslib");
var chalk_1 = tslib_1.__importDefault(require("chalk"));
var child_process_1 = require("child_process");
var fancy_log_1 = __importDefault(require("fancy-log"));
var lodash_template_1 = __importDefault(require("lodash.template"));
var path = __importStar(require("path"));
var plugin_error_1 = __importDefault(require("plugin-error"));
var fancy_log_1 = tslib_1.__importDefault(require("fancy-log"));
var lodash_template_1 = tslib_1.__importDefault(require("lodash.template"));
var path = tslib_1.__importStar(require("path"));
var plugin_error_1 = tslib_1.__importDefault(require("plugin-error"));
var through2_1 = require("through2");

@@ -42,34 +22,56 @@ var PLUGIN_NAME = 'gulp-shell';

var normalizeOptions = function (options) {
var _a;
if (options === void 0) { options = {}; }
var _a;
var pathToBin = path.join(process.cwd(), 'node_modules', '.bin');
var pathName = /^win/.test(process.platform) ? 'Path' : 'PATH';
/* istanbul ignore next */
var pathName = process.platform === 'win32' ? 'Path' : 'PATH';
var newPath = pathToBin + path.delimiter + process.env[pathName];
var env = __assign({}, process.env, (_a = {}, _a[pathName] = newPath, _a), options.env);
return __assign({ cwd: process.cwd(), env: env, shell: true, quiet: false, verbose: false, ignoreErrors: false, errorMessage: 'Command `<%= command %>` failed with exit code <%= error.code %>', templateData: {} }, options);
var env = tslib_1.__assign({}, process.env, (_a = {}, _a[pathName] = newPath, _a), options.env);
return tslib_1.__assign({ cwd: process.cwd(), env: env, shell: true, quiet: false, verbose: false, ignoreErrors: false, errorMessage: 'Command `<%= command %>` failed with exit code <%= error.code %>', templateData: {} }, options);
};
var runCommands = function (commands, options, file, done) {
async_1.eachSeries(commands, function (command, done) {
var context = __assign({ file: file }, options.templateData);
command = lodash_template_1.default(command)(context);
if (options.verbose) {
fancy_log_1.default(PLUGIN_NAME + ":", chalk_1.default.cyan(command));
}
var child = child_process_1.spawn(command, {
env: options.env,
cwd: lodash_template_1.default(options.cwd)(context),
shell: options.shell,
stdio: options.quiet ? 'ignore' : 'inherit'
});
var runCommand = function (command, options, file) {
var context = tslib_1.__assign({ file: file }, options.templateData);
command = lodash_template_1.default(command)(context);
if (options.verbose) {
fancy_log_1.default(PLUGIN_NAME + ":", chalk_1.default.cyan(command));
}
var child = child_process_1.spawn(command, {
env: options.env,
cwd: lodash_template_1.default(options.cwd)(context),
shell: options.shell,
stdio: options.quiet ? 'ignore' : 'inherit'
});
return new Promise(function (resolve, reject) {
child.on('exit', function (code) {
if (code === 0 || options.ignoreErrors) {
return done();
return resolve();
}
var context = __assign({ command: command,
var context = tslib_1.__assign({ command: command,
file: file, error: { code: code } }, options.templateData);
var message = lodash_template_1.default(options.errorMessage)(context);
done(new plugin_error_1.default(PLUGIN_NAME, message));
reject(new plugin_error_1.default(PLUGIN_NAME, message));
});
}, done);
});
};
var runCommands = function (commands, options, file) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
var _i, commands_1, command;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
_i = 0, commands_1 = commands;
_a.label = 1;
case 1:
if (!(_i < commands_1.length)) return [3 /*break*/, 4];
command = commands_1[_i];
return [4 /*yield*/, runCommand(command, options, file)];
case 2:
_a.sent();
_a.label = 3;
case 3:
_i++;
return [3 /*break*/, 1];
case 4: return [2 /*return*/];
}
});
}); };
var shell = function (commands, options) {

@@ -80,10 +82,10 @@ var normalizedCommands = normalizeCommands(commands);

var _this = this;
runCommands(normalizedCommands, normalizedOptions, file, function (error) {
if (error) {
_this.emit('error', error);
}
else {
_this.push(file);
}
runCommands(normalizedCommands, normalizedOptions, file)
.then(function () {
_this.push(file);
done();
})
.catch(function (error) {
_this.emit('error', error);
done();
});

@@ -94,6 +96,6 @@ });

};
shell.task = function (commands, options) { return function (done) {
runCommands(normalizeCommands(commands), normalizeOptions(options), null, done);
shell.task = function (commands, options) { return function () {
return runCommands(normalizeCommands(commands), normalizeOptions(options), null);
}; };
module.exports = shell;
//# sourceMappingURL=index.js.map
{
"name": "gulp-shell",
"version": "0.7.0",
"version": "0.7.1",
"description": "A handy command line interface for gulp",
"main": "./lib/index.js",
"typings": "./lib/index.d.ts",
"types": "./lib/index.d.ts",
"files": [

@@ -12,3 +12,3 @@ "lib/index.*"

"build": "gulp build",
"test": "gulp test lint",
"test": "gulp test",
"coveralls": "gulp coveralls",

@@ -35,27 +35,23 @@ "prepare": "npm run build",

"devDependencies": {
"@types/async": "^2.4.1",
"@types/chai": "^4.1.7",
"@types/fancy-log": "^1.3.1",
"@types/gulp": "^4.0.5",
"@types/lodash.template": "^4.4.5",
"@types/mocha": "^5.2.6",
"@types/node": "^11.10.4",
"@types/gulp": "^4.0.6",
"@types/jest": "^24.0.13",
"@types/lodash.template": "^4.4.6",
"@types/node": "^12.0.7",
"@types/through2": "^2.0.34",
"@typescript-eslint/eslint-plugin": "^1.4.2",
"@typescript-eslint/parser": "^1.4.2",
"chai": "^4.2.0",
"coveralls": "^3.0.3",
"eslint": "^5.15.0",
"eslint-config-prettier": "^4.1.0",
"gulp": "^4.0.0",
"mocha": "^6.0.2",
"mocha-lcov-reporter": "^1.3.0",
"nyc": "^13.3.0",
"prettier": "^1.16.4",
"ts-node": "^8.0.2",
"typescript": "^3.3.3333",
"@typescript-eslint/eslint-plugin": "^1.9.0",
"@typescript-eslint/parser": "^1.9.0",
"coveralls": "^3.0.4",
"eslint": "^5.16.0",
"eslint-config-prettier": "^4.3.0",
"eslint-plugin-jest": "^22.6.4",
"gulp": "^4.0.2",
"jest": "^24.8.0",
"prettier": "^1.18.0",
"ts-jest": "^24.0.2",
"ts-node": "^8.2.0",
"typescript": "^3.5.1",
"vinyl": "^2.2.0"
},
"dependencies": {
"async": "^2.6.2",
"chalk": "^2.4.2",

@@ -65,3 +61,4 @@ "fancy-log": "^1.3.3",

"plugin-error": "^1.0.1",
"through2": "^3.0.1"
"through2": "^3.0.1",
"tslib": "^1.9.3"
},

@@ -68,0 +65,0 @@ "engines": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc