Skip to content

Commit

Permalink
fix(remix): Fix Remix version and TS checks (#464)
Browse files Browse the repository at this point in the history
There was a bug caused by wrong parameter orders of `isV2` and `isTS` on server instrumentation step. 

Also improved Remix version checks, making them similar to svelte and next wizards.
  • Loading branch information
onurtemizkan authored Sep 19, 2023
1 parent 663eb43 commit 9cd16e5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@

feat(nextjs): Add telemetry collection to NextJS wizard (#458)
feat(wizard): Ask for confirmation to continue if git repo is not clean (#462)
fix(remix): Fix Remix version and TS checks (#464)


## 3.13.0

- enh(android): Show link to issues page after setup is complete (#448)
- feat(remix): Pass `org`, `project`, `url` to `upload-sourcemaps` script (#434)
- feat(remix): Pass `org`, `project`, `url` to `upload-sourcemaps` script (#434)
- feat(sourcemaps): Automatically enable source maps generation in `tsconfig.json` (#449)
- feat(sveltekit): Add telemetry collection (#455)
- fix(nextjs): Add selfhosted url in `next.config.js` (#438)
Expand Down
2 changes: 1 addition & 1 deletion src/remix/remix-wizard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ async function runRemixWizardWithTelemetry(

await traceStep('Initialize Sentry on server entry', async () => {
try {
await initializeSentryOnEntryServer(dsn, isTS, isV2);
await initializeSentryOnEntryServer(dsn, isV2, isTS);
} catch (e) {
clack.log.warn(`Could not initialize Sentry on server entry.
Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/`);
Expand Down
15 changes: 12 additions & 3 deletions src/remix/sdk-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import * as url from 'url';
// @ts-expect-error - clack is ESM and TS complains about that. It works though
import clack from '@clack/prompts';
import chalk from 'chalk';
import { parse } from 'semver';
import { gte, minVersion } from 'semver';

// @ts-expect-error - magicast is ESM and TS complains about that. It works though
import { builders, generateCode, loadFile, writeFile } from 'magicast';
Expand Down Expand Up @@ -97,8 +97,17 @@ export function isRemixV2(
packageJson: PackageDotJson,
): boolean {
const remixVersion = getPackageVersion('@remix-run/react', packageJson);
const remixVersionMajor = remixVersion && parse(remixVersion)?.major;
const isV2Remix = remixVersionMajor && remixVersionMajor >= 2;
if (!remixVersion) {
return false;
}

const minVer = minVersion(remixVersion);

if (!minVer) {
return false;
}

const isV2Remix = gte(minVer, '2.0.0');

return isV2Remix || remixConfig?.future?.v2_errorBoundary || false;
}
Expand Down

0 comments on commit 9cd16e5

Please sign in to comment.