diff --git a/.changeset/wicked-suits-heal.md b/.changeset/wicked-suits-heal.md new file mode 100644 index 00000000000..5080e1f40da --- /dev/null +++ b/.changeset/wicked-suits-heal.md @@ -0,0 +1,5 @@ +--- +"create-remix": patch +--- + +Only update `*` versions for Remix dependencies diff --git a/contributors.yml b/contributors.yml index b3e5172e13f..abeb53b7a86 100644 --- a/contributors.yml +++ b/contributors.yml @@ -10,6 +10,7 @@ - ahabhgk - ahbruns - ahmedeldessouki +- ahuth - aiji42 - airjp73 - airondumael diff --git a/packages/create-remix/__tests__/create-remix-test.ts b/packages/create-remix/__tests__/create-remix-test.ts index 2d73c904b04..68f28938357 100644 --- a/packages/create-remix/__tests__/create-remix-test.ts +++ b/packages/create-remix/__tests__/create-remix-test.ts @@ -968,6 +968,32 @@ describe("create-remix CLI", () => { } }); + it("changes star dependencies for only Remix packages", async () => { + let projectDir = getProjectDir("local-directory"); + + let { status } = await execCreateRemix({ + args: [ + projectDir, + "--template", + path.join(__dirname, "fixtures", "stack"), + "--no-git-init", + "--no-install", + ], + }); + + expect(status).toBe(0); + + let packageJsonPath = path.join(projectDir, "package.json"); + let packageJson = JSON.parse(String(fse.readFileSync(packageJsonPath))); + let dependencies = packageJson.dependencies; + + expect(dependencies).toMatchObject({ + "@remix-run/react": expect.any(String), + remix: expect.any(String), + "not-remix": "*", + }); + }); + describe("when project directory contains files", () => { describe("interactive shell", () => { let interactive = true; diff --git a/packages/create-remix/__tests__/fixtures/stack/package.json b/packages/create-remix/__tests__/fixtures/stack/package.json index 6b54cd33fd9..8f2b86d792e 100644 --- a/packages/create-remix/__tests__/fixtures/stack/package.json +++ b/packages/create-remix/__tests__/fixtures/stack/package.json @@ -7,7 +7,11 @@ "dev": "remix dev", "start": "remix-serve build/index.js" }, - "dependencies": {}, + "dependencies": { + "@remix-run/react": "*", + "not-remix": "*", + "remix": "*" + }, "devDependencies": {}, "engines": { "node": ">=18.0.0" diff --git a/packages/create-remix/index.ts b/packages/create-remix/index.ts index 5bd6baa15c8..2bc3a41f685 100644 --- a/packages/create-remix/index.ts +++ b/packages/create-remix/index.ts @@ -720,7 +720,10 @@ async function updatePackageJSON(ctx: Context) { for (let dependency in dependencies) { let version = dependencies[dependency]; - if (version === "*") { + if ( + (dependency.startsWith("@remix-run/") || dependency === "remix") && + version === "*" + ) { dependencies[dependency] = semver.prerelease(ctx.remixVersion) ? // Templates created from prereleases should pin to a specific version ctx.remixVersion