Skip to content

Commit

Permalink
updated views to ensure production build works
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoalbanese committed Sep 5, 2023
1 parent 777dd23 commit e4eb241
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kirimase",
"version": "0.0.7",
"version": "0.0.8",
"description": "A Rails-like CLI for Nextjs and Drizzle ORM",
"main": "index.js",
"type": "module",
Expand Down
7 changes: 6 additions & 1 deletion src/commands/generate/generators/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export const createConfig = () => {
};

function generateModelContent(schema: Schema, dbType: DBType) {
const { provider } = readConfigFile();
const { index, fields, tableName } = schema;
const {
tableNameCamelCase,
Expand Down Expand Up @@ -180,7 +181,11 @@ function generateModelContent(schema: Schema, dbType: DBType) {
`, ${config.tableFunc}`
)} } from "drizzle-orm/${dbType}-core";\nimport { createInsertSchema, createSelectSchema } from "drizzle-zod";\nimport { z } from "zod";\n${
referenceImports.length > 0 ? referenceImports.join("\n") : ""
}${schema.belongsToUser ? '\nimport { users } from "./auth";' : ""}`;
}${
schema.belongsToUser && provider !== "planetscale"
? '\nimport { users } from "./auth";'
: ""
}`;

const schemaFields = fields
.map(
Expand Down
2 changes: 1 addition & 1 deletion src/commands/generate/generators/views.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ const ${tableNameSingularCapitalised}Form = ({
const form = useForm<z.infer<typeof insert${tableNameSingularCapitalised}Params>>({
// latest Zod release has introduced a TS error with zodResolver
// does not arise in build though so no need for ts-expect-error
// open issue: https://github.com/colinhacks/zod/issues/2663
// errors locally but not in production
resolver: zodResolver(insert${tableNameSingularCapitalised}Params),
defaultValues: ${tableNameSingular} ?? {
${schema.fields.map(
Expand Down
5 changes: 0 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ program
.description("initialise and configure kirimase within directory")
.action(initProject);

// program
// .command("scaffold")
// .description("Scaffold a new resource")
// .action(buildSchema);

program
.command("generate")
.description("Generate a new resource")
Expand Down

0 comments on commit e4eb241

Please sign in to comment.