Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@lgarron
Copy link
Member

@lgarron lgarron commented Aug 14, 2025

This still keeps build-web and the linting targets as .PHONY commands for simplicity and safety.

The dependencies are very fragile, and require significant discipline to maintain. Just to give one example: ./dist/lib/@cubing/icons/js/index.d.ts depends on ./src/js/index.ts instead of ./src/js/*.ts or ./src/js/**/*.ts because the latter are not portable. This means that if a new source file is added under ./src/js it must be added manually. But it would also be easy to miss adding this file, because some development flows would be unaffected.

Command Before After
hyperfine "make build-lib-js" 340.9 ms ± 45.3 ms 19.9 ms ± 1.2 ms
hyperfine "make lint" 2.414 s ± 0.064 s 1.804 s ± 0.081 s
hyperfine "make clean build-lib-js" 373.9 ms ± 69.6 ms 324.1 ms ± 10.7 ms
hyperfine "make clean lint" 2.393 s ± 0.033 s 2.402 s ± 0.037 s

@lgarron lgarron force-pushed the artifact-dependencies branch 5 times, most recently from a61ed80 to d100f03 Compare August 14, 2025 23:37
Copy link
Member

@jfly jfly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tried a fresh checkout of this PR and tried a random command, got a warning. Is this concerning?

$ make ./dist/lib/@cubing/icons/cubing-icons.css
bun run script/build-lib-js.ts
▲ [WARNING] Cannot find base config file "./node_modules/@cubing/dev-config/ts/es2022-types/tsconfig.json" [tsconfig.json]

    tsconfig.json:2:13:
      2 │   "extends": "./node_modules/@cubing/dev-config/ts/es2022-types/tsconfig.json",
        ╵              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The library has been built at: ./dist/lib/@cubing/icons

Comment on lines +6 to +8
./dist/lib/@cubing/icons/cubing-icons.css: ./.temp/lib/cubing-icons.css
./dist/lib/@cubing/icons/cubing-icons.woff2: ./.temp/lib/cubing-icons.woff2
./dist/lib/@cubing/icons/js/index.js: ./src/js/*.ts ./.temp/lib/cubing-icons.ts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I understand these rules. Does creating the /.temp directory also create the stuff under ./dist?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bun run script/build-lib-js.ts creates all of them, per #201

In case something goes wrong with the build process, the tree in this Makefile provides an approximation to the semantic dependencies that should cause enough steps to run.

This still keeps `build-web` and the linting targets as `.PHONY` commands for simplicity and safety.

The dependencies are very fragile, and require significant discipline to maintain. Just to give one example: `./dist/lib/@cubing/icons/js/index.d.ts` depends on `./src/js/index.ts` instead of `./src/js/*.ts` or `./src/js/**/*.ts` because the latter are not portable. This means that if a new source file is added under `./src/js` it must be added manually. But it would also be easy to miss adding this file, because some development flows would be unaffected.


| Command                               | Before              | After               |
| ------------------------------------- | ------------------- | ------------------- |
| `hyperfile "make build-lib-js"`       | 340.9 ms ±  45.3 ms | 19.9 ms ±   1.2 ms  |
| `hyperfile "make lint"`               | 2.414 s ±  0.064 s  | 1.804 s ±  0.081 s  |
| `hyperfile "make clean build-lib-js"` | 373.9 ms ±  69.6 ms | 324.1 ms ±  10.7 ms |
| `hyperfile "make clean lint"`         | 2.393 s ±  0.033 s  | 2.402 s ±  0.037 s  |
`setup` is `.PHONY`, but it's needed to run the build script.
@lgarron lgarron force-pushed the artifact-dependencies branch from d100f03 to eb7fa73 Compare August 15, 2025 02:47
@lgarron
Copy link
Member Author

lgarron commented Aug 15, 2025

I just tried a fresh checkout of this PR and tried a random command, got a warning. Is this concerning?

Ah, I had to avoid putting bun run script/build-lib-js.ts under a .PHONY target, but I lost the setup dependency in the process. Fixed in: 14eafbe)

We could test for this in CI by running reset instead of clean with every command. I think this should be cheap enough?

…ugh testing.

`bun` is fast enough for this, given 1) `bun`'s local caching, and 2) we don't use a dependency with heavy setup (e.g. post-install scripts).
@lgarron
Copy link
Member Author

lgarron commented Aug 15, 2025

We could test for this in CI by running reset instead of clean with every command. I think this should be cheap enough?

Never mind, this is a bit too slow.

@lgarron lgarron force-pushed the artifact-dependencies branch from 81dfa96 to b9e3f0f Compare August 15, 2025 03:19
@jfly
Copy link
Member

jfly commented Aug 20, 2025

@lgarron, what's the state of the PR? Are you still experimenting, or do you want eyes on it?

@lgarron
Copy link
Member Author

lgarron commented Aug 21, 2025

@lgarron, what's the state of the PR? Are you still experimenting, or do you want eyes on it?

Eh, I don't really like it.

I wish specifying proper dependencies was more of a solved problem, but it's just not. In practice, this only saves up to a second of building, at the expense of making everything more fragile. :-/

I think I'd rather not land it, unless at some point the perf annoys us enough.

@lgarron
Copy link
Member Author

lgarron commented Aug 21, 2025

Looks like it also breaks https://github.com/lgarron/mak , which I'm sure I could fix but is just one more strike against this for me.

@jfly
Copy link
Member

jfly commented Aug 21, 2025

I think I'd rather not land it, unless at some point the perf annoys us enough.

I have no concerns about the performance. Feel free to close this out.

@lgarron lgarron closed this Aug 21, 2025
@lgarron lgarron deleted the artifact-dependencies branch August 21, 2025 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants