Skip to content
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

astro add with a release tag adds invalid code #12359

Closed
1 task done
Fryuni opened this issue Nov 2, 2024 · 0 comments · Fixed by #12363
Closed
1 task done

astro add with a release tag adds invalid code #12359

Fryuni opened this issue Nov 2, 2024 · 0 comments · Fixed by #12363
Labels
needs triage Issue needs to be triaged

Comments

@Fryuni
Copy link
Member

Fryuni commented Nov 2, 2024

Astro Info

Astro                    v5.0.0-beta.6
Node                     v20.17.0
System                   Linux (x64)
Package Manager          pnpm
Output                   static
Adapter                  none
Integrations             none

Not something from the beta, also happens on main

Describe the Bug

Calling astro add package@release-tag installs the package correctly but generates an invalid import to add on the config file:

❯ pnpm astro add @inox-tools/astro-when@beta

> [email protected] astro /tmp/tmp.qhvZ2MYeVE
> astro "add" "@inox-tools/astro-when@beta"

✔ Resolving packages...

  Astro will run the following command:
  If you skip this step, you can always run it yourself later

 ╭────────────────────────────────────────────────╮
 │ pnpm add @inox-tools/astro-when@^1.0.0-beta.0  │
 ╰────────────────────────────────────────────────╯

✔ Continue? … yes
✔ Installing dependencies...

  Astro will make the following changes to your config file:

 ╭ astro.config.mjs ─────────────────────────────────────────╮
 │ // @ts-check                                              │
 │ import { defineConfig } from 'astro/config';              │
 │                                                           │
 │ import inoxToolswhen@beta from '@inox-tools/astro-when';  │
 │                                                           │
 │ // https://astro.build/config                             │
 │ export default defineConfig({                             │
 │   integrations: [inoxToolswhen@beta()]                    │
 │ });                                                       │
 ╰───────────────────────────────────────────────────────────╯

? Continue? › (Y/n)

What's the expected result?

The generated change should have an import with either just the name of the package, removing any version info, or replace the invalid characters from the version part to make a valid identifier.

For the example above, either inoxToolswhen or inoxToolswhenbeta would work.

Link to Minimal Reproducible Example

Any project

Participation

  • I am willing to submit a pull request for this issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Issue needs to be triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant