diff --git a/seed/hasura-slack-clone/README.md b/seed/hasura-slack-clone/README.md index 822855b..8c15bd8 100644 --- a/seed/hasura-slack-clone/README.md +++ b/seed/hasura-slack-clone/README.md @@ -76,7 +76,7 @@ Snaplet operates in two main steps: 1. **Introspection:** Snaplet analyzes your database, gathering schema, data, and relationship details. 2. **Configuration:** Snaplet generates multiples transforms to generate data based on the introspection result (columns names, data types, relationships, etc). -3. **Script Generation:** Snaplet generates a `seed.mts` file for data generation. +3. **Script Generation:** Snaplet generates a `seed.ts` file for data generation. To set it up: @@ -121,7 +121,7 @@ export default defineConfig({ ``` When saving this configuration, our cli watcher will detect that it's now able to connect -and introspect our database, and will finish our client generation generating a `seed.mts` file: +and introspect our database, and will finish our client generation generating a `seed.ts` file: ```ts import { createSeedClient } from "@snaplet/seed"; @@ -140,10 +140,10 @@ process.exit() ### Generating Data -Now that we have our `seed.mts` file, we can generate data with the following command: +Now that we have our `seed.ts` file, we can generate data with the following command: ```bash -npx tsx seed.mts +npx tsx seed.ts ``` 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: These additions will help us simulate a more authentic workspace environment, giving us a better platform to demonstrate the capabilities of `@snaplet/seed`. -We can update our `seed.mts` like this: +We can update our `seed.ts` like this: ```ts ... @@ -195,7 +195,7 @@ Based on our configuration, here's what we expect: Let's generate the data and explore the result: ```bash -npx tsx seed.mts +npx tsx seed.ts ``` 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( After adjusting our data generation strategy, let's run the command again to see the results: ```bash -npx tsx seed.mts +npx tsx seed.ts ``` ![snaplet-generate-image-gif](https://github.com/snaplet/examples/assets/8771783/7f466678-6db8-4046-9cb1-8638228e8fce) diff --git a/seed/supabase-twitter-clone/README.md b/seed/supabase-twitter-clone/README.md index 66d8416..c2c77ab 100644 --- a/seed/supabase-twitter-clone/README.md +++ b/seed/supabase-twitter-clone/README.md @@ -274,7 +274,7 @@ export default defineConfig({ > you can run `npx @snaplet/seed sync` to update your seed client. When saving this configuration, our cli watcher will detect that it's now able to connect -and introspect our database, and will finish our client generation generating a `seed.mts` file: +and introspect our database, and will finish our client generation generating a `seed.ts` file: ```ts import { createSeedClient } from '@snaplet/seed'; @@ -289,7 +289,7 @@ await seed.$resetDatabase() await seed.HttpResponses(x => x(3)) ``` -Now, let's edit our `seed.mts` file to generate some tweets: +Now, let's edit our `seed.ts` file to generate some tweets: ```ts await seed.$resetDatabase() @@ -298,7 +298,7 @@ await seed.$resetDatabase() await seed.tweets(x => x(10)) ``` -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`: +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`: ```ts import { faker } from '@snaplet/copycat'; @@ -319,7 +319,7 @@ await seed.$resetDatabase() await seed.tweets(x => x(10)) ``` -We can now re-run our script with `npx tsx seed.mts`. +We can now re-run our script with `npx tsx seed.ts`. Refreshing our page should now display the seeded tweet data correctly. @@ -368,7 +368,7 @@ console.log("Profiles created: ", profiles); This process creates a pool of 5 users with email and password logins, allowing us to easily log in as any tweet creator. -Combining all the steps, our `seed.mts` file becomes: +Combining all the steps, our `seed.ts` file becomes:
Click to show the full code @@ -439,7 +439,7 @@ console.log('Profiles created: ', profiles) Re-run the seed script with the environment variables set to your local Supabase instance: -`NEXT_PUBLIC_SUPABASE_URL=http://127.0.0.1:54321 NEXT_PUBLIC_SUPABASE_ANON_KEY= npx tsx seed.mts`: +`NEXT_PUBLIC_SUPABASE_URL=http://127.0.0.1:54321 NEXT_PUBLIC_SUPABASE_ANON_KEY= npx tsx seed.ts`: ![snaplet-seed-users-and-tweets-asciinema](https://github.com/snaplet/examples/assets/8771783/db797322-d5f4-469b-8860-ca8d9f108943) diff --git a/seed/todonextapp/README.md b/seed/todonextapp/README.md index c9b8fc9..aa14c98 100644 --- a/seed/todonextapp/README.md +++ b/seed/todonextapp/README.md @@ -104,7 +104,7 @@ export default defineConfig({ ``` When saving this configuration, our cli watcher will detect that it's now able to connect -and introspect our database, and will finish our client generation generating a `seed.mts` file: +and introspect our database, and will finish our client generation generating a `seed.ts` file: ```ts import { createSeedClient } from "@snaplet/seed"; @@ -133,7 +133,7 @@ await seed.todo((x) => x(20)); Populating the database is then just a command away: ```bash -npx tsx seed.mts +npx tsx seed.ts ``` And voila ! @@ -265,7 +265,7 @@ For development, we now want: 2. Twenty todos created by these users. 3. Five votes per todo. -With `snaplet`, our `seed.mts` changes to: +With `snaplet`, our `seed.ts` changes to: ```ts import { copycat } from "@snaplet/copycat"; @@ -296,7 +296,7 @@ await seed.todos( We can now seed our database with: ```bash -npx tsx seed.mts +npx tsx seed.ts ``` 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.