Skip to content
This repository was archived by the owner on Sep 19, 2024. It is now read-only.

Commit d6cc7a8

Browse files
authored
Merge pull request #10 from snaplet/fix/rename-seed-mts-to-ts
fix: rename seed mts to ts
2 parents 3cc9736 + f7eacc4 commit d6cc7a8

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

seed/hasura-slack-clone/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Snaplet operates in two main steps:
7676

7777
1. **Introspection:** Snaplet analyzes your database, gathering schema, data, and relationship details.
7878
2. **Configuration:** Snaplet generates multiples transforms to generate data based on the introspection result (columns names, data types, relationships, etc).
79-
3. **Script Generation:** Snaplet generates a `seed.mts` file for data generation.
79+
3. **Script Generation:** Snaplet generates a `seed.ts` file for data generation.
8080

8181
To set it up:
8282

@@ -121,7 +121,7 @@ export default defineConfig({
121121
```
122122

123123
When saving this configuration, our cli watcher will detect that it's now able to connect
124-
and introspect our database, and will finish our client generation generating a `seed.mts` file:
124+
and introspect our database, and will finish our client generation generating a `seed.ts` file:
125125

126126
```ts
127127
import { createSeedClient } from "@snaplet/seed";
@@ -140,10 +140,10 @@ process.exit()
140140

141141
### Generating Data
142142

143-
Now that we have our `seed.mts` file, we can generate data with the following command:
143+
Now that we have our `seed.ts` file, we can generate data with the following command:
144144

145145
```bash
146-
npx tsx seed.mts
146+
npx tsx seed.ts
147147
```
148148

149149
With our current configuration this will create 3 workspace user types. Not very useful.
@@ -157,7 +157,7 @@ To build a more realistic environment, we plan to add:
157157

158158
These additions will help us simulate a more authentic workspace environment, giving us a better platform to demonstrate the capabilities of `@snaplet/seed`.
159159

160-
We can update our `seed.mts` like this:
160+
We can update our `seed.ts` like this:
161161

162162
```ts
163163
...
@@ -195,7 +195,7 @@ Based on our configuration, here's what we expect:
195195
Let's generate the data and explore the result:
196196

197197
```bash
198-
npx tsx seed.mts
198+
npx tsx seed.ts
199199
```
200200

201201
As you can see, we have now a lot of data in our database. Let's explore it in the Hasura console.
@@ -279,7 +279,7 @@ await seed.workspaces(
279279
After adjusting our data generation strategy, let's run the command again to see the results:
280280

281281
```bash
282-
npx tsx seed.mts
282+
npx tsx seed.ts
283283
```
284284

285285
![snaplet-generate-image-gif](https://github.com/snaplet/examples/assets/8771783/7f466678-6db8-4046-9cb1-8638228e8fce)

seed/supabase-twitter-clone/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ export default defineConfig({
274274
> you can run `npx @snaplet/seed sync` to update your seed client.
275275
276276
When saving this configuration, our cli watcher will detect that it's now able to connect
277-
and introspect our database, and will finish our client generation generating a `seed.mts` file:
277+
and introspect our database, and will finish our client generation generating a `seed.ts` file:
278278
279279
```ts
280280
import { createSeedClient } from '@snaplet/seed';
@@ -289,7 +289,7 @@ await seed.$resetDatabase()
289289
await seed.HttpResponses(x => x(3))
290290
```
291291
292-
Now, let's edit our `seed.mts` file to generate some tweets:
292+
Now, let's edit our `seed.ts` file to generate some tweets:
293293
294294
```ts
295295
await seed.$resetDatabase()
@@ -298,7 +298,7 @@ await seed.$resetDatabase()
298298
await seed.tweets(x => x(10))
299299
```
300300
301-
After running `npx tsx seed.mts`, we encounter an error related to invalid `avatar_url` in the Next.js images. To fix this, we adjust the `avatar_url` generation in our `seed.mts`:
301+
After running `npx tsx seed.ts`, we encounter an error related to invalid `avatar_url` in the Next.js images. To fix this, we adjust the `avatar_url` generation in our `seed.ts`:
302302
303303
```ts
304304
import { faker } from '@snaplet/copycat';
@@ -319,7 +319,7 @@ await seed.$resetDatabase()
319319
await seed.tweets(x => x(10))
320320
```
321321
322-
We can now re-run our script with `npx tsx seed.mts`.
322+
We can now re-run our script with `npx tsx seed.ts`.
323323
324324
Refreshing our page should now display the seeded tweet data correctly.
325325
@@ -368,7 +368,7 @@ console.log("Profiles created: ", profiles);
368368
369369
This process creates a pool of 5 users with email and password logins, allowing us to easily log in as any tweet creator.
370370
371-
Combining all the steps, our `seed.mts` file becomes:
371+
Combining all the steps, our `seed.ts` file becomes:
372372
373373
<details>
374374
<summary>Click to show the full code</summary>
@@ -439,7 +439,7 @@ console.log('Profiles created: ', profiles)
439439
440440
Re-run the seed script with the environment variables set to your local Supabase instance:
441441
442-
`NEXT_PUBLIC_SUPABASE_URL=http://127.0.0.1:54321 NEXT_PUBLIC_SUPABASE_ANON_KEY=<anon-key> npx tsx seed.mts`:
442+
`NEXT_PUBLIC_SUPABASE_URL=http://127.0.0.1:54321 NEXT_PUBLIC_SUPABASE_ANON_KEY=<anon-key> npx tsx seed.ts`:
443443
444444
![snaplet-seed-users-and-tweets-asciinema](https://github.com/snaplet/examples/assets/8771783/db797322-d5f4-469b-8860-ca8d9f108943)
445445

seed/todonextapp/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export default defineConfig({
104104
```
105105

106106
When saving this configuration, our cli watcher will detect that it's now able to connect
107-
and introspect our database, and will finish our client generation generating a `seed.mts` file:
107+
and introspect our database, and will finish our client generation generating a `seed.ts` file:
108108

109109
```ts
110110
import { createSeedClient } from "@snaplet/seed";
@@ -133,7 +133,7 @@ await seed.todo((x) => x(20));
133133
Populating the database is then just a command away:
134134

135135
```bash
136-
npx tsx seed.mts
136+
npx tsx seed.ts
137137
```
138138

139139
And voila !
@@ -265,7 +265,7 @@ For development, we now want:
265265
2. Twenty todos created by these users.
266266
3. Five votes per todo.
267267

268-
With `snaplet`, our `seed.mts` changes to:
268+
With `snaplet`, our `seed.ts` changes to:
269269

270270
```ts
271271
import { copycat } from "@snaplet/copycat";
@@ -296,7 +296,7 @@ await seed.todos(
296296
We can now seed our database with:
297297

298298
```bash
299-
npx tsx seed.mts
299+
npx tsx seed.ts
300300
```
301301

302302
This comprehensive approach saves us from maintaining a lengthy and complex seed script (the generated SQL is now 120 lines long), illustrating why at Snaplet, we advocate for a declarative, database-aware, and auto-filled methodology. It's about creating and maintaining a dynamic, production-like development environment with ease.

0 commit comments

Comments
 (0)