@gerege-systems/create-app 1.0.4
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/LICENSE +21 -0
- package/README.md +49 -0
- package/dist/index.js +206 -0
- package/package.json +53 -0
- package/templates/vite-blank/_gitignore +7 -0
- package/templates/vite-blank/_package.json +23 -0
- package/templates/vite-blank/index.html +18 -0
- package/templates/vite-blank/src/App.tsx +47 -0
- package/templates/vite-blank/src/main.tsx +10 -0
- package/templates/vite-blank/tsconfig.json +14 -0
- package/templates/vite-blank/vite.config.ts +6 -0
- package/templates/vite-dashboard/_gitignore +7 -0
- package/templates/vite-dashboard/_package.json +23 -0
- package/templates/vite-dashboard/index.html +18 -0
- package/templates/vite-dashboard/src/App.tsx +200 -0
- package/templates/vite-dashboard/src/main.tsx +10 -0
- package/templates/vite-dashboard/tsconfig.json +14 -0
- package/templates/vite-dashboard/vite.config.ts +6 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Gerege Systems
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# @gerege-systems/create-app
|
|
2
|
+
|
|
3
|
+
Scaffold a new project preconfigured with [`@gerege-systems/ui`](https://www.npmjs.com/package/@gerege-systems/ui).
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm create @gerege-systems/app my-app
|
|
7
|
+
# or
|
|
8
|
+
pnpm create @gerege-systems/app my-app
|
|
9
|
+
# or
|
|
10
|
+
yarn create @gerege-systems/app my-app
|
|
11
|
+
# or
|
|
12
|
+
bun create @gerege-systems/app my-app
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Then:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
cd my-app
|
|
19
|
+
pnpm dev
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Templates
|
|
23
|
+
|
|
24
|
+
| ID | What you get |
|
|
25
|
+
| ---------------- | --------------------------------------------------------------------------- |
|
|
26
|
+
| `vite-blank` | Minimal Vite + React + `@gerege-systems/ui` starter (Card + Input + Switch) |
|
|
27
|
+
| `vite-dashboard` | `AppShell` + `Dashboard` template, ready to wire data |
|
|
28
|
+
|
|
29
|
+
Pass `--template <id>` to skip the picker:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm create @gerege-systems/app my-app -- --template vite-dashboard
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Options
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
-t, --template <name> Skip the prompt and use a known template
|
|
39
|
+
-y, --yes Skip "install deps?" prompt and install
|
|
40
|
+
--no-install Skip dependency install entirely
|
|
41
|
+
-h, --help Show this help
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Docs
|
|
45
|
+
|
|
46
|
+
- Showcase: <https://ui.gecore.mn>
|
|
47
|
+
- Components: <https://ui.gecore.mn/#components>
|
|
48
|
+
- Templates: <https://ui.gecore.mn/#templates>
|
|
49
|
+
- Guides: <https://ui.gecore.mn/#guides>
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "fs";
|
|
5
|
+
import path from "path";
|
|
6
|
+
import { fileURLToPath } from "url";
|
|
7
|
+
import { spawnSync } from "child_process";
|
|
8
|
+
import { cancel, confirm, intro, isCancel, log, outro, select, text } from "@clack/prompts";
|
|
9
|
+
import kleur from "kleur";
|
|
10
|
+
var __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
11
|
+
var TEMPLATES_DIR = path.resolve(__dirname, "../templates");
|
|
12
|
+
var TEMPLATES = [
|
|
13
|
+
{
|
|
14
|
+
id: "vite-blank",
|
|
15
|
+
label: "Vite + Blank",
|
|
16
|
+
hint: "Minimal Vite + React + @gerege-systems/ui starter"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
id: "vite-dashboard",
|
|
20
|
+
label: "Vite + Dashboard",
|
|
21
|
+
hint: "Sidebar + TopNav dashboard shell, ready to wire data"
|
|
22
|
+
}
|
|
23
|
+
];
|
|
24
|
+
function detectPackageManager() {
|
|
25
|
+
const ua = process.env.npm_config_user_agent ?? "";
|
|
26
|
+
if (ua.startsWith("pnpm")) return "pnpm";
|
|
27
|
+
if (ua.startsWith("yarn")) return "yarn";
|
|
28
|
+
if (ua.startsWith("bun")) return "bun";
|
|
29
|
+
return "npm";
|
|
30
|
+
}
|
|
31
|
+
function parseArgs(argv) {
|
|
32
|
+
const args = argv.slice(2);
|
|
33
|
+
let projectName;
|
|
34
|
+
let template;
|
|
35
|
+
let noInstall = false;
|
|
36
|
+
let yes = false;
|
|
37
|
+
for (let i = 0; i < args.length; i++) {
|
|
38
|
+
const a = args[i];
|
|
39
|
+
if (a === "--template" || a === "-t") {
|
|
40
|
+
template = args[++i];
|
|
41
|
+
} else if (a === "--no-install") {
|
|
42
|
+
noInstall = true;
|
|
43
|
+
} else if (a === "--yes" || a === "-y") {
|
|
44
|
+
yes = true;
|
|
45
|
+
} else if (a === "--help" || a === "-h") {
|
|
46
|
+
printHelp();
|
|
47
|
+
process.exit(0);
|
|
48
|
+
} else if (!a.startsWith("-")) {
|
|
49
|
+
projectName = a;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return { projectName, template, noInstall, yes };
|
|
53
|
+
}
|
|
54
|
+
function printHelp() {
|
|
55
|
+
const lines = [
|
|
56
|
+
"",
|
|
57
|
+
kleur.bold(" @gerege-systems/create-app") + kleur.gray(" \u2014 scaffold a new @gerege-systems/ui project"),
|
|
58
|
+
"",
|
|
59
|
+
" Usage:",
|
|
60
|
+
" npm create @gerege-systems/app [project-name] [options]",
|
|
61
|
+
"",
|
|
62
|
+
" Options:",
|
|
63
|
+
" -t, --template <name> Skip the prompt and use a known template",
|
|
64
|
+
' -y, --yes Skip "install deps?" prompt and install',
|
|
65
|
+
" --no-install Skip dependency install entirely",
|
|
66
|
+
" -h, --help Show this help",
|
|
67
|
+
"",
|
|
68
|
+
" Templates:",
|
|
69
|
+
...TEMPLATES.map((t) => ` ${t.id.padEnd(20)} ${kleur.gray(t.hint)}`),
|
|
70
|
+
""
|
|
71
|
+
];
|
|
72
|
+
console.log(lines.join("\n"));
|
|
73
|
+
}
|
|
74
|
+
function isValidProjectName(name) {
|
|
75
|
+
if (!name) return "Project name is required";
|
|
76
|
+
if (name === "." || name === "./") return 'Use a directory name, not "."';
|
|
77
|
+
if (!/^[a-z0-9._-]+$/i.test(name)) {
|
|
78
|
+
return "Use letters, numbers, dashes, dots, or underscores";
|
|
79
|
+
}
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
function copyTemplate(templateId, dest, projectName) {
|
|
83
|
+
const src = path.join(TEMPLATES_DIR, templateId);
|
|
84
|
+
if (!existsSync(src)) {
|
|
85
|
+
throw new Error(`Template "${templateId}" not found at ${src}`);
|
|
86
|
+
}
|
|
87
|
+
mkdirSync(dest, { recursive: true });
|
|
88
|
+
walk(src, dest, projectName);
|
|
89
|
+
}
|
|
90
|
+
function walk(srcDir, destDir, projectName) {
|
|
91
|
+
for (const entry of readdirSync(srcDir)) {
|
|
92
|
+
const srcPath = path.join(srcDir, entry);
|
|
93
|
+
const destName = entry === "_package.json" ? "package.json" : entry === "_gitignore" ? ".gitignore" : entry;
|
|
94
|
+
const destPath = path.join(destDir, destName);
|
|
95
|
+
const stat = statSync(srcPath);
|
|
96
|
+
if (stat.isDirectory()) {
|
|
97
|
+
mkdirSync(destPath, { recursive: true });
|
|
98
|
+
walk(srcPath, destPath, projectName);
|
|
99
|
+
} else {
|
|
100
|
+
const raw = readFileSync(srcPath, "utf8");
|
|
101
|
+
const rendered = raw.replace(/__PROJECT_NAME__/g, projectName);
|
|
102
|
+
writeFileSync(destPath, rendered);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
async function run() {
|
|
107
|
+
intro(kleur.bold(kleur.cyan(" \u2726 @gerege-systems/create-app ")));
|
|
108
|
+
const { projectName: cliName, template: cliTemplate, noInstall, yes } = parseArgs(process.argv);
|
|
109
|
+
let projectName = cliName;
|
|
110
|
+
if (!projectName) {
|
|
111
|
+
const answer = await text({
|
|
112
|
+
message: "Project name",
|
|
113
|
+
placeholder: "my-app",
|
|
114
|
+
defaultValue: "my-app",
|
|
115
|
+
validate: (v) => {
|
|
116
|
+
const r = isValidProjectName(v || "my-app");
|
|
117
|
+
return r === true ? void 0 : r;
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
if (isCancel(answer)) {
|
|
121
|
+
cancel("Cancelled.");
|
|
122
|
+
process.exit(0);
|
|
123
|
+
}
|
|
124
|
+
projectName = answer || "my-app";
|
|
125
|
+
} else {
|
|
126
|
+
const valid = isValidProjectName(projectName);
|
|
127
|
+
if (valid !== true) {
|
|
128
|
+
log.error(valid);
|
|
129
|
+
process.exit(1);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
const targetDir = path.resolve(process.cwd(), projectName);
|
|
133
|
+
if (existsSync(targetDir) && readdirSync(targetDir).length > 0) {
|
|
134
|
+
const proceed = await confirm({
|
|
135
|
+
message: `Directory "${projectName}" is not empty. Overwrite?`,
|
|
136
|
+
initialValue: false
|
|
137
|
+
});
|
|
138
|
+
if (isCancel(proceed) || !proceed) {
|
|
139
|
+
cancel("Cancelled.");
|
|
140
|
+
process.exit(0);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
let templateId = cliTemplate;
|
|
144
|
+
if (!templateId) {
|
|
145
|
+
const answer = await select({
|
|
146
|
+
message: "Pick a template",
|
|
147
|
+
options: TEMPLATES.map((t) => ({ value: t.id, label: t.label, hint: t.hint }))
|
|
148
|
+
});
|
|
149
|
+
if (isCancel(answer)) {
|
|
150
|
+
cancel("Cancelled.");
|
|
151
|
+
process.exit(0);
|
|
152
|
+
}
|
|
153
|
+
templateId = answer;
|
|
154
|
+
}
|
|
155
|
+
if (!TEMPLATES.some((t) => t.id === templateId)) {
|
|
156
|
+
log.error(`Unknown template "${templateId}". Run with --help to list.`);
|
|
157
|
+
process.exit(1);
|
|
158
|
+
}
|
|
159
|
+
let installNow;
|
|
160
|
+
if (noInstall) {
|
|
161
|
+
installNow = false;
|
|
162
|
+
} else if (yes) {
|
|
163
|
+
installNow = true;
|
|
164
|
+
} else {
|
|
165
|
+
const ans = await confirm({
|
|
166
|
+
message: "Install dependencies now?",
|
|
167
|
+
initialValue: true
|
|
168
|
+
});
|
|
169
|
+
if (isCancel(ans)) {
|
|
170
|
+
cancel("Cancelled.");
|
|
171
|
+
process.exit(0);
|
|
172
|
+
}
|
|
173
|
+
installNow = ans;
|
|
174
|
+
}
|
|
175
|
+
log.step(`Scaffolding into ${kleur.cyan(path.relative(process.cwd(), targetDir) || ".")}`);
|
|
176
|
+
try {
|
|
177
|
+
copyTemplate(templateId, targetDir, projectName);
|
|
178
|
+
} catch (err) {
|
|
179
|
+
log.error(err.message);
|
|
180
|
+
process.exit(1);
|
|
181
|
+
}
|
|
182
|
+
const pm = detectPackageManager();
|
|
183
|
+
if (installNow) {
|
|
184
|
+
log.step(`Installing dependencies with ${kleur.cyan(pm)} (this can take a minute)\u2026`);
|
|
185
|
+
const result = spawnSync(pm, ["install"], { cwd: targetDir, stdio: "inherit" });
|
|
186
|
+
if (result.status !== 0) {
|
|
187
|
+
log.warn("Install failed. You can re-run it manually after fixing the issue.");
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
outro(
|
|
191
|
+
[
|
|
192
|
+
kleur.green(" All set."),
|
|
193
|
+
"",
|
|
194
|
+
kleur.gray(" Next steps:"),
|
|
195
|
+
` ${kleur.cyan(`cd ${projectName}`)}`,
|
|
196
|
+
...installNow ? [] : [` ${kleur.cyan(`${pm} install`)}`],
|
|
197
|
+
` ${kleur.cyan(`${pm} run dev`)}`,
|
|
198
|
+
"",
|
|
199
|
+
kleur.gray(" Docs: https://ui.gecore.mn")
|
|
200
|
+
].join("\n")
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
run().catch((err) => {
|
|
204
|
+
log.error(err instanceof Error ? err.message : String(err));
|
|
205
|
+
process.exit(1);
|
|
206
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gerege-systems/create-app",
|
|
3
|
+
"version": "1.0.4",
|
|
4
|
+
"description": "Scaffold a new project preconfigured with @gerege-systems/ui. Invoke via `npm create @gerege-systems/app my-app`.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Gerege Systems",
|
|
7
|
+
"homepage": "https://ui.gecore.mn",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/gerege-systems/gerege-ui.git",
|
|
11
|
+
"directory": "packages/create-app"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/gerege-systems/gerege-ui/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"create-app",
|
|
18
|
+
"scaffold",
|
|
19
|
+
"gerege",
|
|
20
|
+
"design-system",
|
|
21
|
+
"react",
|
|
22
|
+
"tailwind"
|
|
23
|
+
],
|
|
24
|
+
"type": "module",
|
|
25
|
+
"bin": {
|
|
26
|
+
"create-gerege-app": "./dist/index.js"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"templates",
|
|
31
|
+
"README.md"
|
|
32
|
+
],
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@clack/prompts": "^0.8.2",
|
|
38
|
+
"kleur": "^4.1.5"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@types/node": "^22.10.0",
|
|
42
|
+
"tsup": "^8.3.5",
|
|
43
|
+
"typescript": "^5.7.2"
|
|
44
|
+
},
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=18"
|
|
47
|
+
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"build": "tsup src/index.ts --format esm --target node18 --out-dir dist --clean",
|
|
50
|
+
"dev": "tsup src/index.ts --format esm --target node18 --out-dir dist --watch",
|
|
51
|
+
"test": "pnpm build && node scripts/smoke.mjs"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "__PROJECT_NAME__",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite",
|
|
8
|
+
"build": "tsc -b && vite build",
|
|
9
|
+
"preview": "vite preview"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@gerege-systems/ui": "^0.11.0",
|
|
13
|
+
"react": "^18.3.1",
|
|
14
|
+
"react-dom": "^18.3.1"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@types/react": "^18.3.12",
|
|
18
|
+
"@types/react-dom": "^18.3.1",
|
|
19
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
20
|
+
"typescript": "^5.7.2",
|
|
21
|
+
"vite": "^6.0.3"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>__PROJECT_NAME__</title>
|
|
7
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
8
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
9
|
+
<link
|
|
10
|
+
href="https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600&family=Geist+Mono:wght@400;500&display=swap"
|
|
11
|
+
rel="stylesheet"
|
|
12
|
+
/>
|
|
13
|
+
</head>
|
|
14
|
+
<body>
|
|
15
|
+
<div id="root"></div>
|
|
16
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
17
|
+
</body>
|
|
18
|
+
</html>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
Card,
|
|
5
|
+
CardContent,
|
|
6
|
+
CardDescription,
|
|
7
|
+
CardHeader,
|
|
8
|
+
CardTitle,
|
|
9
|
+
Input,
|
|
10
|
+
Switch,
|
|
11
|
+
} from '@gerege-systems/ui';
|
|
12
|
+
|
|
13
|
+
export function App() {
|
|
14
|
+
const [name, setName] = useState('');
|
|
15
|
+
const [notify, setNotify] = useState(true);
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<div className="min-h-screen bg-background p-8">
|
|
19
|
+
<div className="mx-auto max-w-md">
|
|
20
|
+
<Card>
|
|
21
|
+
<CardHeader>
|
|
22
|
+
<CardTitle>Hello, __PROJECT_NAME__</CardTitle>
|
|
23
|
+
<CardDescription>
|
|
24
|
+
Your new app is wired up with @gerege-systems/ui. Edit{' '}
|
|
25
|
+
<code className="rounded bg-background-muted px-1">src/App.tsx</code> to start
|
|
26
|
+
building.
|
|
27
|
+
</CardDescription>
|
|
28
|
+
</CardHeader>
|
|
29
|
+
<CardContent className="flex flex-col gap-4">
|
|
30
|
+
<Input
|
|
31
|
+
label="Your name"
|
|
32
|
+
value={name}
|
|
33
|
+
onChange={(e) => setName(e.target.value)}
|
|
34
|
+
placeholder="Bay"
|
|
35
|
+
/>
|
|
36
|
+
<Switch
|
|
37
|
+
label="Email notifications"
|
|
38
|
+
checked={notify}
|
|
39
|
+
onCheckedChange={setNotify}
|
|
40
|
+
/>
|
|
41
|
+
<Button disabled={!name}>{name ? `Hi, ${name}` : 'Enter your name'}</Button>
|
|
42
|
+
</CardContent>
|
|
43
|
+
</Card>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { StrictMode } from 'react';
|
|
2
|
+
import { createRoot } from 'react-dom/client';
|
|
3
|
+
import '@gerege-systems/ui/styles.css';
|
|
4
|
+
import { App } from './App';
|
|
5
|
+
|
|
6
|
+
createRoot(document.getElementById('root')!).render(
|
|
7
|
+
<StrictMode>
|
|
8
|
+
<App />
|
|
9
|
+
</StrictMode>,
|
|
10
|
+
);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"moduleResolution": "Bundler",
|
|
7
|
+
"jsx": "react-jsx",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"noEmit": true
|
|
12
|
+
},
|
|
13
|
+
"include": ["src"]
|
|
14
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "__PROJECT_NAME__",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite",
|
|
8
|
+
"build": "tsc -b && vite build",
|
|
9
|
+
"preview": "vite preview"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@gerege-systems/ui": "^0.11.0",
|
|
13
|
+
"react": "^18.3.1",
|
|
14
|
+
"react-dom": "^18.3.1"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@types/react": "^18.3.12",
|
|
18
|
+
"@types/react-dom": "^18.3.1",
|
|
19
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
20
|
+
"typescript": "^5.7.2",
|
|
21
|
+
"vite": "^6.0.3"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>__PROJECT_NAME__</title>
|
|
7
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
8
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
9
|
+
<link
|
|
10
|
+
href="https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600&family=Geist+Mono:wght@400;500&display=swap"
|
|
11
|
+
rel="stylesheet"
|
|
12
|
+
/>
|
|
13
|
+
</head>
|
|
14
|
+
<body>
|
|
15
|
+
<div id="root"></div>
|
|
16
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
17
|
+
</body>
|
|
18
|
+
</html>
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Avatar,
|
|
4
|
+
Badge,
|
|
5
|
+
Button,
|
|
6
|
+
Card,
|
|
7
|
+
CardContent,
|
|
8
|
+
CardDescription,
|
|
9
|
+
CardHeader,
|
|
10
|
+
CardTitle,
|
|
11
|
+
EmptyState,
|
|
12
|
+
Icons,
|
|
13
|
+
Input,
|
|
14
|
+
Sidebar,
|
|
15
|
+
SidebarItem,
|
|
16
|
+
SidebarSection,
|
|
17
|
+
Table,
|
|
18
|
+
TableBody,
|
|
19
|
+
TableCell,
|
|
20
|
+
TableHead,
|
|
21
|
+
TableHeader,
|
|
22
|
+
TableRow,
|
|
23
|
+
Toaster,
|
|
24
|
+
TooltipProvider,
|
|
25
|
+
TopNav,
|
|
26
|
+
toast,
|
|
27
|
+
} from '@gerege-systems/ui';
|
|
28
|
+
|
|
29
|
+
type NavKey = 'overview' | 'projects' | 'customers' | 'billing' | 'settings';
|
|
30
|
+
|
|
31
|
+
const stats = [
|
|
32
|
+
{ label: 'Revenue', value: '$48,200', delta: '+12.4%', tone: 'success' as const },
|
|
33
|
+
{ label: 'Active users', value: '2,310', delta: '+3.1%', tone: 'success' as const },
|
|
34
|
+
{ label: 'Open tickets', value: '14', delta: '-2', tone: 'neutral' as const },
|
|
35
|
+
{ label: 'Churn', value: '1.8%', delta: '+0.2%', tone: 'warning' as const },
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
const orders = [
|
|
39
|
+
{ id: 'ORD-1042', customer: 'Alex Morgan', amount: '$1,200.00', status: 'Paid' },
|
|
40
|
+
{ id: 'ORD-1041', customer: 'Jamie Lee', amount: '$340.00', status: 'Pending' },
|
|
41
|
+
{ id: 'ORD-1040', customer: 'Sam Patel', amount: '$89.00', status: 'Failed' },
|
|
42
|
+
{ id: 'ORD-1039', customer: 'Riley Chen', amount: '$2,050.00', status: 'Paid' },
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
const statusTone = { Paid: 'success', Pending: 'warning', Failed: 'danger' } as const;
|
|
46
|
+
|
|
47
|
+
const Brand = () => (
|
|
48
|
+
<span className="flex items-center gap-2 text-sm font-semibold">
|
|
49
|
+
<span className="bg-accent text-on-accent inline-flex size-6 items-center justify-center rounded-md text-xs">
|
|
50
|
+
<Icons.Zap className="size-3.5" />
|
|
51
|
+
</span>
|
|
52
|
+
__PROJECT_NAME__
|
|
53
|
+
</span>
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
export function App() {
|
|
57
|
+
const [active, setActive] = useState<NavKey>('overview');
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<TooltipProvider>
|
|
61
|
+
<div className="bg-background text-foreground flex min-h-screen">
|
|
62
|
+
<Sidebar header={<Brand />}>
|
|
63
|
+
<SidebarSection label="Workspace">
|
|
64
|
+
<SidebarItem
|
|
65
|
+
icon={<Icons.Home />}
|
|
66
|
+
active={active === 'overview'}
|
|
67
|
+
onClick={() => setActive('overview')}
|
|
68
|
+
>
|
|
69
|
+
Overview
|
|
70
|
+
</SidebarItem>
|
|
71
|
+
<SidebarItem
|
|
72
|
+
icon={<Icons.Folder />}
|
|
73
|
+
active={active === 'projects'}
|
|
74
|
+
onClick={() => setActive('projects')}
|
|
75
|
+
>
|
|
76
|
+
Projects
|
|
77
|
+
</SidebarItem>
|
|
78
|
+
<SidebarItem
|
|
79
|
+
icon={<Icons.Users />}
|
|
80
|
+
active={active === 'customers'}
|
|
81
|
+
onClick={() => setActive('customers')}
|
|
82
|
+
trailing={<Badge tone="accent">3</Badge>}
|
|
83
|
+
>
|
|
84
|
+
Customers
|
|
85
|
+
</SidebarItem>
|
|
86
|
+
</SidebarSection>
|
|
87
|
+
<SidebarSection label="Account">
|
|
88
|
+
<SidebarItem
|
|
89
|
+
icon={<Icons.CreditCard />}
|
|
90
|
+
active={active === 'billing'}
|
|
91
|
+
onClick={() => setActive('billing')}
|
|
92
|
+
>
|
|
93
|
+
Billing
|
|
94
|
+
</SidebarItem>
|
|
95
|
+
<SidebarItem
|
|
96
|
+
icon={<Icons.Settings />}
|
|
97
|
+
active={active === 'settings'}
|
|
98
|
+
onClick={() => setActive('settings')}
|
|
99
|
+
>
|
|
100
|
+
Settings
|
|
101
|
+
</SidebarItem>
|
|
102
|
+
</SidebarSection>
|
|
103
|
+
</Sidebar>
|
|
104
|
+
|
|
105
|
+
<div className="flex min-w-0 flex-1 flex-col">
|
|
106
|
+
<TopNav
|
|
107
|
+
logo={<span className="text-sm font-medium capitalize">{active}</span>}
|
|
108
|
+
search={<Input type="search" placeholder="Search…" aria-label="Search" />}
|
|
109
|
+
actions={
|
|
110
|
+
<>
|
|
111
|
+
<Button
|
|
112
|
+
variant="ghost"
|
|
113
|
+
size="sm"
|
|
114
|
+
aria-label="Notifications"
|
|
115
|
+
onClick={() => toast({ title: 'No new notifications' })}
|
|
116
|
+
>
|
|
117
|
+
<Icons.Bell />
|
|
118
|
+
</Button>
|
|
119
|
+
<Avatar fallback="AM" alt="Alex Morgan" size="sm" />
|
|
120
|
+
</>
|
|
121
|
+
}
|
|
122
|
+
/>
|
|
123
|
+
|
|
124
|
+
<main className="flex flex-1 flex-col gap-6 p-6">
|
|
125
|
+
{active === 'overview' ? (
|
|
126
|
+
<>
|
|
127
|
+
<div className="flex items-center justify-between">
|
|
128
|
+
<div>
|
|
129
|
+
<h1 className="text-lg font-semibold">Overview</h1>
|
|
130
|
+
<p className="text-foreground-muted text-sm">
|
|
131
|
+
Replace this with your own data — every section is a primitive.
|
|
132
|
+
</p>
|
|
133
|
+
</div>
|
|
134
|
+
<Button onClick={() => toast({ title: 'Report queued', variant: 'success' })}>
|
|
135
|
+
<Icons.Download />
|
|
136
|
+
Export
|
|
137
|
+
</Button>
|
|
138
|
+
</div>
|
|
139
|
+
|
|
140
|
+
<div className="grid gap-4 sm:grid-cols-2 xl:grid-cols-4">
|
|
141
|
+
{stats.map((s) => (
|
|
142
|
+
<Card key={s.label}>
|
|
143
|
+
<CardHeader>
|
|
144
|
+
<CardDescription>{s.label}</CardDescription>
|
|
145
|
+
<CardTitle className="text-2xl tabular-nums">{s.value}</CardTitle>
|
|
146
|
+
</CardHeader>
|
|
147
|
+
<CardContent>
|
|
148
|
+
<Badge tone={s.tone}>{s.delta}</Badge>
|
|
149
|
+
</CardContent>
|
|
150
|
+
</Card>
|
|
151
|
+
))}
|
|
152
|
+
</div>
|
|
153
|
+
|
|
154
|
+
<Card>
|
|
155
|
+
<CardHeader>
|
|
156
|
+
<CardTitle>Recent orders</CardTitle>
|
|
157
|
+
<CardDescription>Last 24 hours.</CardDescription>
|
|
158
|
+
</CardHeader>
|
|
159
|
+
<CardContent>
|
|
160
|
+
<Table>
|
|
161
|
+
<TableHeader>
|
|
162
|
+
<TableRow>
|
|
163
|
+
<TableHead>Order</TableHead>
|
|
164
|
+
<TableHead>Customer</TableHead>
|
|
165
|
+
<TableHead>Status</TableHead>
|
|
166
|
+
<TableHead className="text-right">Amount</TableHead>
|
|
167
|
+
</TableRow>
|
|
168
|
+
</TableHeader>
|
|
169
|
+
<TableBody>
|
|
170
|
+
{orders.map((o) => (
|
|
171
|
+
<TableRow key={o.id}>
|
|
172
|
+
<TableCell className="font-mono text-xs">{o.id}</TableCell>
|
|
173
|
+
<TableCell>{o.customer}</TableCell>
|
|
174
|
+
<TableCell>
|
|
175
|
+
<Badge tone={statusTone[o.status as keyof typeof statusTone]} dot>
|
|
176
|
+
{o.status}
|
|
177
|
+
</Badge>
|
|
178
|
+
</TableCell>
|
|
179
|
+
<TableCell className="text-right tabular-nums">{o.amount}</TableCell>
|
|
180
|
+
</TableRow>
|
|
181
|
+
))}
|
|
182
|
+
</TableBody>
|
|
183
|
+
</Table>
|
|
184
|
+
</CardContent>
|
|
185
|
+
</Card>
|
|
186
|
+
</>
|
|
187
|
+
) : (
|
|
188
|
+
<EmptyState
|
|
189
|
+
title={`Nothing in ${active} yet`}
|
|
190
|
+
description="This page is a placeholder — build it from @gerege-systems/ui primitives."
|
|
191
|
+
action={<Button onClick={() => setActive('overview')}>Back to overview</Button>}
|
|
192
|
+
/>
|
|
193
|
+
)}
|
|
194
|
+
</main>
|
|
195
|
+
</div>
|
|
196
|
+
</div>
|
|
197
|
+
<Toaster />
|
|
198
|
+
</TooltipProvider>
|
|
199
|
+
);
|
|
200
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { StrictMode } from 'react';
|
|
2
|
+
import { createRoot } from 'react-dom/client';
|
|
3
|
+
import '@gerege-systems/ui/styles.css';
|
|
4
|
+
import { App } from './App';
|
|
5
|
+
|
|
6
|
+
createRoot(document.getElementById('root')!).render(
|
|
7
|
+
<StrictMode>
|
|
8
|
+
<App />
|
|
9
|
+
</StrictMode>,
|
|
10
|
+
);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"moduleResolution": "Bundler",
|
|
7
|
+
"jsx": "react-jsx",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"noEmit": true
|
|
12
|
+
},
|
|
13
|
+
"include": ["src"]
|
|
14
|
+
}
|