š¬ RFC: Task runner contract (pluggable task runners)
See original GitHub issueFollowing up on #1826 to make a more generic issue to foster further discussion.
Specifically this comment: https://github.com/projen/projen/issues/1826#issuecomment-1211720662
We need to make sure the contract for task runners is right. Then we can implement a default choice for the batteries-included projects based on that.
There are several issues at the moment with projenās task implementation:
- Extra params cannot be included (E.g.
projen test -- my.spec.ts
). This is because the projen task can include many forked tasks and thereby it is not possible to infer which sub-process needs these extra parameters. - It sets up itās own opinion and hirerachy of tasks calling (e.g. see build task). Which makes it difficult to set up other task runners and optimize the behaviour. For example, turborepo can also run task hierarchies, but in an optimized way (using cache).
There are many competing task runners emerging. Notable ones:
As a user, I want to be able to swap a task runner for a custom one. Ideally, it would be another component or package that can easily plug into the projen project instance.
Should be as simple as:
new typescript.TypeScriptProject({
// ... projen options
taskRunner: new CustomTaskRunner({
// optional task runner options
}),
})
Where CustomTaskRunner
implements an interface:
class CustomTaskRunner implements IProjenTaskRunner {
// ...
}
Question: What should this interface look like?
interface IProjenTaskRunner {
// āāā
}
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Task Runners - Prefect 2 - Coordinating the world's dataflows
Task runners enable you to engage specific executors for Prefect tasks, such as for concurrent, parallel, or distributed execution of tasks. Task runners...
Read more >allow passing arguments to tasks Ā· Issue #356 - GitHub
Should tasks also "register" positional arguments and switches for yargs? ... Merged. š¬ RFC: Task runner contract (pluggable task runners) #2051.
Read more >Task Runners - AWS Data Pipeline
A task runner is an application that polls AWS Data Pipeline for tasks and then performs those tasks. Task Runner is a default...
Read more >Node.js task runners vs. module bundlers - LogRocket Blog
Learn how to choose between a module bundler or a task runner for your app in this overview of each tool, its popularity,...
Read more >Task Runners - CommandBox : CLI, Package Manager, REPL ...
CommandBox allows you to automate common jobs that you want to run via Task Runners. Ā· A task is defined as a CFC...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Iāve been looking at this the last couple days. Here are my (unsorted) thoughts:
TaskRuntime
that we need to swap out. The TaskModel will likely stay in projen, otherwise cross runtime compatibility will be a mess.projen-run
orpjx
that contains the basic default task runtime. Advantage: Projen can be ejected from a project and tasks still work.spawn
with a dependency model (dependsOn
). A simple runtime can execute tasks in order, a more complex one can parallelize and cache.test-task --file {testFile} --dependsOn--> jest-task {file}
projen test
shortcuts. Iām not also not sure if it should be delegate to the task runtime at all, or maybe that could be something swap-able as well (but whatās the point).package.json
and not available viaprojen hidden-task
. TaskRuntimes might decide to still expose them to the user directly e.g.wireit hidden-task
. Advantage: Could be used so thatEslintTask
would exists, even though itās only ever called fromprojen test
. Or to hide āCIā variations of a task from the user. E.g.test:ci
would be somehow called in the CI but cannot be used by the user.Fair enough!
I think having the option to intercept args is a good one.
That way you can pass thru args, if you want, or you could amend them to your liking, for example, and then pass to the underlying tasks.
E.g. maybe, passing
-u
(to jest), but then some other testing framework has a different flag for the same concept (updating snapshots), which you could then overload.