klathmon / gulp-run-command Goto Github PK
View Code? Open in Web Editor NEWA simple way to run command-line programs from gulp in a cross-platform way.
License: MIT License
A simple way to run command-line programs from gulp in a cross-platform way.
License: MIT License
Nevermind, just figured out it needs to be curried in the new configuration... Thanks!
It seems that if
proc.on('exit', (code) => {
if (parseInt(code, 10) === 0) {
resolve()
} else {
throw new Error(`Non-zero exit code of "${code}"`)
}
})
enters new Error, while ignoreErrors = true. The Exception is not caught or suppressed by the top try /catch. Has this always been the intended functionality or is it a bug?
Not sure what I'm doing wrong, but I am replacing a npm script. This was my package.json:
{
...
"scripts": {
"deploy-stage": "export AWS_PROFILE=${PROJECT}-${STAGE} && ../../node_modules/serverless/bin/serverless deploy --verbose --stage $STAGE --region eu-west-2 --aws-s3-accelerate",
}
And this is the gulp version:
const gulp = require('gulp')
const gutil = require('gulp-util')
const run = require('gulp-run-command').default
gulp.task('deploy', () => {
const PROJECT = 'sls'
const STAGE = 'dev'
const REGION = 'eu-west-2'
run(`${__dirname}/../../node_modules/serverless/bin/serverless deploy
--verbose --stage ${STAGE} --region ${REGION} --aws-s3-accelerate`, {
env: {
AWS_PROFILE: `${PROJECT}-${STAGE}`
}
})
gutil.log('post-deploy')
})
But when I run gulp deploy
, it gives:
Toms-MBP-2:api tommedema$ gulp deploy
[23:45:02] Using gulpfile ~/Drive/education/serverless/serverless-aws-crud-starter/services/api/gulpfile.js
[23:45:02] Starting 'deploy'...
[23:45:02] post-deploy
[23:45:02] Finished 'deploy' after 3.72 ms
Without any error messages whatsoever. I thought it could be since there is no use of async/await
, promises, or callbacks (so gulp wouldn't know when run
was finished); but then again you are not doing this in your example either.
This is with node v8.9.3 LTS
I've got a Gulpfile like this:
gulp.task('which-user', [], function() {
return runCommand('bash -lc "echo $USER"', { quiet: false })();
});
However when it hits the runCommand, the output loses its ANSI/colours, and I get nasty colour codes:
Of course if I run gulp --no-color
, no colour codes are output, so it works fine:
It seems to be related to runCommand, even if I change the task to return nothing, it still breaks the colours:
gulp.task('which-user', [], function() {
return runCommand('true')();
});
Any ideas?
If i pass in the function its working:
gulp.task('taskName', run(cmd));
But why it is not working if i return the function, which should be exactly the same:
gulp.task(taskName, () => {
console.log(`running '${cmd}' ...`);
return run(cmd);
});
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.