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

create-astro: Add fallback values when registry fails to fetch package version #10255

Merged
merged 10 commits into from
Mar 7, 2024

Conversation

natemoo-re
Copy link
Member

Changes

  • Fixes an issue reported in Discord where a user's package.json ended up having "@astrojs/check": "^undefined" and "typescript": "^undefined" in the dependencies
  • Updates our internal build script with some new logic to extract a few current package versions at build time. These are exposed as process.env.ASTRO_VERSION, process.env.ASTRO_CHECK_VERSION, and process.env.TYPESCRIPT_VERSION.
  • Instead of erroring or setting to latest when a network version check fails, we use the most recent version (at build-time) of workspace packages as a fallback. Since we already use the ^ operator, this will result in more stable behavior than latest.

Testing

Updates the TypeScript logic test to check that there are no undefined values in package.json. Not testing the exact version value since that isn't a stable value.

Docs

N/A, bug fix.

Copy link

changeset-bot bot commented Feb 27, 2024

🦋 Changeset detected

Latest commit: baf38a6

The changes in this PR will be included in the next version bump.

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

@natemoo-re natemoo-re changed the title [create-astro]: Add fallback values when registry fails to fetch package version create-astro: Add fallback values when registry fails to fetch package version Feb 27, 2024
@github-actions github-actions bot added the pkg: create-astro Related to the `create-astro` package (scope) label Feb 27, 2024
scripts/cmd/build.js Outdated Show resolved Hide resolved
Copy link
Member

@florian-lefebvre florian-lefebvre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall, just a little question about the fixture

Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating it. This looks great!

@natemoo-re natemoo-re merged commit 2aec2cd into main Mar 7, 2024
4 checks passed
@natemoo-re natemoo-re deleted the create-astro-undefined branch March 7, 2024 18:14
@astrobot-houston astrobot-houston mentioned this pull request Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: create-astro Related to the `create-astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants