Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.6.3 to 0.6.4

11

gulpfile.js

@@ -5,6 +5,3 @@ const gulp = require('gulp')

const paths = {
js: [
'*.js',
'test/*.js'
]
js: ['*.js', 'test/*.js']
}

@@ -16,3 +13,7 @@

gulp.task('coveralls', ['coverage'], shell.task('cat coverage/lcov.info | coveralls'))
gulp.task(
'coveralls',
['coverage'],
shell.task('cat coverage/lcov.info | coveralls')
)

@@ -19,0 +20,0 @@ gulp.task('lint', shell.task('standard ' + paths.js.join(' ')))

const _ = require('lodash')
const async = require('async')
const gutil = require('gulp-util')
const chalk = require('chalk')
const fancyLog = require('fancy-log')
const path = require('path')
const PluginError = require('plugin-error')
const spawn = require('child_process').spawn
const template = require('lodash.template')
const through = require('through2')

@@ -16,3 +19,3 @@

if (!Array.isArray(commands)) {
throw new gutil.PluginError(PLUGIN_NAME, 'Missing commands')
throw new PluginError(PLUGIN_NAME, 'Missing commands')
}

@@ -44,6 +47,6 @@

const context = _.extend({file}, options.templateData)
command = gutil.template(command, context)
command = template(command)(context)
if (options.verbose) {
gutil.log(gutil.colors.cyan(command))
fancyLog(chalk.cyan(command))
}

@@ -53,3 +56,3 @@

env: options.env,
cwd: gutil.template(options.cwd, context),
cwd: template(options.cwd)(context),
shell: options.shell,

@@ -70,5 +73,5 @@ stdio: options.quiet ? 'ignore' : 'inherit'

const message = gutil.template(options.errorMessage, context)
const message = template(options.errorMessage)(context)
done(new gutil.PluginError(PLUGIN_NAME, message))
done(new PluginError(PLUGIN_NAME, message))
})

@@ -75,0 +78,0 @@ }, done)

{
"name": "gulp-shell",
"version": "0.6.3",
"version": "0.6.4",
"description": "A handy command line interface for gulp",

@@ -37,5 +37,9 @@ "main": "index.js",

"async": "^2.1.5",
"gulp-util": "^3.0.8",
"chalk": "^2.3.0",
"fancy-log": "^1.3.2",
"lodash": "^4.17.4",
"through2": "^2.0.3"
"lodash.template": "^4.4.0",
"plugin-error": "^0.1.2",
"through2": "^2.0.3",
"vinyl": "^2.1.0"
},

@@ -42,0 +46,0 @@ "engines": {

@@ -35,6 +35,3 @@ # gulp-shell

```js
gulp.task('shorthand', shell.task([
'echo hello',
'echo world'
]))
gulp.task('greet', shell.task('echo Hello, World!'))
```

@@ -41,0 +38,0 @@

/* eslint-env mocha */
const gutil = require('gulp-util')
const expect = require('chai').expect
const join = require('path').join
const expect = require('chai').expect
const Vinyl = require('vinyl')

@@ -10,9 +10,9 @@ const shell = require('..')

function expectToBeOk (stream, done) {
stream
.on('error', done)
.on('data', () => { done() })
stream.on('error', done).on('data', () => {
done()
})
}
describe('gulp-shell(commands, options)', () => {
const fakeFile = new gutil.File({
const fakeFile = new Vinyl({
cwd: __dirname,

@@ -31,6 +31,6 @@ base: __dirname,

it('passes file through', (done) => {
it('passes file through', done => {
const stream = shell(['true'])
stream.on('data', (file) => {
stream.on('data', file => {
expect(file).to.equal(fakeFile)

@@ -43,6 +43,4 @@ done()

it('executes command after interpolation', (done) => {
const stream = shell([
`test <%= file.path %> = ${fakeFile.path}`
])
it('executes command after interpolation', done => {
const stream = shell([`test <%= file.path %> = ${fakeFile.path}`])

@@ -54,6 +52,7 @@ expectToBeOk(stream, done)

it('prepends `./node_modules/.bin` to `PATH`', (done) => {
const stream = shell([
`echo $PATH | grep -q "${join(process.cwd(), 'node_modules/.bin')}"`
], {shell: 'bash'})
it('prepends `./node_modules/.bin` to `PATH`', done => {
const stream = shell(
[`echo $PATH | grep -q "${join(process.cwd(), 'node_modules/.bin')}"`],
{ shell: 'bash' }
)

@@ -66,3 +65,3 @@ expectToBeOk(stream, done)

describe('.task(commands, options)', () => {
it('returns a function which returns a callback', (done) => {
it('returns a function which returns a callback', done => {
const task = shell.task(['echo hello world'])

@@ -78,6 +77,6 @@

describe('cwd', () => {
it('sets the current working directory when `cwd` is a string', (done) => {
const stream = shell([
`test $PWD = ${join(__dirname, '../..')}`
], {cwd: '..'})
it('sets the current working directory when `cwd` is a string', done => {
const stream = shell([`test $PWD = ${join(__dirname, '../..')}`], {
cwd: '..'
})

@@ -89,6 +88,4 @@ expectToBeOk(stream, done)

it('uses the process current working directory when `cwd` is not passed', (done) => {
const stream = shell([
`test $PWD = ${join(__dirname, '..')}`
])
it('uses the process current working directory when `cwd` is not passed', done => {
const stream = shell([`test $PWD = ${join(__dirname, '..')}`])

@@ -102,6 +99,4 @@ expectToBeOk(stream, done)

describe('shell', () => {
it('changes the shell', (done) => {
const stream = shell([
'[[ $0 = bash ]]'
], {shell: 'bash'})
it('changes the shell', done => {
const stream = shell(['[[ $0 = bash ]]'], { shell: 'bash' })

@@ -115,4 +110,4 @@ expectToBeOk(stream, done)

describe('quiet', () => {
it("won't output anything when `quiet` == true", (done) => {
const stream = shell(['echo cannot see me!'], {quiet: true})
it("won't output anything when `quiet` == true", done => {
const stream = shell(['echo cannot see me!'], { quiet: true })

@@ -126,3 +121,3 @@ expectToBeOk(stream, done)

describe('ignoreErrors', () => {
it('emits error by default', (done) => {
it('emits error by default', done => {
const stream = shell(['false'])

@@ -137,4 +132,4 @@

it("won't emit error when `ignoreErrors` == true", (done) => {
const stream = shell(['false'], {ignoreErrors: true})
it("won't emit error when `ignoreErrors` == true", done => {
const stream = shell(['false'], { ignoreErrors: true })

@@ -154,7 +149,7 @@ stream.on('error', () => {

describe('errorMessage', () => {
it('allows for custom messages', (done) => {
it('allows for custom messages', done => {
const errorMessage = 'foo'
const stream = shell(['false'], {errorMessage})
const stream = shell(['false'], { errorMessage })
stream.on('error', (error) => {
stream.on('error', error => {
expect(error.message).to.equal(errorMessage)

@@ -167,8 +162,8 @@ done()

it('includes the error object in the error context', (done) => {
it('includes the error object in the error context', done => {
const errorMessage = 'Foo <%= error.code %>'
const expectedMessage = 'Foo 2'
const stream = shell(['exit 2'], {errorMessage})
const stream = shell(['exit 2'], { errorMessage })
stream.on('error', (error) => {
stream.on('error', error => {
expect(error.message).to.equal(expectedMessage)

@@ -175,0 +170,0 @@ done()

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