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

update ts-node to tsx #6393

Merged
merged 2 commits into from
Nov 5, 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
10 changes: 5 additions & 5 deletions content/100-getting-started/01-quickstart-sqlite.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Next, initialize a TypeScript project using npm:

```terminal
npm init -y
npm install typescript ts-node @types/node --save-dev
npm install typescript tsx @types/node --save-dev
```

This creates a `package.json` with an initial setup for your TypeScript app.
Expand Down Expand Up @@ -184,7 +184,7 @@ Next, execute the script with the following command:
<cmd>

```terminal
npx ts-node script.ts
npx tsx script.ts
```
</cmd>

Expand Down Expand Up @@ -238,7 +238,7 @@ Execute the script again:
<cmd>

```terminal
npx ts-node script.ts
npx tsx script.ts
```

</cmd>
Expand Down Expand Up @@ -308,7 +308,7 @@ Run the query by executing the script again:
<cmd>

```terminal
npx ts-node script.ts
npx tsx script.ts
```

</cmd>
Expand Down Expand Up @@ -361,7 +361,7 @@ Run the script again to see the results of the nested read query:
<cmd>

```terminal
npx ts-node script.ts
npx tsx script.ts
```

</cmd>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Next, initialize a TypeScript project and add the Prisma CLI as a development de

```terminal copy
npm init -y
npm install prisma typescript ts-node @types/node --save-dev
npm install prisma typescript tsx @types/node --save-dev
```

This creates a `package.json` with an initial setup for your TypeScript app.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Next, initialize a TypeScript project and add the Prisma CLI as a development de

```terminal copy
npm init -y
npm install prisma typescript ts-node @types/node --save-dev
npm install prisma typescript tsx @types/node --save-dev
```

This creates a `package.json` with an initial setup for your TypeScript app.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Next, initialize a TypeScript project and add the Prisma CLI as a development de

```terminal copy
npm init -y
npm install prisma typescript ts-node @types/node --save-dev
npm install prisma typescript tsx @types/node --save-dev
```

This creates a `package.json` with an initial setup for your TypeScript app.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Next, initialize a TypeScript project and add the Prisma CLI as a development de

```terminal copy
npm init -y
npm install prisma typescript ts-node @types/node --save-dev
npm install prisma typescript tsx @types/node --save-dev
```

This creates a `package.json` with an initial setup for your TypeScript app.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Next, initialize a TypeScript project and add the Prisma CLI as a development de

```terminal copy
npm init -y
npm install prisma typescript ts-node @types/node --save-dev
npm install prisma typescript tsx @types/node --save-dev
```

This creates a `package.json` with an initial setup for your TypeScript app.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Next, initialize a TypeScript project and add the Prisma CLI as a development de

```terminal copy
npm init -y
npm install prisma typescript ts-node @types/node --save-dev
npm install prisma typescript tsx @types/node --save-dev
```

