Code Monkey home page Code Monkey logo

docs's People

Contributors

1-felix avatar avallete avatar dewinterjack avatar janhellebo avatar jgoux avatar jianreis avatar joekarow avatar justinvdm avatar khaya-zulu avatar kpman avatar nclavaud avatar pellejacobs avatar peterp avatar ruheni avatar snowbaha avatar tobiastornros avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

docs's Issues

Adapter not found, please ensure that the 'adapter' key is set in `.snaplet/config.json`

I seems that snaplet doesn't look for the right place for config.
I am using:
[email protected]
@snaplet/[email protected]
I even added in package.json:

  "@snaplet/seed": {
    "config": "seed.config.ts"
  },

My seed.config.ts follows the documented instructions:

export default defineConfig({
  adapter: () => {
    const client = postgres(
      "postgresql://postgres:[email protected]:54322/postgres"
    )
    return new SeedPostgres(client)
  },
})

When I run bun seed.ts I encounter problems:

4 |     if (id) {
5 |         return adapters[id];
6 |     }
7 |     const projectConfig = await getProjectConfig();
8 |     if (projectConfig.adapter === undefined) {
9 |         throw new Error("Adapter not found, please ensure that the 'adapter' key is set in `.snaplet/config.json`");
                  ^
error: Adapter not found, please ensure that the 'adapter' key is set in `.snaplet/config.json`
      at /Users/aymeric/Projects/trendful/new/node_modules/@snaplet/seed/dist/src/adapters/getAdapter.js:9:15

Bun v1.1.8 (macOS arm64)

SnapletError - 'SEED_CONFIG_NOT_FOUND' when directory name starts with 'n'

I receive the error below when trying to run npx tsx prisma/seed/seed.ts. I believe it's because one of the directories in the path starts with an 'n'.

The file path should be C:\Users\user\Documents\projects\nextjs_projects\project\prisma\seed\seed.config.ts but is being parsed as C:\\Users\\user\\Documents\\projectsextjs_projects\\project\\prisma\\seed\\seed.config.ts.

I changed the directory name nextjs_projects to start with a different character and the command ran successfully.

Error

{ _tag: 'SnapletError', code: 'SEED_CONFIG_NOT_FOUND', data: { path: 'C:\\Users\\user\\Documents\\projectsextjs_projects\\project\\prisma\\seed\\seed.config.ts' } }

System

OS: Windows 11

Feedback for “Share data”

I'm trying to use snaplet ss share but I'm getting a "0 successful snapshots found" message. I have two successful snapshots in my project.

Disable SQL log output

Is it possible to disable the SQL logs when running the seed script?

e.g. these kind of logs

{
  severity_local: 'NOTICE',
  severity: 'NOTICE',
  code: '00000',
  message: 'truncate cascades to table "refresh_tokens"',
  file: 'tablecmds.c',
  line: '1826',
  routine: 'ExecuteTruncateGuts'
}

Unexpected EOF

Hi, trying to generate 100,000+ rows with snaplet and output to a seed.sql file as a dryRun. The insert row gets truncated and I get a unexpected EOF when trying to run the sql. Do you know what could be the issue please?

Postgres hyphenated table names cause syntax error field names to be generated in userModels.js

When using a postgres database with hyphenated table names, snaplet generates @snaplet/seed/dist/assets/userModels.js with hyphenated Javascript property names that cause a syntax error during run-time because they don't have single or double quotes.

Here's the error

± % npx tsx seed.ts > supabase/seed.sql                                                                                                                   !2819
file:///Users/***/node_modules/@snaplet/seed/dist/assets/userModels.js:111
cms-for-whats-new: {
   ^

SyntaxError: Unexpected token '-'
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:152:18)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:299:14)

Node.js v18.20.2

I am using @snaplet/[email protected]

My seed.config.ts

import { SeedPostgres } from "@snaplet/seed/adapter-postgres";
import { defineConfig } from "@snaplet/seed/config";
import postgres from "postgres";

export default defineConfig({
  adapter: () => {
    const client = postgres({
      host: "localhost:54322",
      port: 54322,
      database: "postgres",
      username: "postgres",
      password: "postgres",
    });
    return new SeedPostgres(client);
  },
  select: [
    // We don't alter any extensions tables that might be owned by extensions
    "!*",
    // We want to alter all the tables under public schema
    "public*",
    // We also want to alter some of the tables under the auth schema
    "auth.users",
    "auth.identities",
    "auth.sessions",
  ],
});

My .snaplet/config.json

{
  "adapter": "postgres"
}

Feedback for “Installation”

  • Please add detailed instructions for:
Please reload your shell to refresh your PATH and start using snaplet

I got stuck on this part, I don't have the finger memory of refreshing PATH, so I got to googling, failing, etc. A whole detour just to get the CLI working

With the Snaplet CLI installed and configured, and having gone through the Snaplet Cloud onboarding experience, at this point you should have a snapshot ready...

But actually I landed on this page not having installed CLI, and then I had to look around the docs for the installation manual. Could have just been a link here ;)

Feedback for “Relationships”, plan connect not working as expected

Hello,

I'm trying to reproduce the plan connect example from the documentation and the behavior I'm observing isn't what I expected.

When I run

// Create a pool of 5 users for our workspace
const { users } = await seed.users((x) => x(5));
const workspacesNumber = 1;
// Create our workspace and connect all our users to it
const { workspace, workspace_member } = await seed.workspace((x) =>
    x(workspacesNumber, () => ({
            // Each workspace will have between 1 and 10 members
            workspace_member: (x) => x(users.length)
        }),
        // Connect the workspace members to the pool of users we created
        { connect: { users }})
);

I get 10 users, 5 of which are linked to a workspace via workspace_member, whereas I expected to get only 5 users, all linked to a workspace.

If I remove the connect: { users } option, I get exactly the same result, which corresponds to my expectations since I'm now in the path connect case.

In my case, the connect option has no effect. Have I misunderstood how this option works? Or have I implemented the example incorrectly?

Thanks for your help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.