Closed bogdancondorachi closed 1 year ago
Hi @bogdancondorachi, thanks for the PR and fixing directory seperators, I have to admit I never tested them on windows...
The PR looks good but I'm not sure about issue 2. For me the vite.config.js
is the only source of truth and all config should happen there. The generated vite.config.php
just shares this config with PHP, so it should be always overwritten to be in sync. Maybe a header comment could be added to vite.config.php
to make this more clear, like // this is an auto-generated file, please make all configuration in your vite.config.js
. Is there any scenario where would need diverging config files?
Yeah, tbh I didn't have the issue on Windows with this path as it was the correct one for the OS, just on a client Linux server where it had to be '/' on Unix in order to find the correct path to the outDir.
Regarding the rewriting of the vite.config, you're right, I've also thought of it after the PR that it can cause further inconsistency issues (only use case scenario would be path differences between local/production but with the correct sep fix it kind of fixes the issue if you also do the build on production). Certainly, it should contain a commit to specify the purpose of the file. Also, I think it does not make sense to make unnecessary writes if the file exists and the values are the same.
I've added another commit where we check if the file exists already & has the same contents before attempting to write it, and the specific purpose commit.
Let me know your thoughts and if you need a new cleaner PR :)
Thanks :) Made some minor code changes and had to run the release script again, because the git tag somehow got lost in the PR
LGTM, thank you for pushing this :)
Hi @arnoson, I'm back with some improvement ideas :)
Issues
Fixes
sep
from thepath
module, the script will automatically use the appropriate separator for the operating system. This ensures that theoutDir
path will be formatted correctly for the current OStry-catch
block around the access function to check the vite.config file already exists. If the file exists, it will skip the automatic override. This way, if you manually edit the file, the script won't override the changes.Let me know your thoughts on these changes :)