-
Notifications
You must be signed in to change notification settings - Fork 5
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
Compile within single slice only #20
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tests aren't fully green yet, but I've made one pass for this new approach.
We weren't using this at all
This will allow our CLI to call this from the outside and provide an appropriate --target for each slice.
This keeps the assets per slice completely self contained, and will allow us to have abitrarily deep structures of compiled slice asset directories while still retaining clarity.
This is invalid now that we're targeting single app or slice assets.
This means that .ts files will have .js extensions when referencing them, as before.
timriley
force-pushed
the
single-assets-dir-only
branch
from
February 3, 2024 00:29
9f10bf0
to
246826b
Compare
This means there’s now only one place we need to determine the root: index.ts
These are in two places for now, but at least this makes this special string a little clearer.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Update our esbuild wrapper to compile a single assets directory at a time.
Previously, we crawled the entire app structure to find all assets directories (within the app and slices) and processed them all at once. This had some downsides:
By processing a single assets directory at once, we have a much simpler interface with esbuild: we're not pushing it to do things outside its comfort zone. It also means we can eliminate that redundant logic and continue to leverage our Ruby code as the canonical source of knowledge around slices and the overall Hanami app structure.
To process a single directory and output the compiled files into the relevant location, we expect these to be passed as two new arguments when invoking
config/assets.js
:--path
: the path for the app or slice containing the assets to process; e.g.app
orslices/admin
--dest
: the directory to putout the compiled files; e.g.public/assets
orpublic/assets/admin
(in the case of the admin slice)These args will not need to be supplied by the user. Instead, they'll be provided by the
hanami assets compile
andhanami assets watch
commands, which will determine the slices with assets and then invoke oneconfig/assets.js
process per slice, along with the relevant CLI arguments. This means the user experience is still simple and streamlined.