This creates a `package.json` with an initial setup for your TypeScript app.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ async function main() {
Now run the code with this command:

```terminal copy
npx ts-node index.ts
npx tsx index.ts
```

This should print an empty array because there are no `User` records in the database yet:
Expand Down Expand Up @@ -109,7 +109,7 @@ Notice that you're passing the [`include`](/orm/prisma-client/queries/select-fie
Run the code with this command:

```terminal copy
npx ts-node index.ts
npx tsx index.ts
```

The output should look similar to this:
Expand Down Expand Up @@ -193,7 +193,7 @@ async function main() {
Now run the code using the same command as before:

```terminal copy
npx ts-node index.ts
npx tsx index.ts
```

You will see the following output:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ async function main() {
Now run the code with this command:

```terminal copy
npx ts-node index.ts
npx tsx index.ts
```

This should print an empty array because there are no `User` records in the database yet:
Expand Down Expand Up @@ -109,7 +109,7 @@ Notice that you're passing the [`include`](/orm/prisma-client/queries/select-fie
Run the code with this command:

```terminal copy
npx ts-node index.ts
npx tsx index.ts
```

The output should look similar to this:
Expand Down Expand Up @@ -193,7 +193,7 @@ async function main() {
Now run the code using the same command as before:

```terminal copy
npx ts-node index.ts
npx tsx index.ts
```

You will see the following output:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ async function main() {
Now run the code with this command:

```terminal copy
npx ts-node index.ts
npx tsx index.ts
```

This should print an empty array because there are no `User` records in the database yet:
Expand Down Expand Up @@ -109,7 +109,7 @@ Notice that you're passing the [`include`](/orm/prisma-client/queries/select-fie
Run the code with this command:

```terminal copy
npx ts-node index.ts
npx tsx index.ts
```

The output should look similar to this:
Expand Down Expand Up @@ -193,7 +193,7 @@ async function main() {
Now run the code using the same command as before:

```terminal copy
npx ts-node index.ts
npx tsx index.ts
```

You will see the following output:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ async function main() {
Now run the code with this command:

```terminal copy
npx ts-node index.ts
npx tsx index.ts
```

This should print an empty array because there are no `User` records in the database yet:
Expand Down Expand Up @@ -108,7 +108,7 @@ Notice that you're passing the [`include`](/orm/prisma-client/queries/select-fie
Run the code with this command:

```terminal copy
npx ts-node index.ts
npx tsx index.ts
```

The output should look similar to this:
Expand Down Expand Up @@ -192,7 +192,7 @@ async function main() {
Now run the code using the same command as before:

```terminal copy
npx ts-node index.ts
npx tsx index.ts
```

You will see the following output:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ async function main() {
Now run the code with this command:

```terminal copy
npx ts-node queries.ts
npx tsx queries.ts
```

This should print an empty array because there are no `User` records in the database yet:
Expand Down Expand Up @@ -119,7 +119,7 @@ Notice that you're also passing the [`include`](/orm/prisma-client/queries/selec
Run the code with this command:

```terminal copy
npx ts-node queries.ts
npx tsx queries.ts
```

The output should look similar to this:
Expand Down Expand Up @@ -216,7 +216,7 @@ async function main() {
Now run the code using the same command as before:

```terminal copy
npx ts-node queries.ts
npx tsx queries.ts
```

You will see the following output:
Expand Down Expand Up @@ -309,7 +309,7 @@ There's a bunch of things happening here, let's take a closer look:
Start the script with the following command:

```terminal
npx ts-node realtime.ts
npx tsx realtime.ts
```

You should see the following output:
Expand Down Expand Up @@ -361,7 +361,7 @@ async function main() {
Then you can run the script using the command from before (in a new terminal tab or window):

```terminal
npx ts-node queries.ts
npx tsx queries.ts
```

You should now see output similar to this in previous terminal tab/window:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ async function main() {
Now run the code with this command:

```terminal copy
npx ts-node index.ts
npx tsx index.ts
```

This should print an empty array because there are no `User` records in the database yet:
Expand Down Expand Up @@ -109,7 +109,7 @@ Notice that you're passing the [`include`](/orm/prisma-client/queries/select-fie
Run the code with this command:

```terminal copy
npx ts-node index.ts
npx tsx index.ts
```

The output should look similar to this:
Expand Down Expand Up @@ -193,7 +193,7 @@ async function main() {
Now run the code using the same command as before:

```terminal copy
npx ts-node index.ts
npx tsx index.ts
```

You will see the following output:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Next, initialize a TypeScript project and add the Prisma CLI as a development de

```terminal copy
npm init -y
npm install prisma typescript ts-node @types/node --save-dev
npm install prisma typescript tsx @types/node --save-dev
```

This creates a `package.json` with an initial setup for your TypeScript app.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ async function main() {
Now run the code with this command:

```terminal copy
npx ts-node index.ts
npx tsx index.ts
```

This should print an empty array because there are no `User` records in the database yet:
Expand Down Expand Up @@ -108,7 +108,7 @@ Notice that you're passing the [`include`](/orm/prisma-client/queries/select-fie
Run the code with this command:

```terminal copy
npx ts-node index.ts
npx tsx index.ts
```

The output should look similar to this:
Expand Down Expand Up @@ -197,7 +197,7 @@ async function main() {
Now run the code using the same command as before:

```terminal copy
npx ts-node index.ts
npx tsx index.ts
```

You will see the following output:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ async function main() {
}
```

Now run the code with your current TypeScript setup. If you're using `ts-node`, you can run it like this:
Now run the code with your current TypeScript setup. If you're using `tsx`, you can run it like this:

```terminal copy
npx ts-node index.ts
npx tsx index.ts
```

If you created a database using the schema from the database introspection step, the query should print an empty array because there are no `User` records in the database yet.
Expand Down Expand Up @@ -112,10 +112,10 @@ This code creates a new `User` record together with new `Post` and `Profile` rec

Notice that you're passing the [`include`](/orm/prisma-client/queries/select-fields#include-relations-and-select-relation-fields) option to `findMany` which tells Prisma Client to include the `posts` and `profile` relations on the returned `User` objects.

Run the code with your current TypeScript setup. If you're using `ts-node`, you can run it like this:
Run the code with your current TypeScript setup. If you're using `tsx`, you can run it like this:

```terminal copy
npx ts-node index.ts
npx tsx index.ts
```

Before moving on to the next section, you'll "publish" the `Post` record you just created using an `update` query. Adjust the `main` function as follows:
Expand All @@ -130,9 +130,9 @@ async function main() {
}
```

Run the code with your current TypeScript setup. If you're using `ts-node`, you can run it like this:
Run the code with your current TypeScript setup. If you're using `tsx`, you can run it like this:

```terminal copy
npx ts-node index.ts
npx tsx index.ts
```

Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ async function main() {
}
```

Now run the code with your current TypeScript setup. If you're using `ts-node`, you can run it like this:
Now run the code with your current TypeScript setup. If you're using `tsx`, you can run it like this:

```terminal copy
npx ts-node index.ts
npx tsx index.ts
```

If you created a database using the schema from the database introspection step, the query should print an empty array because there are no `User` records in the database yet.
Expand Down Expand Up @@ -112,10 +112,10 @@ This code creates a new `User` record together with new `Post` and `Profile` rec

Notice that you're passing the [`include`](/orm/prisma-client/queries/select-fields#include-relations-and-select-relation-fields) option to `findMany` which tells Prisma Client to include the `posts` and `profile` relations on the returned `User` objects.

Run the code with your current TypeScript setup. If you're using `ts-node`, you can run it like this:
Run the code with your current TypeScript setup. If you're using `tsx`, you can run it like this:

```terminal copy
npx ts-node index.ts
npx tsx index.ts
```

Before moving on to the next section, you'll "publish" the `Post` record you just created using an `update` query. Adjust the `main` function as follows:
Expand All @@ -130,8 +130,8 @@ async function main() {
}
```

Run the code with your current TypeScript setup. If you're using `ts-node`, you can run it like this:
Run the code with your current TypeScript setup. If you're using `tsx`, you can run it like this:

```terminal copy
npx ts-node index.ts
npx tsx index.ts
```
Loading
Loading