Skip to content

Commit

Permalink
Merge branch 'angedell-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoalbanese committed Jun 23, 2024
2 parents bd4553b + a4cd130 commit 4db684c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 29 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.57",
"version": "0.0.58",
"description": "A Rails-like CLI for building full-stack Next.js apps faster",
"main": "index.js",
"type": "module",
Expand Down
4 changes: 2 additions & 2 deletions src/commands/add/misc/navbar/generators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ const generateNavConfig = () => {
removeExtension: false,
}
)}";
import { Cog, Globe, HomeIcon } from "lucide-react";
import { Cog, Globe, User, HomeIcon } from "lucide-react";
type AdditionalLinks = {
title: string;
Expand All @@ -189,7 +189,7 @@ type AdditionalLinks = {
export const defaultLinks: SidebarLink[] = [
{ href: "/dashboard", title: "Home", icon: HomeIcon },${
auth !== null
? `\n { href: "/account", title: "Account", icon: Cog },`
? `\n { href: "/account", title: "Account", icon: User },`
: ""
}${
componentLib === "shadcn-ui"
Expand Down
46 changes: 21 additions & 25 deletions src/commands/add/orm/drizzle/generators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ import {
import stripJsonComments from "strip-json-comments";
import { addToInstallList } from "../../utils.js";

type ConfigDriver = "pg" | "turso" | "libsql" | "mysql" | "better-sqlite";

const configDriverMappings = {
postgresjs: "pg",
"node-postgres": "pg",
"vercel-pg": "pg",
neon: "pg",
supabase: "pg",
aws: "pg",
planetscale: "mysql2",
"mysql-2": "mysql2",
"better-sqlite3": "better-sqlite",
turso: "turso",
type DBDialectType = Exclude<DBType, "pg"> | "postgresql";

const configDriverDialect: Record<DBProvider, DBDialectType> = {
turso: "sqlite",
postgresjs: "postgresql",
"node-postgres": "postgresql",
neon: "postgresql",
"vercel-pg": "postgresql",
supabase: "postgresql",
aws: "postgresql",
planetscale: "mysql",
"mysql-2": "mysql",
"better-sqlite3": "sqlite",
};

export const createDrizzleConfig = (libPath: string, provider: DBProvider) => {
Expand All @@ -54,18 +54,14 @@ import { env } from "${formatFilePath(envMjs, {
export default {
schema: "./${libPath}/db/schema",
out: "./${libPath}/db/migrations",
driver: "${configDriverMappings[provider]}",
dialect: "${configDriverDialect[provider]}",
out: "./${libPath}/db/migrations",${provider === "turso" ? `\n driver: "turso",` : ""}
dbCredentials: {
${
provider === "turso"
? `url: env.DATABASE_URL,
authToken: env.DATABASE_AUTH_TOKEN`
: provider === "better-sqlite3"
? "url: env.DATABASE_URL"
: provider === "mysql-2" || provider === "planetscale"
? "uri: env.DATABASE_URL"
: "connectionString: env.DATABASE_URL"
: "url: env.DATABASE_URL"
}${provider === "vercel-pg" ? '.concat("?sslmode=require")' : ""},
}
} satisfies Config;`
Expand Down Expand Up @@ -127,7 +123,7 @@ import { env } from "${formatFilePath(envMjs, {
removeExtension: false,
prefix: "alias",
})}";
export const db = drizzle(sql)
`;
break;
Expand Down Expand Up @@ -536,13 +532,13 @@ export const addScriptsToPackageJson = (
const packageJson = JSON.parse(packageJsonData);

const newItems = {
"db:generate": `drizzle-kit generate:${driver}`,
"db:generate": `drizzle-kit generate`,
"db:migrate": `tsx ${libPath}/db/migrate.ts`,
"db:drop": "drizzle-kit drop",
"db:pull": `drizzle-kit introspect:${driver}`,
...(driver !== "pg" ? { "db:push": `drizzle-kit push:${driver}` } : {}),
"db:pull": `drizzle-kit introspect`,
"db:push": `drizzle-kit push`,
"db:studio": "drizzle-kit studio",
"db:check": `drizzle-kit check:${driver}`,
"db:check": `drizzle-kit check`,
};
packageJson.scripts = {
...packageJson.scripts,
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { addPackage } from "./commands/add/index.js";
import { toggleAnalytics } from "./commands/init/utils.js";

const program = new Command();
program.name("kirimase").description("Kirimase CLI").version("0.0.57");
program.name("kirimase").description("Kirimase CLI").version("0.0.58");

program
.command("analytics")
Expand Down

0 comments on commit 4db684c

Please sign in to comment.