Skip to content

Commit

Permalink
fix(remix): Fix Remix version and TS checks.
Browse files Browse the repository at this point in the history
  • Loading branch information
onurtemizkan committed Sep 19, 2023
1 parent 663eb43 commit 687b10f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
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 687b10f

Please sign in to comment.