@murumets-ee/create 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +18 -15
- package/dist/index.js +6 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as e,b as g,c as f,d as
|
|
2
|
+
import{a as e,b as g,c as f,d as u,e as T}from"./chunk-ZAX4VH4C.js";import*as c from"@clack/prompts";import y from"picocolors";import*as s from"@clack/prompts";function I(t){let n={},r=t.slice(2);for(let o=0;o<r.length;o++){let l=r[o];if(l==="--mode"&&r[o+1]){let p=r[++o];(p==="single"||p==="multi")&&(n.mode=p)}else l==="--install"?n.install=!0:l==="--no-install"?n.install=!1:!l.startsWith("-")&&!n.name&&(n.name=l)}return n}async function S(t){let n=I(process.argv),r=n.name??t;if(r&&n.mode&&n.install!==void 0)return{name:r,mode:n.mode,installDeps:n.install};s.intro("@murumets-ee/create");let o=r??await s.text({message:"Project name:",placeholder:"my-project",validate:N=>{if(!N)return"Project name is required";if(!/^[a-z0-9-]+$/.test(N))return"Use lowercase letters, numbers, and hyphens only"}});if(s.isCancel(o))return s.cancel("Cancelled."),null;let l=n.mode??await s.select({message:"App setup:",options:[{value:"single",label:"Single app",hint:"everything in one Next.js project"},{value:"multi",label:"Admin + Frontend",hint:"two apps in a pnpm workspace"}]});if(s.isCancel(l))return s.cancel("Cancelled."),null;let p=n.install??await s.confirm({message:"Install dependencies?",initialValue:!0});return s.isCancel(p)?(s.cancel("Cancelled."),null):{name:o,mode:l,installDeps:p}}import{join as A}from"path";import{join as m}from"path";async function E(t,n){await e(m(t,"lib/auth.ts"),`import { getToolkitApp } from './app'
|
|
3
3
|
import { getAuth } from '@murumets-ee/auth'
|
|
4
4
|
|
|
5
5
|
await getToolkitApp()
|
|
@@ -323,6 +323,9 @@ COPY --from=deps /app/node_modules ./node_modules
|
|
|
323
323
|
COPY . .
|
|
324
324
|
ENV NODE_ENV=production
|
|
325
325
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
326
|
+
# Dummy env vars so toolkit.config.ts doesn't throw at build time (no DB connection needed)
|
|
327
|
+
ENV DATABASE_URL=postgresql://build:build@localhost:5432/build
|
|
328
|
+
ENV BETTER_AUTH_SECRET=build-secret-not-used-at-runtime
|
|
326
329
|
RUN pnpm build
|
|
327
330
|
|
|
328
331
|
# --- Stage 3: Production runner ---
|
|
@@ -410,9 +413,9 @@ generated/
|
|
|
410
413
|
# Environment
|
|
411
414
|
.env*
|
|
412
415
|
!.env.example
|
|
413
|
-
`)}import{join as
|
|
416
|
+
`)}import{join as w}from"path";async function z(t,n){await e(w(t,"entities/index.ts"),`export { Article } from './article'
|
|
414
417
|
export { Category } from './category'
|
|
415
|
-
`),await e(
|
|
418
|
+
`),await e(w(t,"entities/article.ts"),`import { behavior, defineEntity, field } from '@murumets-ee/entity'
|
|
416
419
|
|
|
417
420
|
export const Article = defineEntity({
|
|
418
421
|
name: 'article',
|
|
@@ -443,7 +446,7 @@ export const Article = defineEntity({
|
|
|
443
446
|
delete: 'group.admin',
|
|
444
447
|
},
|
|
445
448
|
})
|
|
446
|
-
`),await e(
|
|
449
|
+
`),await e(w(t,"entities/category.ts"),`import { defineEntity, field } from '@murumets-ee/entity'
|
|
447
450
|
|
|
448
451
|
export const Category = defineEntity({
|
|
449
452
|
name: 'category',
|
|
@@ -825,7 +828,7 @@ async function resetDb() {
|
|
|
825
828
|
}
|
|
826
829
|
|
|
827
830
|
resetDb().catch(console.error)
|
|
828
|
-
`)}async function B(t,n){let{name:r}=n,o=a(t,"apps/admin");await L(a(t,"apps"),{recursive:!0}),
|
|
831
|
+
`)}async function B(t,n){let{name:r}=n,o=a(t,"apps/admin");await L(a(t,"apps"),{recursive:!0}),u(`pnpm create next-app@${"16"} ${o} --typescript --tailwind --no-eslint --app --no-src-dir --turbopack --react-compiler --skip-install --import-alias "@/*"`),await f(o,["app/page.tsx","app/page.module.css","app/fonts","README.md","pnpm-workspace.yaml"]),await g(a(o,"package.json"),{dependencies:{[`@${r}/config`]:"workspace:*","@murumets-ee/auth-ui":`^${i.myorgAuthUi}`,"better-auth":`^${i.betterAuth}`,"next-intl":`^${i.nextIntl}`,"next-themes":`^${i.nextThemes}`,"lucide-react":`^${i.lucideReact}`,"react-hook-form":`^${i.reactHookForm}`,"@hookform/resolvers":`^${i.hookformResolvers}`,zod:`^${i.zod}`},devDependencies:{"babel-plugin-react-compiler":i.babelReactCompiler}});let{appendToFile:l}=await import("./utils-VX57GKZX.js");await l(a(o,".gitignore"),`
|
|
829
832
|
# Environment
|
|
830
833
|
.env*
|
|
831
834
|
!.env.example
|
|
@@ -1373,7 +1376,7 @@ export async function createFirstAdmin(formData: FormData) {
|
|
|
1373
1376
|
|
|
1374
1377
|
return { ok: true, email: adminUser.user.email }
|
|
1375
1378
|
}
|
|
1376
|
-
`)}async function H(t,n){let{name:r}=n,o=a(t,"apps/web");
|
|
1379
|
+
`)}async function H(t,n){let{name:r}=n,o=a(t,"apps/web");u(`pnpm create next-app@${"16"} ${o} --typescript --tailwind --no-eslint --app --no-src-dir --turbopack --react-compiler --skip-install --import-alias "@/*"`),await f(o,["app/page.tsx","app/page.module.css","app/fonts","README.md","pnpm-workspace.yaml"]),await g(a(o,"package.json"),{dependencies:{[`@${r}/config`]:"workspace:*","@murumets-ee/core":`^${i.myorgCore}`,"@murumets-ee/auth-ui":`^${i.myorgAuthUi}`,"next-intl":`^${i.nextIntl}`,"next-themes":`^${i.nextThemes}`,"lucide-react":`^${i.lucideReact}`},devDependencies:{"babel-plugin-react-compiler":i.babelReactCompiler}});let{appendToFile:l}=await import("./utils-VX57GKZX.js");await l(a(o,".gitignore"),`
|
|
1377
1380
|
# Environment
|
|
1378
1381
|
.env*
|
|
1379
1382
|
!.env.example
|
|
@@ -1835,13 +1838,13 @@ export default async function HomePage() {
|
|
|
1835
1838
|
</div>
|
|
1836
1839
|
)
|
|
1837
1840
|
}
|
|
1838
|
-
`)}import{join as
|
|
1841
|
+
`)}import{join as k}from"path";async function M(t,n){await e(k(t,"scripts/generate-schema.ts"),`import { execSync } from 'node:child_process'
|
|
1839
1842
|
execSync('npx @murumets-ee/cli generate', { stdio: 'inherit', cwd: import.meta.dirname + '/..' })
|
|
1840
|
-
`),await e(
|
|
1843
|
+
`),await e(k(t,"scripts/migrate.ts"),`import { execSync } from 'node:child_process'
|
|
1841
1844
|
execSync('npx @murumets-ee/cli migrate', { stdio: 'inherit', cwd: import.meta.dirname + '/..' })
|
|
1842
|
-
`),await e(
|
|
1845
|
+
`),await e(k(t,"scripts/reset-db.ts"),`import { execSync } from 'node:child_process'
|
|
1843
1846
|
execSync('npx @murumets-ee/cli reset --force', { stdio: 'inherit', cwd: import.meta.dirname + '/..' })
|
|
1844
|
-
`)}import{join as
|
|
1847
|
+
`)}import{join as v}from"path";async function O(t,n){let{name:r}=n;await e(v(t,"app/globals.css"),`@import "tailwindcss";
|
|
1845
1848
|
@source "../node_modules/@murumets-ee/auth-ui/dist";
|
|
1846
1849
|
|
|
1847
1850
|
@custom-variant dark (&:where(.dark, .dark *));
|
|
@@ -1868,7 +1871,7 @@ body {
|
|
|
1868
1871
|
color: var(--foreground);
|
|
1869
1872
|
font-family: Arial, Helvetica, sans-serif;
|
|
1870
1873
|
}
|
|
1871
|
-
`),await e(
|
|
1874
|
+
`),await e(v(t,"app/theme-provider.tsx"),`'use client'
|
|
1872
1875
|
|
|
1873
1876
|
import { ThemeProvider as NextThemesProvider } from 'next-themes'
|
|
1874
1877
|
import type { ReactNode } from 'react'
|
|
@@ -1885,7 +1888,7 @@ export function ThemeProvider({ children }: { children: ReactNode }) {
|
|
|
1885
1888
|
</NextThemesProvider>
|
|
1886
1889
|
)
|
|
1887
1890
|
}
|
|
1888
|
-
`),await e(
|
|
1891
|
+
`),await e(v(t,"app/theme-toggle.tsx"),`'use client'
|
|
1889
1892
|
|
|
1890
1893
|
import { useTheme } from 'next-themes'
|
|
1891
1894
|
import { useState, useEffect } from 'react'
|
|
@@ -1912,7 +1915,7 @@ export function ThemeToggle() {
|
|
|
1912
1915
|
</button>
|
|
1913
1916
|
)
|
|
1914
1917
|
}
|
|
1915
|
-
`),await e(
|
|
1918
|
+
`),await e(v(t,"app/nav-header.tsx"),`'use client'
|
|
1916
1919
|
|
|
1917
1920
|
import Link from 'next/link'
|
|
1918
1921
|
import { usePathname } from 'next/navigation'
|
|
@@ -2057,5 +2060,5 @@ export const auth = betterAuth({
|
|
|
2057
2060
|
`),await e(x(t,"generated/auth-schema.ts"),`// This file is generated by better-auth CLI.
|
|
2058
2061
|
// Run: npx @better-auth/cli generate --config auth.config.ts -y
|
|
2059
2062
|
export {}
|
|
2060
|
-
`)}async function U(t,n){t.mode==="single"?await W(t,n):await j(t,n)}async function W(t,n){let r=
|
|
2061
|
-
`),"Next steps"),
|
|
2063
|
+
`)}async function U(t,n){t.mode==="single"?await W(t,n):await j(t,n)}async function W(t,n){let r=A(process.cwd(),t.name);n?.("Creating Next.js app..."),u(`pnpm create next-app@${"16"} ${t.name} --typescript --tailwind --no-eslint --app --no-src-dir --turbopack --react-compiler --skip-install --import-alias "@/*"`),await f(r,["app/page.tsx","app/page.module.css","app/fonts","README.md"]),await g(A(r,"package.json"),{type:"module",dependencies:{"@murumets-ee/core":`^${i.myorgCore}`,"@murumets-ee/db":`^${i.myorgDb}`,"@murumets-ee/entity":`^${i.myorgEntity}`,"@murumets-ee/logging":`^${i.myorgLogging}`,"@murumets-ee/auth":`^${i.myorgAuth}`,"@murumets-ee/auth-ui":`^${i.myorgAuthUi}`,"@murumets-ee/admin-ui":`^${i.myorgAdminUi}`,"@murumets-ee/content":`^${i.myorgContent}`,"@murumets-ee/settings":`^${i.myorgSettings}`,"@murumets-ee/storage":`^${i.myorgStorage}`,"@murumets-ee/media":`^${i.myorgMedia}`,"@murumets-ee/taxonomy":`^${i.myorgTaxonomy}`,"@murumets-ee/queue":`^${i.myorgQueue}`,"@murumets-ee/mail":`^${i.myorgMail}`,"@murumets-ee/ticketing":`^${i.myorgTicketing}`,"@murumets-ee/ticketing-ui":`^${i.myorgTicketingUi}`,"@murumets-ee/tokens":`^${i.myorgTokens}`,"better-auth":`^${i.betterAuth}`,"drizzle-orm":`^${i.drizzleOrm}`,"next-intl":`^${i.nextIntl}`,"next-themes":`^${i.nextThemes}`,"lucide-react":`^${i.lucideReact}`,postgres:`^${i.postgres}`,"react-hook-form":`^${i.reactHookForm}`,"@hookform/resolvers":`^${i.hookformResolvers}`,zod:`^${i.zod}`},devDependencies:{"drizzle-kit":`^${i.drizzleKit}`,tsx:`^${i.tsx}`,"babel-plugin-react-compiler":i.babelReactCompiler},scripts:{"db:generate":"tsx --env-file=.env scripts/generate-schema.ts","db:migrate:generate":"drizzle-kit generate","db:migrate":"tsx --env-file=.env scripts/migrate.ts","db:reset":"tsx --env-file=.env scripts/reset-db.ts"}}),n?.("Adding toolkit files..."),await P(r,t),await z(r,t),await q(r,t),await E(r,t),await C(r,t),await $(r,t),await O(r,t),await M(r,t),t.installDeps&&(n?.("Installing dependencies..."),u("pnpm install",{cwd:r}))}async function j(t,n){let r=A(process.cwd(),t.name);n?.("Creating workspace..."),await _(r,t,n),t.installDeps&&(n?.("Installing dependencies..."),u("pnpm install",{cwd:r}))}async function G(){let t=process.argv[2],n=await S(t);if(!n)return;let r=c.spinner();try{r.start("Creating Next.js app..."),await U(n,l=>{r.stop(`${y.green("\u2713")} Done`),r.start(l)}),r.stop(`${y.green("\u2713")} Done`);let o=[`cd ${n.name}`,"cp .env.example .env","docker compose up -d","npx @murumets-ee/cli setup","pnpm db:migrate","pnpm dev","# Visit /setup to create your first admin user"];c.note(o.join(`
|
|
2064
|
+
`),"Next steps"),c.outro(`${y.green("Success!")} Your project is ready.`)}catch(o){r.stop(y.red("Failed.")),c.log.error(o instanceof Error?o.message:String(o)),process.exit(1)}}G();
|
package/dist/index.js
CHANGED
|
@@ -322,6 +322,9 @@ COPY --from=deps /app/node_modules ./node_modules
|
|
|
322
322
|
COPY . .
|
|
323
323
|
ENV NODE_ENV=production
|
|
324
324
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
325
|
+
# Dummy env vars so toolkit.config.ts doesn't throw at build time (no DB connection needed)
|
|
326
|
+
ENV DATABASE_URL=postgresql://build:build@localhost:5432/build
|
|
327
|
+
ENV BETTER_AUTH_SECRET=build-secret-not-used-at-runtime
|
|
325
328
|
RUN pnpm build
|
|
326
329
|
|
|
327
330
|
# --- Stage 3: Production runner ---
|
|
@@ -1834,13 +1837,13 @@ export default async function HomePage() {
|
|
|
1834
1837
|
</div>
|
|
1835
1838
|
)
|
|
1836
1839
|
}
|
|
1837
|
-
`)}import{join as b}from"path";async function
|
|
1840
|
+
`)}import{join as b}from"path";async function R(t,n){await e(b(t,"scripts/generate-schema.ts"),`import { execSync } from 'node:child_process'
|
|
1838
1841
|
execSync('npx @murumets-ee/cli generate', { stdio: 'inherit', cwd: import.meta.dirname + '/..' })
|
|
1839
1842
|
`),await e(b(t,"scripts/migrate.ts"),`import { execSync } from 'node:child_process'
|
|
1840
1843
|
execSync('npx @murumets-ee/cli migrate', { stdio: 'inherit', cwd: import.meta.dirname + '/..' })
|
|
1841
1844
|
`),await e(b(t,"scripts/reset-db.ts"),`import { execSync } from 'node:child_process'
|
|
1842
1845
|
execSync('npx @murumets-ee/cli reset --force', { stdio: 'inherit', cwd: import.meta.dirname + '/..' })
|
|
1843
|
-
`)}import{join as f}from"path";async function
|
|
1846
|
+
`)}import{join as f}from"path";async function z(t,n){let{name:r}=n;await e(f(t,"app/globals.css"),`@import "tailwindcss";
|
|
1844
1847
|
@source "../node_modules/@murumets-ee/auth-ui/dist";
|
|
1845
1848
|
|
|
1846
1849
|
@custom-variant dark (&:where(.dark, .dark *));
|
|
@@ -2056,4 +2059,4 @@ export const auth = betterAuth({
|
|
|
2056
2059
|
`),await e(d(t,"generated/auth-schema.ts"),`// This file is generated by better-auth CLI.
|
|
2057
2060
|
// Run: npx @better-auth/cli generate --config auth.config.ts -y
|
|
2058
2061
|
export {}
|
|
2059
|
-
`)}async function O(t,n){t.mode==="single"?await q(t,n):await U(t,n)}async function q(t,n){let r=v(process.cwd(),t.name);n?.("Creating Next.js app..."),l(`pnpm create next-app@${"16"} ${t.name} --typescript --tailwind --no-eslint --app --no-src-dir --turbopack --react-compiler --skip-install --import-alias "@/*"`),await u(r,["app/page.tsx","app/page.module.css","app/fonts","README.md"]),await c(v(r,"package.json"),{type:"module",dependencies:{"@murumets-ee/core":`^${i.myorgCore}`,"@murumets-ee/db":`^${i.myorgDb}`,"@murumets-ee/entity":`^${i.myorgEntity}`,"@murumets-ee/logging":`^${i.myorgLogging}`,"@murumets-ee/auth":`^${i.myorgAuth}`,"@murumets-ee/auth-ui":`^${i.myorgAuthUi}`,"@murumets-ee/admin-ui":`^${i.myorgAdminUi}`,"@murumets-ee/content":`^${i.myorgContent}`,"@murumets-ee/settings":`^${i.myorgSettings}`,"@murumets-ee/storage":`^${i.myorgStorage}`,"@murumets-ee/media":`^${i.myorgMedia}`,"@murumets-ee/taxonomy":`^${i.myorgTaxonomy}`,"@murumets-ee/queue":`^${i.myorgQueue}`,"@murumets-ee/mail":`^${i.myorgMail}`,"@murumets-ee/ticketing":`^${i.myorgTicketing}`,"@murumets-ee/ticketing-ui":`^${i.myorgTicketingUi}`,"@murumets-ee/tokens":`^${i.myorgTokens}`,"better-auth":`^${i.betterAuth}`,"drizzle-orm":`^${i.drizzleOrm}`,"next-intl":`^${i.nextIntl}`,"next-themes":`^${i.nextThemes}`,"lucide-react":`^${i.lucideReact}`,postgres:`^${i.postgres}`,"react-hook-form":`^${i.reactHookForm}`,"@hookform/resolvers":`^${i.hookformResolvers}`,zod:`^${i.zod}`},devDependencies:{"drizzle-kit":`^${i.drizzleKit}`,tsx:`^${i.tsx}`,"babel-plugin-react-compiler":i.babelReactCompiler},scripts:{"db:generate":"tsx --env-file=.env scripts/generate-schema.ts","db:migrate:generate":"drizzle-kit generate","db:migrate":"tsx --env-file=.env scripts/migrate.ts","db:reset":"tsx --env-file=.env scripts/reset-db.ts"}}),n?.("Adding toolkit files..."),await k(r,t),await A(r,t),await C(r,t),await w(r,t),await T(r,t),await P(r,t),await
|
|
2062
|
+
`)}async function O(t,n){t.mode==="single"?await q(t,n):await U(t,n)}async function q(t,n){let r=v(process.cwd(),t.name);n?.("Creating Next.js app..."),l(`pnpm create next-app@${"16"} ${t.name} --typescript --tailwind --no-eslint --app --no-src-dir --turbopack --react-compiler --skip-install --import-alias "@/*"`),await u(r,["app/page.tsx","app/page.module.css","app/fonts","README.md"]),await c(v(r,"package.json"),{type:"module",dependencies:{"@murumets-ee/core":`^${i.myorgCore}`,"@murumets-ee/db":`^${i.myorgDb}`,"@murumets-ee/entity":`^${i.myorgEntity}`,"@murumets-ee/logging":`^${i.myorgLogging}`,"@murumets-ee/auth":`^${i.myorgAuth}`,"@murumets-ee/auth-ui":`^${i.myorgAuthUi}`,"@murumets-ee/admin-ui":`^${i.myorgAdminUi}`,"@murumets-ee/content":`^${i.myorgContent}`,"@murumets-ee/settings":`^${i.myorgSettings}`,"@murumets-ee/storage":`^${i.myorgStorage}`,"@murumets-ee/media":`^${i.myorgMedia}`,"@murumets-ee/taxonomy":`^${i.myorgTaxonomy}`,"@murumets-ee/queue":`^${i.myorgQueue}`,"@murumets-ee/mail":`^${i.myorgMail}`,"@murumets-ee/ticketing":`^${i.myorgTicketing}`,"@murumets-ee/ticketing-ui":`^${i.myorgTicketingUi}`,"@murumets-ee/tokens":`^${i.myorgTokens}`,"better-auth":`^${i.betterAuth}`,"drizzle-orm":`^${i.drizzleOrm}`,"next-intl":`^${i.nextIntl}`,"next-themes":`^${i.nextThemes}`,"lucide-react":`^${i.lucideReact}`,postgres:`^${i.postgres}`,"react-hook-form":`^${i.reactHookForm}`,"@hookform/resolvers":`^${i.hookformResolvers}`,zod:`^${i.zod}`},devDependencies:{"drizzle-kit":`^${i.drizzleKit}`,tsx:`^${i.tsx}`,"babel-plugin-react-compiler":i.babelReactCompiler},scripts:{"db:generate":"tsx --env-file=.env scripts/generate-schema.ts","db:migrate:generate":"drizzle-kit generate","db:migrate":"tsx --env-file=.env scripts/migrate.ts","db:reset":"tsx --env-file=.env scripts/reset-db.ts"}}),n?.("Adding toolkit files..."),await k(r,t),await A(r,t),await C(r,t),await w(r,t),await T(r,t),await P(r,t),await z(r,t),await R(r,t),t.installDeps&&(n?.("Installing dependencies..."),l("pnpm install",{cwd:r}))}async function U(t,n){let r=v(process.cwd(),t.name);n?.("Creating workspace..."),await E(r,t,n),t.installDeps&&(n?.("Installing dependencies..."),l("pnpm install",{cwd:r}))}export{O as scaffold};
|