Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: create parent dirs for dist folder if don't exist #845

Merged
merged 5 commits into from
Aug 8, 2024

Conversation

ZibanPirate
Copy link
Contributor

fixes #826

there two more places where we still use create_dir instead of create_dir_all here. maybe we want to fix those as well? and ideally have a linting rule to always use create_dir_all instead of create_dir as we already use a mix of both accross the repo.

steps to reproduce

  • build the project. cargo build
  • navigate to examples/yew
  • modify the dist value in examples/yew/Trunk.toml to something like dist = "dist/sub".
  • run the locally built version of trunk on this directory: ../../target/debug/trunk build

on main you should get the error that parent dir doesn't exists.
on this branch, the parent dir should be created and the build passes.

@ctron
Copy link
Collaborator

ctron commented Aug 8, 2024

Thanks for the PR. Makes perfect sense.

I think this could even be improved as create_dir_all will handle a "does already exists" case.

If there are similar cases like that, it would be great to fix them as well in the same PR if you can find the time.

@ZibanPirate ZibanPirate force-pushed the ensure_parent_dirs_for_dist_folder branch from 8b67f58 to a3b88ce Compare August 8, 2024 08:30
@ctron ctron merged commit fff0072 into trunk-rs:main Aug 8, 2024
60 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Trunk fails to create a target directory when a parent directory does not exist
2 participants