[RFC]: Support inputs/output paths relative to different roots
@kenotron is already working on this.
Since Nov 7, 2024.
- Dominant language
- TypeScript
- Stars
- 816
- Forks
- 88
- PR merge metrics
- No merged PRs in 30d
Description
This RFC is part of a larger work proposal: #814
Overview
Today lage's file paths in inputs and outputs are either relative to the current package, or relative to the dependent package. This is not always sufficient, sometimes inputs relative to the workspace need to be read. For example a config file at the root of the repo (say a shared tsconfig.json, .prettierrc, .eslintrc.js etc...) In the section below "Existing sample problem" for why it is needed (even in the lage repo).
Today there is no syntax for this in lage. There is prior art by Nx with:
{
"inputs": ["{projectRoot}/**/*", "!{projectRoot}/**/*.md"],
"outputs": ["{workspaceRoot}/dist/{projectName}"]
}
Lage has support for the following syntax:
"inputs": ["**/*", "!**/*.md, "^**/*.d.ts", "!^docs/**/*.d.ts"],
So there is an option to add a 'root' character like ~, # to indicate a path relative to the workspace, or we follow the syntax of 'nx' which would allow us for a more flexible sytax.
Existing sample problem:
This is a repro for Lage's own repo:
- Clone new lage repo
yarn installyarn lint
- Note: All lint tasks run
lage - Version 2.7.15 - 31 Workers
[14:38:23] ✓ completed @lage-run/monorepo-scripts - lint (1669ms)
[14:38:25] ✓ completed @lage-run/globby - lint (2894ms)
[14:38:25] ✓ completed lage - lint (3370ms)
[14:38:32] ✓ completed @lage-run/cache-github-actions - lint (9.9s)
[14:38:32] ✓ completed @lage-run/config - lint (10.11s)
[14:38:32] ✓ completed @lage-run/cache - lint (10.19s)
<SNIP>
──┤ Waiting: 0 ├──┤ Completed: 19 / 19 (100%) ├──
Summary
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
success: 19, skipped: 0, pending: 0, aborted: 0, failed: 0
worker restarts: 0, max worker memory usage: 214.19 MB
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
Took a total of 12.50s to complete.
yarn lint
- Note: All lint tasks are cached
d:\src\lage>yarn lint
lage - Version 2.7.15 - 31 Workers
[14:38:48] - skipped @lage-run/monorepo-scripts - lint (1037ms)
[14:38:48] - skipped @lage-run/cache-github-actions - lint (1049ms)
[14:38:48] - skipped @lage-run/cache - lint (1071ms)
<SNIP>
──┤ Waiting: 0 ├──┤ Completed: 19 / 19 (100%) ├──
Summary
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
success: 0, skipped: 19, pending: 0, aborted: 0, failed: 0
worker restarts: 0, max worker memory usage: 11.12 MB
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
Took a total of 2.95s to complete. All targets skipped!
echo BADJS >> .eslintrc.jsyarn lint
- Note: Still all cached, expected reruns..
d:\src\lage>yarn lint
lage - Version 2.7.15 - 31 Workers
[14:38:48] - skipped @lage-run/monorepo-scripts - lint (1037ms)
[14:38:48] - skipped @lage-run/cache-github-actions - lint (1049ms)
[14:38:48] - skipped @lage-run/cache - lint (1071ms)
<SNIP>
──┤ Waiting: 0 ├──┤ Completed: 19 / 19 (100%) ├──
Summary
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
success: 0, skipped: 19, pending: 0, aborted: 0, failed: 0
worker restarts: 0, max worker memory usage: 11.12 MB
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
Took a total of 2.95s to complete. All targets skipped!
yarn lint --no-cache
- Note: Now it is failing....
lage - Version 2.7.15 - 31 Workers
[14:39:00] ✓ completed @lage-run/monorepo-scripts - lint (1001ms)
[14:39:00] ✓ completed @lage-run/globby - lint (1439ms)
[14:39:00] ✓ completed lage - lint (1480ms)
[14:39:02] ✗ failed @lage-run/cache - lint (3236ms)
<SNIP>
──┤ Waiting: 0 ├──┤ Completed: 19 / 19 (100%) ├──
Summary
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
success: 3, skipped: 0, pending: 0, aborted: 0, failed: 1
worker restarts: 0, max worker memory usage: 13.19 MB
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.