Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit 17dc382

Browse files
feat: use tsx (#246)
1 parent 966d0fa commit 17dc382

File tree

5 files changed

+16
-20
lines changed

5 files changed

+16
-20
lines changed

cypress/support/commands.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ function login({
4949
email?: string;
5050
} = {}) {
5151
cy.then(() => ({ email })).as("user");
52-
cy.exec(
53-
`npx ts-node -r tsconfig-paths/register ./cypress/support/create-user.ts "${email}"`,
54-
).then(({ stdout }) => {
55-
const cookieValue = stdout
56-
.replace(/.*<cookie>(?<cookieValue>.*)<\/cookie>.*/s, "$<cookieValue>")
57-
.trim();
58-
cy.setCookie("__session", cookieValue);
59-
});
52+
cy.exec(`npx tsx ./cypress/support/create-user.ts "${email}"`).then(
53+
({ stdout }) => {
54+
const cookieValue = stdout
55+
.replace(/.*<cookie>(?<cookieValue>.*)<\/cookie>.*/s, "$<cookieValue>")
56+
.trim();
57+
cy.setCookie("__session", cookieValue);
58+
},
59+
);
6060
return cy.get("@user");
6161
}
6262

@@ -75,9 +75,7 @@ function cleanupUser({ email }: { email?: string } = {}) {
7575
}
7676

7777
function deleteUserByEmail(email: string) {
78-
cy.exec(
79-
`npx ts-node -r tsconfig-paths/register ./cypress/support/delete-user.ts "${email}"`,
80-
);
78+
cy.exec(`npx tsx ./cypress/support/delete-user.ts "${email}"`);
8179
cy.clearCookie("__session");
8280
}
8381

cypress/support/create-user.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Use this to create a new user and login with that user
22
// Simply call this with:
3-
// npx ts-node -r tsconfig-paths/register ./cypress/support/create-user.ts [email protected]
3+
// npx tsx ./cypress/support/create-user.ts [email protected]
44
// and it will log out the cookie value you can use to interact with the server
55
// as that new user.
66

cypress/support/delete-user.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Use this to delete a user by their email
22
// Simply call this with:
3-
// npx ts-node -r tsconfig-paths/register ./cypress/support/delete-user.ts [email protected]
3+
// npx tsx ./cypress/support/delete-user.ts [email protected]
44
// and that user will get deleted
55

66
import { PrismaClientKnownRequestError } from "@prisma/client/runtime/library";

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,6 @@
9494
"prisma": "^5.19.1",
9595
"start-server-and-test": "^2.0.7",
9696
"tailwindcss": "^3.4.10",
97-
"ts-node": "^10.9.2",
98-
"tsconfig-paths": "^4.2.0",
9997
"typescript": "^5.6.2",
10098
"vite": "^5.4.3",
10199
"vite-tsconfig-paths": "^4.3.2",
@@ -105,6 +103,6 @@
105103
"node": ">=18.0.0"
106104
},
107105
"prisma": {
108-
"seed": "ts-node -r tsconfig-paths/register prisma/seed.ts"
106+
"seed": "tsx prisma/seed.ts"
109107
}
110108
}

remix.init/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ const semver = require("semver");
1010
const cleanupCypressFiles = ({ fileEntries, packageManager }) =>
1111
fileEntries.flatMap(([filePath, content]) => {
1212
const newContent = content.replace(
13-
new RegExp("npx ts-node", "g"),
14-
packageManager.name === "bun" ? "bun" : `${packageManager.exec} ts-node`,
13+
new RegExp("npx tsx", "g"),
14+
packageManager.name === "bun" ? "bun" : `${packageManager.exec} tsx`,
1515
);
1616

1717
return [fs.writeFile(filePath, newContent)];
@@ -87,13 +87,13 @@ const updatePackageJson = ({ APP_NAME, packageJson, packageManager }) => {
8787
name: APP_NAME,
8888
devDependencies:
8989
packageManager.name === "bun"
90-
? removeUnusedDependencies(devDependencies, ["ts-node"])
90+
? removeUnusedDependencies(devDependencies, ["tsx"])
9191
: devDependencies,
9292
prisma: {
9393
...prisma,
9494
seed:
9595
packageManager.name === "bun"
96-
? prismaSeed.replace("ts-node", "bun")
96+
? prismaSeed.replace("tsx", "bun")
9797
: prismaSeed,
9898
},
9999
scripts,

0 commit comments

Comments
 (0)