-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Fix astro add
with third-party integrations
#4270
Conversation
🦋 Changeset detectedLatest commit: f4ac4a1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! Will note it's a side effect of bad dash handling. So for a package called astro-long-pkg-name
, it'll generate long()
instead of longPkgName()
. Might be worth a more sustainable fix?
That's a good point, this was a lazy fix. I'll do what you're suggesting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am forever in your idebt
@@ -289,11 +289,30 @@ async function parseAstroConfig(configURL: URL): Promise<t.File> { | |||
return result; | |||
} | |||
|
|||
// Convert an arbitrary NPM package name into a JS identifier | |||
// Some examples: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now that we're post v1.0 I'm feeling the burn to start adding some tests to anything like this that we missed for v1.0, but okay to keep kicking this can a bit longer until we're out of the release bug swarm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@FredKSchott +1! I vote using Vitest for this for snapshot testing though. The lack of snapshots in create-astro
made for a tough test authoring experience and brittle tests we ended up removing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Merging so that we can get this into the next release
Changes
Previously, running
astro add astro-pkg
, would generate weird code:With this PR, the generated code will now be:
Testing
Nah, we don't test
astro add
Docs
N/A