-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Major gulp refactor: blueprint.defineTaskGroup() #617
Changes from 1 commit
661436c
e52a0f1
bce87b7
7c9755b
fad2c05
b3c09e3
183c315
0044b9b
b13f70c
6952e15
9126e3d
aba0117
aeb0fdd
2629f96
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
for tasks that care about project dependencies 😄
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,22 +48,24 @@ module.exports = (gulp, config) => { | |
* Define a group of tasks for projects with the given config block. | ||
* The special block `"all"` will operate on all projects. | ||
* The `block` is used as the task name, unless `name` is explicitly defined. | ||
* The `taskFn` is called for each matched project with `(taskName, project)`. The task | ||
* name is of the format `[name]-[project.id]`. | ||
* The `taskFn` is called for each matched project with `(project, taskName, depTaskNames)`. | ||
* The task name is of the format `[name]-[project.id]`. | ||
* Finally, a "group task" is defined with the base name that runs all the project tasks. | ||
* This group task can be configured to run in parallel or in sequence. | ||
* @param {{block: string, name?: string, parallel?: boolean}} options | ||
* @param {Function} taskFn called for each project containing block with `(taskName, project)` | ||
* @param {Function} taskFn called for each project containing block with `(project, taskName, depTaskNames)` | ||
*/ | ||
taskGroup(options, taskFn) { | ||
const { block, name = block, parallel = true } = options; | ||
|
||
const projects = (block === "all") ? blueprint.projects : blueprint.projectsWithBlock(block); | ||
|
||
const taskNames = projects.map((project) => { | ||
const { dependencies = [], id } = project; | ||
// string name is combined with block; array name ignores/overrides block | ||
const taskName = [name, project.id].join("-"); | ||
taskFn(taskName, project); | ||
const taskName = [name, id].join("-"); | ||
const depNames = dependencies.map((dep) => [name, dep].join("-")); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It appears that |
||
taskFn(project, taskName, depNames); | ||
return taskName; | ||
}); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ module.exports = (blueprint, gulp, plugins) => { | |
blueprint.taskGroup({ | ||
block: "isotest", | ||
parallel: false, | ||
}, (taskName, project) => { | ||
}, (project, taskName) => { | ||
gulp.task(taskName, [`typescript-compile-${project.id}`], () => { | ||
return gulp.src(project.cwd + "test.iso/**/*") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @giladgray just gonna comment on every little thing until I build up a more solid understanding of this whole build system. There's a minor change in behavior here, yes ( |
||
.pipe(plugins.mocha()); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of "block", I propose another name: "scope"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
love it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually i'm less into
scope
now.config block
sounds better thanconfig scope
, as doesprojectsWithBlock
vsprojectsWithScope
.i am open to a new name though, just don't think we've found it yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
block really doesn't mean anything. what do you mean by "config block sounds better than config scope"? also
projectsWithScope
sounds fine to meThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is a scope?