iammerrick / grunt-parallel Goto Github PK
View Code? Open in Web Editor NEWSpeed up your build by running commands and tasks in parallel!
License: MIT License
Speed up your build by running commands and tasks in parallel!
License: MIT License
$ grunt -v parallel
Parallel does not pass on the verbose flag to tasks, thus the verbose output is not displayed.
I've created gruntjs/grunt/issues/705 because the way config is done in Grunt-Parallel isn't compatible with the --verbose
option.
If Grunt isn't going to change how they work then Grunt-Parallel's config might need to change to conform to their style. This is a simple change - options just need to be inside an options
object.
I have a CPU intensive task (task1) and a Network intensive task (task2), which I want to run in parallel. Now, if task1 fails, task2 is not killed, but grunt exits.
Is there an option to:
finally
clauseI am happy to try open a pull request if any of the choices are part of the philosophy of the library.
It would be nice if I could have latest master on npm.
For example grunt-usemin
generated dymaically the configuration for concat and uglify. It would be nice if the current config object would be injected in the new spawned process.
Hi @iammerrick
Looks like you've already merged the PR with the update needed (#40)
Would you mind publishing a new version at npm?
Also looks like apart from peerDependency, you also list grunt
as a regular dependency - and this one is still the old version.
To me it seems that the latter can be safely dropped at all - it doesn't seem to be used.
The PR with the proposed change: #42
Thanks!
Hi there,
Right now, "tasks" is only an array of tasks that will be run in parallel. But what if, in some cases, I would like to run in parallel some series of tasks? As for the syntax, "tasks" could also be an object or array of arrays, and then run those "sub-tasks" in series. For example:
parallel: {
series: {
options: { grunt: true },
tasks: [
["fast", "fast"],
["fast", "block", "block"],
"fast"
]
}
}
In this case, there would be 3 parallel process, one running twice "fast" in series, one running "fast" and then twice "block", and finally one running only once "fast".
It would be totally backward compatible. What do you thing?
I have a setup which contains two tasks:
A) grunt watch
B) mvn jetty:run
1 - If B dies for some reason (e.g. bad pom syntax), A will continue to run.
2 - If A dies for any reason, B will die also.
I expect 2, but not 1.
Any thoughts?
Here's the relevant command/snippet from AngularJS's build:
grunt --stack parallel:travis --reporters dots --browsers SL_Chrome
#
# lots o stuff
#
Running "test:end2end" (test) task
node: ../deps/uv/src/unix/stream.c:494: uv__server_io: Assertion `events == 1' failed.
ERROR
Warning: Task "parallel:travis" failed.� Use --force to continue.
Error: Task "parallel:travis" failed.
at Task.<anonymous> (/home/travis/build/btford/angular.js/node_modules/grunt/lib/util/task.js:197:15)
at null._onTimeout (/home/travis/build/btford/angular.js/node_modules/grunt/lib/util/task.js:225:33)
at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
See build here: https://travis-ci.org/btford/angular.js/builds/9962771#L1566
Seems like the issue is with grunt.util.spawn
's handling of stream direction.
After upgrading to 0.4.0 I encountered this error:
Verifying property parallel.web exists in config...OK
File: [no files]
Options: grunt=false, stream=false
Warning: Object #<Object> has no method 'flags' Use --force to continue.
I saw a commit related to flags
by @vernonk do i need to change my config?
Parallel works great for shaving a few seconds off intensive tasks like grunt-contrib-uglify
, but it has an issue right now where grunt.config properties that are set in a previous task are not shared across the spawned tasks.
I ran into this when attempting to inject the git-sha from a shell command into my banner during uglification, here's the grunt configuration:
module.exports = (grunt) ->
grunt.loadTasks "tasks"
grunt.loadNpmTasks "grunt-contrib-concat"
grunt.loadNpmTasks "grunt-contrib-uglify"
grunt.loadNpmTasks "grunt-parallel"
# Project configuration.
config =
# Metadata.
pkg: grunt.file.readJSON("package.json")
banner: "/*! sha: <%= sha %> */\n"
# Task configuration.
git_rev_parse:
prop: "sha"
concat:
options:
banner: "<%= banner %>"
stripBanners: true
bundle:
files:
"dist/app.js": ["vendor/**/*.js", "app/**/*.js"]
parallel:
minification:
tasks: [
{ grunt: true, args: ['uglify:dist'] }
{ grunt: true, args: ['uglify:alternate'] }
]
uglify:
options:
banner: "<%= banner %>"
dist:
src: "dist/app.js"
dest: "dist/app.min.js"
alternate:
files:
"dist/other-app.js" : [
"dist/app.js"
"other-things/**/*.js"
]
grunt.initConfig(config)
grunt.registerTask "default", ["git_rev_parse", "concat", "parallel"]
And here's my git_rev_parse task:
module.exports = (grunt) ->
grunt.registerTask "git_rev_parse", "Git revision parse", ->
property = grunt.config("git_rev_parse").prop
done = @async()
gitRevParseCommand =
cmd: "git"
args: "rev-parse --short HEAD".split(" ")
writesGitRevision = (err, result) ->
if err
grunt.log.error(err)
return done(false)
grunt.config property, result.stdout
grunt.log.write "#{gitRevParseCommand.cmd} #{gitRevParseCommand.args.join(" ")}: "
grunt.log.ok result.stdout
done()
grunt.util.spawn(gitRevParseCommand, writesGitRevision)
Which yields the following:
This workflow works fine if I simply setup my default task to use uglify directly, as values persisted to grunt.config
in previous tasks will be present in memory when subsequent tasks execute:
I need to pass in --grep = 'test name' to my task mochaTest:android. How do I do that?
I've been trying this for a while and tried following.
tasks:[{
grunt:true,
args:['mochaTest:android'],
options: ['--grep=test_names'],
}, {
grunt:true,
args:['mochaTest:android'],
options:['--grep=test_names'],
}]
}
tasks:[{
grunt:true,
args:['mochaTest:android --grep='test_name'],
}, {
grunt:true,
args:['mochaTest:android'],
}]
}
tasks:[{
grunt:true,
args:['mochaTest:android'],
flags: ['--grep=test_names'],
}, {
grunt:true,
args:['mochaTest:android'],
flags:['--grep=test_names'],
}]
}
tasks:[{
grunt:true,
args:['mochaTest:android'],
flags: 'grep=test_names',
}, {
grunt:true,
args:['mochaTest:android'],
flags:'grep=test_names',
}]
}
1.0???
Changelog files are always appreciated as well
Just an idea.
If I don't specify cmd
, then it should be considered as a grunt task (without specifying grunt: true
).
Currently without specifying cmd
, you get Cannot call method 'charAt' of undefined
.
I have a situation where I would like to run two tasks in parallel, but I want them to display their output as they are happening.
My actual situation is two watch tasks (different tasks completely) that I need to run in parallel.
I'm running multiple tests in parallel, which are working fine using grunt-parallel, but if one of the tests fails before the others have finished they are abandoned.
I have a proposed solution to this replacing the Q.all call with Q.allSelected and a little logic, that also required the version of Q to be updated.
Perhaps also a flag to give users the choice between exit on first failure or complete all.
Currently if I have N tasks running in parallel, I need to press ctrl-c for N times.
Is there any way to use only one ctrl-c to terminate them all?
i have a grunt option that i need to pass to spawned grunt instances. looks like this would be easy to add at about line 49. lets see if i get ambitious and make a pull request.
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.