Skip to content
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

[RFC]: Support inputs/output paths relative to different roots #818

Open
dannyvv opened this issue Nov 7, 2024 · 0 comments
Open

[RFC]: Support inputs/output paths relative to different roots #818

dannyvv opened this issue Nov 7, 2024 · 0 comments
Assignees

Comments

@dannyvv
Copy link
Member

dannyvv commented Nov 7, 2024

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:

  1. Clone new lage repo
  2. yarn install
  3. yarn 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.
  1. 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!
  1. echo BADJS >> .eslintrc.js
  2. yarn 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!
  1. 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
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
  
@dannyvv dannyvv changed the title [RFC]: Target setting merging [RFC]: Support inputs/output paths relative to different roots Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants