feat(devkit): allow to customize overwrite mode in generateFiles
Adds a new capability to choose how to handle already existing target files when using a generator.
Current Behavior
If a target file already exists, generateFiles overwrites existing files. It is not always the intended behaviour, forcing to have custom code in generators to check for already existing files.
Expected Behavior
A new (optional) argument to generateFiles allows to choose the behavior when a target file already exists: overwrite (current & still default behavior), keep, throw.
Note: nx affected fails on my setup, so could only check by hand and all tests including new tests pass ok on devkit.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| nx-dev | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Nov 7, 2023 10:52am |
☁️ Nx Cloud Report
CI is running/has finished running commands for commit 1e9fa89300dcc7b767592768558730d9ff38efd8. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.
📂 See all runs for this CI Pipeline Execution
✅ Successfully ran 5 targets
nx affected --target=e2e --base=60cb992173a299981210c5921821a0e6904ca32c --head=1e9fa89300dcc7b767592768558730d9ff38efd8 --parallel=1nx affected --targets=lint,test,build --base=60cb992173a299981210c5921821a0e6904ca32c --head=1e9fa89300dcc7b767592768558730d9ff38efd8 --parallel=3nx run-many -t check-imports check-commit check-lock-files check-codeowners documentation --parallel=1 --no-dtenx-cloud record -- nx format:check --base=60cb992173a299981210c5921821a0e6904ca32c --head=1e9fa89300dcc7b767592768558730d9ff38efd8nx documentation --no-dte
Sent with 💌 from NxCloud.
@FrozenPandaz @vsavkin @bcabanes Hi, I'm not familiar with the PR review process for Nx. Should this topic be discussed somewhere to get the PR under review? I just submitted it, but maybe I'm missing a step in the process. Thanks for the amazing work on Nx :) Best,
Ping Is there something to do to make sure someone is aware of this PR ? @FrozenPandaz @vsavkin @bcabanes
Thanks! Should I resolve the conflicts, or do maintainers prefer to do it?
@AgentEnder @isaacplmann Happy to move this forward, how should I proceed?
@AgentEnder @isaacplmann Any way to move forward?
Go ahead and merge the conflicts
@isaacplmann Alright, I did I don't know why some builds failed. It doesn't look related to this PR. What do you think?
I agree, they look unrelated. I relaunched the CI pipeline
How should we move forward @isaacplmann ? Now just linux failed, macos passed 🤔
I am unable to rebase + push this up since the fork is on an org account rather than a personal user account. Can you rebase with latest? I think the e2e errors should go away.
Ah bummer
Just did rebase + push 🤞
Looks like it's related to storybook e2e. Should not block this PR right? Or should I do something? @AgentEnder
No, not your fault. We're working on fixing that e2e test.
Ok, just rebased and pushed, looks like tests are green now!
@FrozenPandaz @vsavkin should we merge that before main moves ahead again?
That would be great 😄
Test seems to be broken again. How to get this PR merged? We actually need this facility in our workflow. I respect if you don't plan to merge, just please let me know so that I take appropriate action and implement that in our project instead of the Nx repo.
Thanks and good luck for the new releases!
@isaacplmann What's the way forward?
@qortex thank you so much for your contribution! Will you have time to address the suggested changes, or should I go ahead and fix these, instead?
Closing in favor of: #26354. We'll get this merged in.
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.