@murumets-ee/create 0.1.5 → 0.1.6
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 +15 -15
- 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()
|
|
@@ -410,9 +410,9 @@ generated/
|
|
|
410
410
|
# Environment
|
|
411
411
|
.env*
|
|
412
412
|
!.env.example
|
|
413
|
-
`)}import{join as
|
|
413
|
+
`)}import{join as w}from"path";async function z(t,n){await e(w(t,"entities/index.ts"),`export { Article } from './article'
|
|
414
414
|
export { Category } from './category'
|
|
415
|
-
`),await e(
|
|
415
|
+
`),await e(w(t,"entities/article.ts"),`import { behavior, defineEntity, field } from '@murumets-ee/entity'
|
|
416
416
|
|
|
417
417
|
export const Article = defineEntity({
|
|
418
418
|
name: 'article',
|
|
@@ -443,7 +443,7 @@ export const Article = defineEntity({
|
|
|
443
443
|
delete: 'group.admin',
|
|
444
444
|
},
|
|
445
445
|
})
|
|
446
|
-
`),await e(
|
|
446
|
+
`),await e(w(t,"entities/category.ts"),`import { defineEntity, field } from '@murumets-ee/entity'
|
|
447
447
|
|
|
448
448
|
export const Category = defineEntity({
|
|
449
449
|
name: 'category',
|
|
@@ -825,7 +825,7 @@ async function resetDb() {
|
|
|
825
825
|
}
|
|
826
826
|
|
|
827
827
|
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}),
|
|
828
|
+
`)}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
829
|
# Environment
|
|
830
830
|
.env*
|
|
831
831
|
!.env.example
|
|
@@ -1373,7 +1373,7 @@ export async function createFirstAdmin(formData: FormData) {
|
|
|
1373
1373
|
|
|
1374
1374
|
return { ok: true, email: adminUser.user.email }
|
|
1375
1375
|
}
|
|
1376
|
-
`)}async function H(t,n){let{name:r}=n,o=a(t,"apps/web");
|
|
1376
|
+
`)}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
1377
|
# Environment
|
|
1378
1378
|
.env*
|
|
1379
1379
|
!.env.example
|
|
@@ -1835,13 +1835,13 @@ export default async function HomePage() {
|
|
|
1835
1835
|
</div>
|
|
1836
1836
|
)
|
|
1837
1837
|
}
|
|
1838
|
-
`)}import{join as
|
|
1838
|
+
`)}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
1839
|
execSync('npx @murumets-ee/cli generate', { stdio: 'inherit', cwd: import.meta.dirname + '/..' })
|
|
1840
|
-
`),await e(
|
|
1840
|
+
`),await e(k(t,"scripts/migrate.ts"),`import { execSync } from 'node:child_process'
|
|
1841
1841
|
execSync('npx @murumets-ee/cli migrate', { stdio: 'inherit', cwd: import.meta.dirname + '/..' })
|
|
1842
|
-
`),await e(
|
|
1842
|
+
`),await e(k(t,"scripts/reset-db.ts"),`import { execSync } from 'node:child_process'
|
|
1843
1843
|
execSync('npx @murumets-ee/cli reset --force', { stdio: 'inherit', cwd: import.meta.dirname + '/..' })
|
|
1844
|
-
`)}import{join as
|
|
1844
|
+
`)}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
1845
|
@source "../node_modules/@murumets-ee/auth-ui/dist";
|
|
1846
1846
|
|
|
1847
1847
|
@custom-variant dark (&:where(.dark, .dark *));
|
|
@@ -1868,7 +1868,7 @@ body {
|
|
|
1868
1868
|
color: var(--foreground);
|
|
1869
1869
|
font-family: Arial, Helvetica, sans-serif;
|
|
1870
1870
|
}
|
|
1871
|
-
`),await e(
|
|
1871
|
+
`),await e(v(t,"app/theme-provider.tsx"),`'use client'
|
|
1872
1872
|
|
|
1873
1873
|
import { ThemeProvider as NextThemesProvider } from 'next-themes'
|
|
1874
1874
|
import type { ReactNode } from 'react'
|
|
@@ -1885,7 +1885,7 @@ export function ThemeProvider({ children }: { children: ReactNode }) {
|
|
|
1885
1885
|
</NextThemesProvider>
|
|
1886
1886
|
)
|
|
1887
1887
|
}
|
|
1888
|
-
`),await e(
|
|
1888
|
+
`),await e(v(t,"app/theme-toggle.tsx"),`'use client'
|
|
1889
1889
|
|
|
1890
1890
|
import { useTheme } from 'next-themes'
|
|
1891
1891
|
import { useState, useEffect } from 'react'
|
|
@@ -1912,7 +1912,7 @@ export function ThemeToggle() {
|
|
|
1912
1912
|
</button>
|
|
1913
1913
|
)
|
|
1914
1914
|
}
|
|
1915
|
-
`),await e(
|
|
1915
|
+
`),await e(v(t,"app/nav-header.tsx"),`'use client'
|
|
1916
1916
|
|
|
1917
1917
|
import Link from 'next/link'
|
|
1918
1918
|
import { usePathname } from 'next/navigation'
|
|
@@ -2057,5 +2057,5 @@ export const auth = betterAuth({
|
|
|
2057
2057
|
`),await e(x(t,"generated/auth-schema.ts"),`// This file is generated by better-auth CLI.
|
|
2058
2058
|
// Run: npx @better-auth/cli generate --config auth.config.ts -y
|
|
2059
2059
|
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"),
|
|
2060
|
+
`)}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(`
|
|
2061
|
+
`),"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();
|