Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(create-remix): only update "*" versions for Remix dependencies #8458

Merged
merged 5 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/wicked-suits-heal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-remix": patch
---

Only update `*` versions for Remix dependencies
1 change: 1 addition & 0 deletions contributors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- ahabhgk
- ahbruns
- ahmedeldessouki
- ahuth
- aiji42
- airjp73
- airondumael
Expand Down
26 changes: 26 additions & 0 deletions packages/create-remix/__tests__/create-remix-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 5 additions & 1 deletion packages/create-remix/__tests__/fixtures/stack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 4 additions & 1 deletion packages/create-remix/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading