create-omg 0.4.40 → 0.4.42
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/index.mjs +60 -9
- package/dist/{template → templates/react-ts}/AGENTS.md +22 -0
- package/dist/templates/react-ts/_gitignore +24 -0
- package/dist/{template → templates/react-ts}/bun.lock +105 -58
- package/dist/templates/react-ts/components.json +25 -0
- package/dist/templates/react-ts/eslint.config.js +23 -0
- package/dist/templates/react-ts/functions/.gitkeep +0 -0
- package/dist/{template → templates/react-ts}/package.json +5 -0
- package/dist/templates/react-ts/public/favicon.svg +1 -0
- package/dist/templates/react-ts/public/icons/apple-touch-icon.png +0 -0
- package/dist/templates/react-ts/public/icons/pwa-192x192.png +0 -0
- package/dist/templates/react-ts/public/icons/pwa-512x512-maskable.png +0 -0
- package/dist/templates/react-ts/public/icons/pwa-512x512.png +0 -0
- package/dist/templates/react-ts/public/icons.svg +24 -0
- package/dist/templates/react-ts/schema.ts +5 -0
- package/dist/templates/react-ts/server/db.ts +103 -0
- package/dist/templates/react-ts/src/App.tsx +128 -0
- package/dist/templates/react-ts/src/components/ui/animated-number.tsx +102 -0
- package/dist/templates/react-ts/src/components/ui/animated-text.tsx +109 -0
- package/dist/templates/react-ts/src/components/ui/bottom-nav.tsx +131 -0
- package/dist/templates/react-ts/src/components/ui/button.tsx +84 -0
- package/dist/templates/react-ts/src/components/ui/card.tsx +70 -0
- package/dist/templates/react-ts/src/components/ui/otp-input.tsx +179 -0
- package/dist/templates/react-ts/src/components/ui/scroll-affordance.tsx +106 -0
- package/dist/templates/react-ts/src/components/ui/sound.ts +182 -0
- package/dist/templates/react-ts/src/components/ui/transitions.tsx +419 -0
- package/dist/templates/react-ts/src/components/ui/vibes-ui-styles.ts +388 -0
- package/dist/templates/react-ts/src/db.drizzle.ts +5 -0
- package/dist/templates/react-ts/src/index.css +168 -0
- package/dist/templates/react-ts/src/lib/utils.ts +6 -0
- package/dist/templates/react-ts/src/main.tsx +22 -0
- package/dist/templates/react-ts/src/routeTree.gen.ts +59 -0
- package/dist/templates/react-ts/src/routes/__root.tsx +7 -0
- package/dist/templates/react-ts/src/routes/index.tsx +9 -0
- package/dist/templates/react-ts/tsconfig.app.json +30 -0
- package/dist/templates/react-ts/tsconfig.json +10 -0
- package/dist/templates/react-ts/tsconfig.node.json +24 -0
- package/dist/{template → templates/react-ts}/vite.config.ts +9 -1
- package/dist/templates/react-ts-start/AGENTS.md +75 -0
- package/dist/templates/react-ts-start/README.md +58 -0
- package/dist/templates/react-ts-start/bun.lock +1688 -0
- package/dist/templates/react-ts-start/package.json +58 -0
- package/dist/templates/react-ts-start/src/routeTree.gen.ts +68 -0
- package/dist/templates/react-ts-start/src/router.tsx +18 -0
- package/dist/templates/react-ts-start/src/routes/__root.tsx +40 -0
- package/dist/templates/react-ts-start/src/routes/index.tsx +7 -0
- package/dist/templates/react-ts-start/vite.config.ts +29 -0
- package/package.json +1 -1
- package/dist/template/src/main.tsx +0 -10
- /package/dist/{template → templates/react-ts}/README.md +0 -0
- /package/dist/{template → templates/react-ts}/index.html +0 -0
- /package/dist/{template → templates/react-ts-start}/_gitignore +0 -0
- /package/dist/{template → templates/react-ts-start}/components.json +0 -0
- /package/dist/{template → templates/react-ts-start}/eslint.config.js +0 -0
- /package/dist/{template → templates/react-ts-start}/functions/.gitkeep +0 -0
- /package/dist/{template → templates/react-ts-start}/public/favicon.svg +0 -0
- /package/dist/{template → templates/react-ts-start}/public/icons/apple-touch-icon.png +0 -0
- /package/dist/{template → templates/react-ts-start}/public/icons/pwa-192x192.png +0 -0
- /package/dist/{template → templates/react-ts-start}/public/icons/pwa-512x512-maskable.png +0 -0
- /package/dist/{template → templates/react-ts-start}/public/icons/pwa-512x512.png +0 -0
- /package/dist/{template → templates/react-ts-start}/public/icons.svg +0 -0
- /package/dist/{template → templates/react-ts-start}/schema.ts +0 -0
- /package/dist/{template → templates/react-ts-start}/server/db.ts +0 -0
- /package/dist/{template → templates/react-ts-start}/src/App.tsx +0 -0
- /package/dist/{template → templates/react-ts-start}/src/components/ui/animated-number.tsx +0 -0
- /package/dist/{template → templates/react-ts-start}/src/components/ui/animated-text.tsx +0 -0
- /package/dist/{template → templates/react-ts-start}/src/components/ui/bottom-nav.tsx +0 -0
- /package/dist/{template → templates/react-ts-start}/src/components/ui/button.tsx +0 -0
- /package/dist/{template → templates/react-ts-start}/src/components/ui/card.tsx +0 -0
- /package/dist/{template → templates/react-ts-start}/src/components/ui/otp-input.tsx +0 -0
- /package/dist/{template → templates/react-ts-start}/src/components/ui/scroll-affordance.tsx +0 -0
- /package/dist/{template → templates/react-ts-start}/src/components/ui/sound.ts +0 -0
- /package/dist/{template → templates/react-ts-start}/src/components/ui/transitions.tsx +0 -0
- /package/dist/{template → templates/react-ts-start}/src/components/ui/vibes-ui-styles.ts +0 -0
- /package/dist/{template → templates/react-ts-start}/src/db.drizzle.ts +0 -0
- /package/dist/{template → templates/react-ts-start}/src/index.css +0 -0
- /package/dist/{template → templates/react-ts-start}/src/lib/utils.ts +0 -0
- /package/dist/{template → templates/react-ts-start}/tsconfig.app.json +0 -0
- /package/dist/{template → templates/react-ts-start}/tsconfig.json +0 -0
- /package/dist/{template → templates/react-ts-start}/tsconfig.node.json +0 -0
package/dist/index.mjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// @bun
|
|
3
3
|
|
|
4
4
|
// src/index.ts
|
|
5
|
+
import { existsSync as existsSync2 } from "fs";
|
|
5
6
|
import { fileURLToPath } from "url";
|
|
6
7
|
|
|
7
8
|
// src/create.ts
|
|
@@ -63,27 +64,71 @@ async function createApp(options) {
|
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
// src/index.ts
|
|
67
|
+
var TEMPLATES = {
|
|
68
|
+
"react-ts": "React + TanStack Router (SPA, prerendered)",
|
|
69
|
+
"react-ts-start": "React + TanStack Start (SSR) \u2014 experimental"
|
|
70
|
+
};
|
|
71
|
+
var DEFAULT_TEMPLATE = "react-ts";
|
|
66
72
|
var HELP = `Create a new omg.dev app
|
|
67
73
|
|
|
68
74
|
bun create omg <name>
|
|
69
75
|
npx create-omg <name>
|
|
70
76
|
|
|
71
77
|
Options:
|
|
72
|
-
--
|
|
73
|
-
--
|
|
78
|
+
--template <id> starter to use (default: ${DEFAULT_TEMPLATE})
|
|
79
|
+
--no-install create files without installing dependencies
|
|
80
|
+
--help show this help
|
|
81
|
+
|
|
82
|
+
Templates:
|
|
83
|
+
${Object.entries(TEMPLATES).map(([id, desc]) => ` ${id.padEnd(16)} ${desc}`).join(`
|
|
84
|
+
`)}
|
|
74
85
|
`;
|
|
86
|
+
function parseTemplate(args) {
|
|
87
|
+
const flagIndex = args.findIndex((arg) => arg === "--template" || arg === "-t");
|
|
88
|
+
if (flagIndex !== -1) {
|
|
89
|
+
const value = args[flagIndex + 1];
|
|
90
|
+
if (!value || value.startsWith("-"))
|
|
91
|
+
throw new Error("--template needs a value");
|
|
92
|
+
if (!(value in TEMPLATES)) {
|
|
93
|
+
throw new Error(`unknown template ${JSON.stringify(value)} (want: ${Object.keys(TEMPLATES).join(", ")})`);
|
|
94
|
+
}
|
|
95
|
+
return value;
|
|
96
|
+
}
|
|
97
|
+
const inline = args.find((arg) => arg.startsWith("--template="));
|
|
98
|
+
if (inline) {
|
|
99
|
+
const value = inline.slice("--template=".length);
|
|
100
|
+
if (!(value in TEMPLATES)) {
|
|
101
|
+
throw new Error(`unknown template ${JSON.stringify(value)} (want: ${Object.keys(TEMPLATES).join(", ")})`);
|
|
102
|
+
}
|
|
103
|
+
return value;
|
|
104
|
+
}
|
|
105
|
+
return DEFAULT_TEMPLATE;
|
|
106
|
+
}
|
|
107
|
+
function parseDestination(args) {
|
|
108
|
+
const flagIndex = args.findIndex((arg) => arg === "--template" || arg === "-t");
|
|
109
|
+
const consumed = flagIndex === -1 ? -1 : flagIndex + 1;
|
|
110
|
+
return args.find((arg, i) => !arg.startsWith("-") && i !== consumed);
|
|
111
|
+
}
|
|
75
112
|
async function main() {
|
|
76
113
|
const args = process.argv.slice(2);
|
|
77
114
|
if (args.includes("--help") || args.includes("-h")) {
|
|
78
115
|
process.stdout.write(HELP);
|
|
79
116
|
return 0;
|
|
80
117
|
}
|
|
81
|
-
const
|
|
118
|
+
const template = parseTemplate(args);
|
|
119
|
+
const destination = parseDestination(args);
|
|
82
120
|
if (!destination) {
|
|
83
121
|
process.stderr.write(HELP);
|
|
84
122
|
return 1;
|
|
85
123
|
}
|
|
86
|
-
|
|
124
|
+
let templateRoot = fileURLToPath(new URL(`./templates/${template}`, import.meta.url));
|
|
125
|
+
if (!existsSync2(templateRoot)) {
|
|
126
|
+
const legacy = fileURLToPath(new URL("./template", import.meta.url));
|
|
127
|
+
if (template !== DEFAULT_TEMPLATE || !existsSync2(legacy)) {
|
|
128
|
+
throw new Error(`template ${template} is missing from this package`);
|
|
129
|
+
}
|
|
130
|
+
templateRoot = legacy;
|
|
131
|
+
}
|
|
87
132
|
await createApp({
|
|
88
133
|
destination,
|
|
89
134
|
install: !args.includes("--no-install"),
|
|
@@ -91,10 +136,16 @@ async function main() {
|
|
|
91
136
|
});
|
|
92
137
|
return 0;
|
|
93
138
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
139
|
+
if (import.meta.main) {
|
|
140
|
+
main().then((code) => process.exit(code)).catch((error) => {
|
|
141
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
142
|
+
process.stderr.write(`
|
|
97
143
|
error: ${message}
|
|
98
144
|
`);
|
|
99
|
-
|
|
100
|
-
});
|
|
145
|
+
process.exit(1);
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
export {
|
|
149
|
+
parseTemplate,
|
|
150
|
+
parseDestination
|
|
151
|
+
};
|
|
@@ -41,6 +41,28 @@ divs** (no div-built tab bars, toggles, sliders, dropdowns, modals):
|
|
|
41
41
|
- Motion: use `transitions.tsx` / `.vui-*` classes and the `animated-*`
|
|
42
42
|
primitives; don't write bespoke keyframe animations for patterns they cover.
|
|
43
43
|
|
|
44
|
+
## Routing: files in `src/routes/`
|
|
45
|
+
|
|
46
|
+
This app uses TanStack Router with file-based routing. A second screen means a
|
|
47
|
+
second file — **not** a `useState` view-switcher inside `App.tsx`.
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
// src/routes/pricing.tsx → /pricing
|
|
51
|
+
import { createFileRoute } from "@tanstack/react-router"
|
|
52
|
+
|
|
53
|
+
export const Route = createFileRoute("/pricing")({ component: Pricing })
|
|
54
|
+
|
|
55
|
+
function Pricing() { return <main>...</main> }
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
- `src/App.tsx` is the `/` route's component — keep the home view there.
|
|
59
|
+
- Params: `posts.$postId.tsx` → `/posts/$postId`, read via `Route.useParams()`.
|
|
60
|
+
- Navigate with `<Link to="/pricing">` from `@tanstack/react-router`. A raw
|
|
61
|
+
`<a href>` full-reloads the page and drops app state.
|
|
62
|
+
- `src/routeTree.gen.ts` is generated from `src/routes/` — never edit it.
|
|
63
|
+
- Static routes are prerendered to static HTML at build time, so real URLs are
|
|
64
|
+
cheap SEO. Param routes fall back to the SPA shell.
|
|
65
|
+
|
|
44
66
|
## Environment
|
|
45
67
|
|
|
46
68
|
- Project dir `/home/user/project`, package manager **bun**.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Logs
|
|
2
|
+
logs
|
|
3
|
+
*.log
|
|
4
|
+
npm-debug.log*
|
|
5
|
+
yarn-debug.log*
|
|
6
|
+
yarn-error.log*
|
|
7
|
+
pnpm-debug.log*
|
|
8
|
+
lerna-debug.log*
|
|
9
|
+
|
|
10
|
+
node_modules
|
|
11
|
+
dist
|
|
12
|
+
dist-ssr
|
|
13
|
+
*.local
|
|
14
|
+
|
|
15
|
+
# Editor directories and files
|
|
16
|
+
.vscode/*
|
|
17
|
+
!.vscode/extensions.json
|
|
18
|
+
.idea
|
|
19
|
+
.DS_Store
|
|
20
|
+
*.suo
|
|
21
|
+
*.ntvs*
|
|
22
|
+
*.njsproj
|
|
23
|
+
*.sln
|
|
24
|
+
*.sw?
|