-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Adds configuration file update tool to CLI #783
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
Conversation
Haha sick! Man I was working on something like this the last two days, wish I had known you were looking at it too... I'll pull this down and play with it today or tomorrow, there was a bunch of stuff I wasn't sure how to solve that I'm curious if you were able to fix. The main messy points for me were preserving any third-party plugins and dealing with any weird structuring, like splitting things out into extra variables or god forbid files. |
It's possible that I missed something. This stuff is not easy. In a nutshell, I use real |
I just tried to run it against the default config from 0.7.4 but am getting this result: Here's the repo I was hacking around in in case you're curious, still a mess but whatever. |
Can you share your I assumed that all properties are required. The transform is very lenient and the validation rules can be relaxed quite a bit. This could also be related to the Node version. |
I removed Can you think of any other properties that may not be present in the config file users will try to update? |
This is the file I was trying to update: https://unpkg.com/[email protected]/defaultConfig.stub.js Technically every key in the config file is optional although my current repo doesn't handle that gracefully either. |
Ok. I replicated the issue. This is caused by requiring a missing module.
My guess is that you simply copied a stub over instead of using the This configuration file probably does not work for building either. I will refine this PR to handle missing keys in a more graceful way. |
Ah yeah good catch, my mistake. That said that kind of points to the more challenging issue I was trying to solve yesterday, where someone may have third party plugin references:
The only way I could think to handle it is by treating the upgrade process more like string replacement than actual manipulation of the config object, since I'd want to preserve those require statements in the new config file. Tricky shit :/ I think the ultimate approach would to do it with babel but I don't know if I really want to go down that road, hah... |
There might be a way to leverage what I am already doing for the container plugin. I think I can replace the external dependencies with placeholders and then swap them back in when generating the new config file. Do you have any real-life examples of external plugins? |
I am going to close this PR for now for a few reasons
|
I'll put together a little demo project today that includes some third party plugins and multiple different config files as test inputs and we can keep hacking on this. I've decided I'm going to push the final v1.0 release back a few more weeks so we can really polish the docs before opening the floodgates so we have a bit of time 👍 |
Here is everything you need to know about this update. Please take a good look at what changed and the test results before merging this pull request. ### What changed? #### ✳️ semver (7.7.1 → 7.7.2) · [Repo](https://github.com/npm/node-semver) · [Changelog](https://github.com/npm/node-semver/blob/main/CHANGELOG.md) <details> <summary>Release Notes</summary> <h4><a href="https://github.com/npm/node-semver/releases/tag/v7.7.2">7.7.2</a></h4> <blockquote><h2 dir="auto"> <a href="https://bounce.depfu.com/github.com/npm/node-semver/compare/v7.7.1...v7.7.2">7.7.2</a> (2025-05-12)</h2> <h3 dir="auto">Bug Fixes</h3> <ul dir="auto"> <li> <a href="https://bounce.depfu.com/github.com/npm/node-semver/commit/fcafb61ed566ff8ccf24818dd94b76738f037aa4"><code class="notranslate">fcafb61</code></a> <a href="https://bounce.depfu.com/github.com/npm/node-semver/pull/780">#780</a> add missing <code class="notranslate">'use strict'</code> directives (<a href="https://bounce.depfu.com/github.com/npm/node-semver/pull/780">#780</a>) (<a href="https://bounce.depfu.com/github.com/Fdawgs">@Fdawgs</a>)</li> <li> <a href="https://bounce.depfu.com/github.com/npm/node-semver/commit/c99f336fa3bdff465652f9041eab2127d2f52eb2"><code class="notranslate">c99f336</code></a> <a href="https://bounce.depfu.com/github.com/npm/node-semver/pull/781">#781</a> prerelease identifier starting with digits (<a href="https://bounce.depfu.com/github.com/npm/node-semver/pull/781">#781</a>) (<a href="https://bounce.depfu.com/github.com/mbtools">@mbtools</a>)</li> </ul> <h3 dir="auto">Chores</h3> <ul dir="auto"> <li> <a href="https://bounce.depfu.com/github.com/npm/node-semver/commit/c760403b935d3ad35f83e9bbe5ebe1badef2fc71"><code class="notranslate">c760403</code></a> <a href="https://bounce.depfu.com/github.com/npm/node-semver/pull/784">#784</a> template-oss-apply for workflow permissions (<a href="https://bounce.depfu.com/github.com/npm/node-semver/pull/784">#784</a>) (<a href="https://bounce.depfu.com/github.com/wraithgar">@wraithgar</a>)</li> <li> <a href="https://bounce.depfu.com/github.com/npm/node-semver/commit/2677f2a88334b0e728dbfe9ad9f5f57458437c87"><code class="notranslate">2677f2a</code></a> <a href="https://bounce.depfu.com/github.com/npm/node-semver/pull/778">#778</a> bump @npmcli/template-oss from 4.23.6 to 4.24.3 (<a href="https://bounce.depfu.com/github.com/npm/node-semver/pull/778">#778</a>) (<a href="https://bounce.depfu.com/github.com/dependabot">@dependabot</a>[bot], <a href="https://bounce.depfu.com/github.com/npm-cli-bot">@npm-cli-bot</a>)</li> </ul></blockquote> <p><em>Does any of this look wrong? <a href="https://depfu.com/packages/npm/semver/feedback">Please let us know.</a></em></p> </details> <details> <summary>Commits</summary> <p><a href="https://github.com/npm/node-semver/compare/30c438bb46c74f319aa8783f96d233ebf5f4a90d...281055e7716ef0415a8826972471331989ede58c">See the full diff on Github</a>. The new version differs by 6 commits:</p> <ul> <li><a href="https://github.com/npm/node-semver/commit/281055e7716ef0415a8826972471331989ede58c"><code>chore: release 7.7.2 (#783)</code></a></li> <li><a href="https://github.com/npm/node-semver/commit/fcafb61ed566ff8ccf24818dd94b76738f037aa4"><code>fix: add missing `'use strict'` directives (#780)</code></a></li> <li><a href="https://github.com/npm/node-semver/commit/c760403b935d3ad35f83e9bbe5ebe1badef2fc71"><code>chore: template-oss-apply for workflow permissions (#784)</code></a></li> <li><a href="https://github.com/npm/node-semver/commit/c99f336fa3bdff465652f9041eab2127d2f52eb2"><code>fix: prerelease identifier starting with digits (#781)</code></a></li> <li><a href="https://github.com/npm/node-semver/commit/2677f2a88334b0e728dbfe9ad9f5f57458437c87"><code>chore: bump @npmcli/template-oss from 4.23.6 to 4.24.3 (#778)</code></a></li> <li><a href="https://github.com/npm/node-semver/commit/0b98655dbc1a9eb79370ed80f557be98d1c06587"><code>chore: bump @npmcli/template-oss from 4.23.4 to 4.23.6 (#760)</code></a></li> </ul> </details> ---  [Depfu](https://depfu.com) will automatically keep this PR conflict-free, as long as you don't add any commits to this branch yourself. You can also trigger a rebase manually by commenting with `@depfu rebase`. <details><summary>All Depfu comment commands</summary> <blockquote><dl> <dt>@depfu rebase</dt><dd>Rebases against your default branch and redoes this update</dd> <dt>@depfu recreate</dt><dd>Recreates this PR, overwriting any edits that you've made to it</dd> <dt>@depfu merge</dt><dd>Merges this PR once your tests are passing and conflicts are resolved</dd> <dt>@depfu cancel merge</dt><dd>Cancels automatic merging of this PR</dd> <dt>@depfu close</dt><dd>Closes this PR and deletes the branch</dd> <dt>@depfu reopen</dt><dd>Restores the branch and reopens this PR (if it's closed)</dd> <dt>@depfu pause</dt><dd>Ignores all future updates for this dependency and closes this PR</dd> <dt>@depfu pause [minor|major]</dt><dd>Ignores all future minor/major updates for this dependency and closes this PR</dd> <dt>@depfu resume</dt><dd>Future versions of this dependency will create PRs again (leaves this PR as is)</dd> </dl></blockquote> </details> Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
Summery
Users can now easily update their v0 configuration file to v1 configuration format using the
update
command.What else is in this?
container
property to thetheme
in the default configuration stub.What is NOT in this
The output is very verbose. In the future I want to:
colors
andspacing
like we currently do in the default configuration stub; if possible.