-
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(nuxt): Add downgrade path to nitro 2.9.7
Also adds automatic resolutions for @vercel/nft and ofetch. See: getsentry/sentry-javascript#14514
- Loading branch information
1 parent
8af901c
commit 7874d60
Showing
8 changed files
with
253 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import resolve from 'resolve'; | ||
import * as path from 'path'; | ||
import * as fs from 'fs'; | ||
// @ts-expect-error - clack is ESM and TS complains about that. It works though | ||
import clack from '@clack/prompts'; | ||
import chalk from 'chalk'; | ||
import * as Sentry from '@sentry/node'; | ||
import { abort } from './clack-utils'; | ||
import { PNPM } from './package-manager'; | ||
|
||
/** | ||
* Unlike `getPackageVersion`, this helper uses the `resolve` | ||
* npm package to resolve the actually installed version of | ||
* a package and is not limited to direct dependencies. | ||
*/ | ||
export async function getInstalledPackageVersion(pkg: string) { | ||
const isPnpm = PNPM.detect(); | ||
try { | ||
const pkgJson: { version: string } = JSON.parse( | ||
fs | ||
.readFileSync( | ||
resolve.sync(`${pkg}/package.json`, { | ||
basedir: isPnpm | ||
? path.join(process.cwd(), 'node_modules', '.pnpm') | ||
: process.cwd(), | ||
preserveSymlinks: isPnpm, | ||
}), | ||
) | ||
.toString(), | ||
); | ||
return pkgJson.version; | ||
} catch (e: unknown) { | ||
clack.log.error(`Error while evaluating version of package ${pkg}.`); | ||
clack.log.info( | ||
chalk.dim( | ||
typeof e === 'object' && e != null && 'toString' in e | ||
? e.toString() | ||
: typeof e === 'string' | ||
? e | ||
: 'Unknown error', | ||
), | ||
); | ||
Sentry.captureException('Error while setting up the Nuxt SDK'); | ||
await abort('Exiting Wizard'); | ||
} | ||
} |
Oops, something went wrong.