diff options
Diffstat (limited to 'packages/upgrade')
-rw-r--r-- | packages/upgrade/CHANGELOG.md | 34 | ||||
-rw-r--r-- | packages/upgrade/src/messages.ts | 5 | ||||
-rw-r--r-- | packages/upgrade/test/utils.js | 21 |
3 files changed, 36 insertions, 24 deletions
diff --git a/packages/upgrade/CHANGELOG.md b/packages/upgrade/CHANGELOG.md index 825420dad..969c359b6 100644 --- a/packages/upgrade/CHANGELOG.md +++ b/packages/upgrade/CHANGELOG.md @@ -27,3 +27,37 @@ ```bash pnpm dlx @astrojs/upgrade ``` + +## 0.1.1 + +### Patch Changes + +- [#9213](https://github.com/withastro/astro/pull/9213) [`54e57fe9d`](https://github.com/withastro/astro/commit/54e57fe9d7600c888fc7b0bc3f5dbca5543f36cd) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Fix unhandled error when running `@astrojs/upgrade beta` outside of a monorepo + +## 0.1.0 + +### Minor Changes + +- [#8525](https://github.com/withastro/astro/pull/8525) [`5a3875018`](https://github.com/withastro/astro/commit/5a38750188d1af30ea5277cea70f454c363b5062) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Initial release! + + `@astrojs/upgrade` is an automated command-line tool for upgrading Astro and your official Astro integrations together. + + Inside of your existing `astro` project, run the following command to install the `latest` version of your integrations. + + **With NPM:** + + ```bash + npx @astrojs/upgrade + ``` + + **With Yarn:** + + ```bash + yarn dlx @astrojs/upgrade + ``` + + **With PNPM:** + + ```bash + pnpm dlx @astrojs/upgrade + ``` diff --git a/packages/upgrade/src/messages.ts b/packages/upgrade/src/messages.ts index e159a6f06..ae2ec49eb 100644 --- a/packages/upgrade/src/messages.ts +++ b/packages/upgrade/src/messages.ts @@ -1,7 +1,6 @@ /* eslint no-console: 'off' */ import { color, label, spinner as load } from '@astrojs/cli-kit'; import { align } from '@astrojs/cli-kit/utils'; -import semverParse from 'semver/functions/parse.js'; import terminalLink from 'terminal-link'; import detectPackageManager from 'which-pm-runs'; import type { PackageInfo } from './actions/context.js'; @@ -110,8 +109,8 @@ export const upgrade = async (packageInfo: PackageInfo, text: string) => { const bg = isMajor ? (v: string) => color.bgYellow(color.black(` ${v} `)) : color.green; const style = isMajor ? color.yellow : color.green; const symbol = isMajor ? '▲' : '●'; - const toVersion = semverParse(targetVersion)!; - const version = `v${toVersion.version}`; + const toVersion = targetVersion.replace(/^\D+/, ''); + const version = `v${toVersion}`; const length = 12 + name.length + text.length + version.length; if (length > stdout.columns) { diff --git a/packages/upgrade/test/utils.js b/packages/upgrade/test/utils.js index d57ceacd3..ff5d5dd83 100644 --- a/packages/upgrade/test/utils.js +++ b/packages/upgrade/test/utils.js @@ -1,4 +1,3 @@ -import fs from 'node:fs'; import { setStdout } from '../dist/index.js'; import stripAnsi from 'strip-ansi'; @@ -30,23 +29,3 @@ export function setup() { }, }; } - -const resetBasicFixture = async () => { - const packagePath = new URL('./fixtures/basic/package.json', import.meta.url); - const packageJsonData = JSON.parse( - await fs.promises.readFile(packagePath, { encoding: 'utf-8' }) - ); - const overriddenPackageJson = Object.assign(packageJsonData, { - dependencies: { - astro: '1.0.0', - }, - }); - - return Promise.all([ - fs.promises.writeFile(packagePath, JSON.stringify(overriddenPackageJson, null, 2), { - encoding: 'utf-8', - }), - ]); -}; - -export const resetFixtures = () => Promise.allSettled([resetBasicFixture()]); |