create-lumiose 0.0.0-stage → 0.1.0
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/dist/bin.d.ts +2 -0
- package/dist/bin.js +4 -0
- package/dist/main.d.ts +10 -0
- package/dist/main.js +183 -0
- package/dist/scaffold.d.ts +41 -0
- package/dist/scaffold.js +171 -0
- package/package.json +33 -3
- package/templates/minimal/src/routes/index.stsx +22 -0
- package/templates/spa/src/components/Counter.stsx +20 -0
- package/templates/spa/src/routes/_layout.stsx +33 -0
- package/templates/spa/src/routes/about.stsx +11 -0
- package/templates/spa/src/routes/index.stsx +16 -0
- package/templates/ssr/server.ts +9 -0
- package/templates/ssr/src/routes/_404.stsx +13 -0
- package/templates/ssr/src/routes/_layout.stsx +41 -0
- package/templates/ssr/src/routes/api/entries.ts +5 -0
- package/templates/ssr/src/routes/guestbook.stsx +71 -0
- package/templates/ssr/src/routes/index.stsx +27 -0
- package/templates/ssr/src/server/guestbook.server.ts +23 -0
- package/templates/static/src/lib/posts.ts +28 -0
- package/templates/static/src/routes/_404.stsx +13 -0
- package/templates/static/src/routes/_layout.stsx +49 -0
- package/templates/static/src/routes/about.stsx +14 -0
- package/templates/static/src/routes/blog/[slug].stsx +27 -0
- package/templates/static/src/routes/index.stsx +30 -0
- package/README.md +0 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Javi Aguilar
|
|
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/dist/bin.d.ts
ADDED
package/dist/bin.js
ADDED
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface CreateIO {
|
|
2
|
+
cwd: string;
|
|
3
|
+
write: (text: string) => void;
|
|
4
|
+
writeError: (text: string) => void;
|
|
5
|
+
/** Interactive questions; undefined when stdin is not a terminal. */
|
|
6
|
+
ask?: (question: string) => Promise<string>;
|
|
7
|
+
/** `npm_config_user_agent`, for the next-step commands. */
|
|
8
|
+
userAgent?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function main(argv: string[], io?: CreateIO): Promise<number>;
|
package/dist/main.js
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
// `create-lumiose [dir] [--template <name>]` (`pnpm create lumiose`): asks for what is missing when run
|
|
2
|
+
// in a terminal, or takes the defaults with --yes (and in non-interactive runs). Output follows the
|
|
3
|
+
// lumiose CLI contract: exit 0 created, 1 cannot create there, 2 misuse; `--format json` prints
|
|
4
|
+
// `{ command: "create", ok, ... }`.
|
|
5
|
+
import { createInterface } from "node:readline/promises";
|
|
6
|
+
import { relative, resolve } from "node:path";
|
|
7
|
+
import { parseArgs } from "node:util";
|
|
8
|
+
import { mcpCommand, mcpNote } from "@lumiose/cli/agents";
|
|
9
|
+
import pkg from "../package.json" with { type: "json" };
|
|
10
|
+
import { DEFAULT_TEMPLATE, scaffold, ScaffoldError, TEMPLATES, } from "./scaffold.js";
|
|
11
|
+
const USAGE = `Usage: create-lumiose [dir] [options]
|
|
12
|
+
|
|
13
|
+
Create a Lumiose app in <dir> (asked for when missing in a terminal; default: lumiose-app).
|
|
14
|
+
|
|
15
|
+
Options:
|
|
16
|
+
-t, --template <name> ${TEMPLATES.map((template) => template.name).join(" | ")} (default: ${DEFAULT_TEMPLATE})
|
|
17
|
+
--name <name> Package name (default: from the directory name)
|
|
18
|
+
-y, --yes Ask nothing: use the defaults
|
|
19
|
+
--force Write into a non-empty directory (same-name files are overwritten)
|
|
20
|
+
--mcp Register the Lumiose MCP server for Claude Code (.mcp.json) and Codex
|
|
21
|
+
(.codex/config.toml), run with your package manager
|
|
22
|
+
--format <format> human (default) or json: { command: "create", ok, ... } on stdout
|
|
23
|
+
-h, --help Show this help
|
|
24
|
+
-v, --version Show the version
|
|
25
|
+
|
|
26
|
+
Templates:
|
|
27
|
+
${TEMPLATES.map((template) => ` ${template.name.padEnd(8)} ${template.description} (mode: ${template.mode})`).join("\n")}
|
|
28
|
+
|
|
29
|
+
Exit codes: 0 created, 1 the directory cannot be used, 2 misuse.
|
|
30
|
+
|
|
31
|
+
Examples:
|
|
32
|
+
pnpm create lumiose my-app --template ssr
|
|
33
|
+
create-lumiose my-site -t static --yes --format json
|
|
34
|
+
pnpm create lumiose my-app --mcp
|
|
35
|
+
`;
|
|
36
|
+
export async function main(argv, io = processIO()) {
|
|
37
|
+
const json = argv.some((arg, index) => arg === "--format=json" || (arg === "--format" && argv[index + 1] === "json"));
|
|
38
|
+
const usageError = (message) => {
|
|
39
|
+
if (json) {
|
|
40
|
+
io.write(envelope(false, { failure: { message, help: 'Run "create-lumiose --help".' } }));
|
|
41
|
+
}
|
|
42
|
+
else
|
|
43
|
+
io.writeError(`create-lumiose: ${message}\nRun "create-lumiose --help" for the options.\n`);
|
|
44
|
+
return 2;
|
|
45
|
+
};
|
|
46
|
+
let parsed;
|
|
47
|
+
try {
|
|
48
|
+
parsed = parseArgs({
|
|
49
|
+
args: argv,
|
|
50
|
+
allowPositionals: true,
|
|
51
|
+
options: {
|
|
52
|
+
template: { type: "string", short: "t" },
|
|
53
|
+
name: { type: "string" },
|
|
54
|
+
yes: { type: "boolean", short: "y" },
|
|
55
|
+
force: { type: "boolean" },
|
|
56
|
+
mcp: { type: "boolean" },
|
|
57
|
+
format: { type: "string" },
|
|
58
|
+
help: { type: "boolean", short: "h" },
|
|
59
|
+
version: { type: "boolean", short: "v" },
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
return usageError(error.message);
|
|
65
|
+
}
|
|
66
|
+
const { values, positionals } = parsed;
|
|
67
|
+
if (values.format !== undefined && values.format !== "human" && values.format !== "json") {
|
|
68
|
+
return usageError(`--format must be "human" or "json", not "${values.format}".`);
|
|
69
|
+
}
|
|
70
|
+
if (values.help) {
|
|
71
|
+
io.write(USAGE);
|
|
72
|
+
return 0;
|
|
73
|
+
}
|
|
74
|
+
if (values.version) {
|
|
75
|
+
io.write(json ? envelope(true, { version: pkg.version }) : `create-lumiose ${pkg.version}\n`);
|
|
76
|
+
return 0;
|
|
77
|
+
}
|
|
78
|
+
if (positionals.length > 1)
|
|
79
|
+
return usageError(`Unexpected argument "${positionals[1]}".`);
|
|
80
|
+
if (values.template !== undefined && !isTemplate(values.template)) {
|
|
81
|
+
return usageError(`Unknown template "${values.template}". Pick one of: ${TEMPLATES.map((t) => t.name).join(", ")}.`);
|
|
82
|
+
}
|
|
83
|
+
const ask = values.yes || json ? undefined : io.ask;
|
|
84
|
+
let dir = positionals[0];
|
|
85
|
+
if (dir === undefined && ask)
|
|
86
|
+
dir = (await ask("Project directory (lumiose-app): ")).trim();
|
|
87
|
+
dir ||= "lumiose-app";
|
|
88
|
+
let template = values.template;
|
|
89
|
+
if (template === undefined && ask)
|
|
90
|
+
template = await askTemplate(ask);
|
|
91
|
+
template ??= DEFAULT_TEMPLATE;
|
|
92
|
+
const pm = packageManager(io.userAgent);
|
|
93
|
+
let result;
|
|
94
|
+
try {
|
|
95
|
+
result = await scaffold({
|
|
96
|
+
dir: resolve(io.cwd, dir),
|
|
97
|
+
template,
|
|
98
|
+
...(values.name === undefined ? {} : { name: values.name }),
|
|
99
|
+
force: values.force ?? false,
|
|
100
|
+
...(values.mcp ? { mcp: pm } : {}),
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
if (!(error instanceof ScaffoldError))
|
|
105
|
+
throw error;
|
|
106
|
+
if (json)
|
|
107
|
+
io.write(envelope(false, { failure: { message: error.message } }));
|
|
108
|
+
else
|
|
109
|
+
io.writeError(`create-lumiose: ${error.message}\n`);
|
|
110
|
+
return 1;
|
|
111
|
+
}
|
|
112
|
+
const fromCwd = relative(io.cwd, result.dir);
|
|
113
|
+
const cd = fromCwd.startsWith("..") ? result.dir : fromCwd || ".";
|
|
114
|
+
const next = [
|
|
115
|
+
...(cd === "." ? [] : [`cd ${cd.includes(" ") ? JSON.stringify(cd) : cd}`]),
|
|
116
|
+
`${pm} install`,
|
|
117
|
+
`${pm} ${pm === "npm" ? "run dev" : "dev"}`,
|
|
118
|
+
];
|
|
119
|
+
if (json) {
|
|
120
|
+
io.write(envelope(true, {
|
|
121
|
+
dir: result.dir,
|
|
122
|
+
name: result.name,
|
|
123
|
+
template: result.template.name,
|
|
124
|
+
mode: result.template.mode,
|
|
125
|
+
files: result.files,
|
|
126
|
+
next,
|
|
127
|
+
...(values.mcp ? { mcp: { ...mcpCommand(pm), note: mcpNote(pm) } } : {}),
|
|
128
|
+
}));
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
io.write(`\nCreated ${result.name} in ${result.dir} (template: ${result.template.name}, mode: ${result.template.mode}).\n` +
|
|
132
|
+
`Agent-ready: AGENTS.md, CLAUDE.md and the lumiose skill (.claude/skills/lumiose).\n` +
|
|
133
|
+
(values.mcp
|
|
134
|
+
? `MCP: .mcp.json (Claude Code) and .codex/config.toml (Codex) run the Lumiose MCP server.\n${mcpNote(pm)}\n`
|
|
135
|
+
: "") +
|
|
136
|
+
"\n" +
|
|
137
|
+
`Next:\n${next.map((line) => ` ${line}\n`).join("")}`);
|
|
138
|
+
}
|
|
139
|
+
return 0;
|
|
140
|
+
}
|
|
141
|
+
async function askTemplate(ask) {
|
|
142
|
+
const list = TEMPLATES.map((template, index) => ` ${index + 1}. ${template.name.padEnd(8)} ${template.description}`).join("\n");
|
|
143
|
+
const defaultIndex = TEMPLATES.findIndex((template) => template.name === DEFAULT_TEMPLATE) + 1;
|
|
144
|
+
for (;;) {
|
|
145
|
+
const answer = (await ask(`Template:\n${list}\nPick one (${defaultIndex}): `)).trim();
|
|
146
|
+
if (answer === "")
|
|
147
|
+
return DEFAULT_TEMPLATE;
|
|
148
|
+
const picked = TEMPLATES[Number(answer) - 1]?.name ?? (isTemplate(answer) ? answer : undefined);
|
|
149
|
+
if (picked)
|
|
150
|
+
return picked;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
function isTemplate(name) {
|
|
154
|
+
return TEMPLATES.some((template) => template.name === name);
|
|
155
|
+
}
|
|
156
|
+
function envelope(ok, payload) {
|
|
157
|
+
return `${JSON.stringify({ command: "create", ok, ...payload }, null, 2)}\n`;
|
|
158
|
+
}
|
|
159
|
+
/** The package manager that runs us (`pnpm create lumiose`, `npm create lumiose`, …). */
|
|
160
|
+
function packageManager(userAgent) {
|
|
161
|
+
const name = userAgent?.split("/")[0];
|
|
162
|
+
return name === "npm" || name === "yarn" || name === "bun" ? name : "pnpm";
|
|
163
|
+
}
|
|
164
|
+
function processIO() {
|
|
165
|
+
return {
|
|
166
|
+
cwd: process.cwd(),
|
|
167
|
+
write: (text) => void process.stdout.write(text),
|
|
168
|
+
writeError: (text) => void process.stderr.write(text),
|
|
169
|
+
...(process.stdin.isTTY ? { ask: askInTerminal } : {}),
|
|
170
|
+
...(process.env["npm_config_user_agent"] === undefined
|
|
171
|
+
? {}
|
|
172
|
+
: { userAgent: process.env["npm_config_user_agent"] }),
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
async function askInTerminal(question) {
|
|
176
|
+
const readline = createInterface({ input: process.stdin, output: process.stdout });
|
|
177
|
+
try {
|
|
178
|
+
return await readline.question(question);
|
|
179
|
+
}
|
|
180
|
+
finally {
|
|
181
|
+
readline.close();
|
|
182
|
+
}
|
|
183
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type AgentFile, type PackageManager } from "@lumiose/cli/agents";
|
|
2
|
+
export type TemplateName = "minimal" | "static" | "ssr" | "spa";
|
|
3
|
+
export interface Template {
|
|
4
|
+
name: TemplateName;
|
|
5
|
+
/** The project default route mode, `lumiose({ mode })`. */
|
|
6
|
+
mode: "static" | "server" | "spa";
|
|
7
|
+
description: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const TEMPLATES: readonly Template[];
|
|
10
|
+
export declare const DEFAULT_TEMPLATE: TemplateName;
|
|
11
|
+
/** A problem with the target (not empty, invalid name): the CLI exits with 1. */
|
|
12
|
+
export declare class ScaffoldError extends Error {
|
|
13
|
+
name: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ScaffoldOptions {
|
|
16
|
+
/** Target directory; created if missing. */
|
|
17
|
+
dir: string;
|
|
18
|
+
template: TemplateName;
|
|
19
|
+
/** Package name. Default: derived from the directory name. */
|
|
20
|
+
name?: string;
|
|
21
|
+
/** Write into a non-empty directory, overwriting files with the same names. */
|
|
22
|
+
force?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Register `lumiose mcp` for Claude Code (`.mcp.json`) and Codex (`.codex/config.toml`), run with
|
|
25
|
+
* this package manager.
|
|
26
|
+
*/
|
|
27
|
+
mcp?: PackageManager;
|
|
28
|
+
}
|
|
29
|
+
export interface ScaffoldResult {
|
|
30
|
+
/** Absolute target directory. */
|
|
31
|
+
dir: string;
|
|
32
|
+
name: string;
|
|
33
|
+
template: Template;
|
|
34
|
+
/** Written files, project-relative, sorted. */
|
|
35
|
+
files: string[];
|
|
36
|
+
agentFiles: AgentFile[];
|
|
37
|
+
}
|
|
38
|
+
export declare function scaffold(options: ScaffoldOptions): Promise<ScaffoldResult>;
|
|
39
|
+
/** `My App!` → `my-app`. */
|
|
40
|
+
export declare function packageName(text: string): string;
|
|
41
|
+
export declare function isValidPackageName(name: string): boolean;
|
package/dist/scaffold.js
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
// Writes a new Lumiose project: a template's `src/` (and extras), the generated package.json,
|
|
2
|
+
// tsconfig.json (extending the generated one, decision-25), vite.config.ts with the template's `lumiose({ mode })` (decision-21),
|
|
3
|
+
// .gitignore and README, then the agent files (AGENTS.md, CLAUDE.md, the lumiose skill,
|
|
4
|
+
// .gitattributes) from `@lumiose/cli/agents`, shared with `lumiose agents init`.
|
|
5
|
+
import { existsSync } from "node:fs";
|
|
6
|
+
import { mkdir, readdir, readFile, writeFile } from "node:fs/promises";
|
|
7
|
+
import { basename, dirname, join, relative, resolve, sep } from "node:path";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
9
|
+
import { agentsInit } from "@lumiose/cli/agents";
|
|
10
|
+
import cliPackage from "@lumiose/cli/package.json" with { type: "json" };
|
|
11
|
+
import lumiosePackage from "lumiose/package.json" with { type: "json" };
|
|
12
|
+
import { formatTsconfig } from "@lumiose/cli/tooling";
|
|
13
|
+
export const TEMPLATES = [
|
|
14
|
+
{ name: "minimal", mode: "static", description: "One static page: the smallest Lumiose app" },
|
|
15
|
+
{
|
|
16
|
+
name: "static",
|
|
17
|
+
mode: "static",
|
|
18
|
+
description: "A static site: a layout, pages, a blog with staticPaths() and a 404 page",
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: "ssr",
|
|
22
|
+
mode: "server",
|
|
23
|
+
description: "Rendered per request: streaming, a form action, a JSON endpoint and a Node server",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: "spa",
|
|
27
|
+
mode: "spa",
|
|
28
|
+
description: "A client-rendered app: pages and a persistent layout running in the browser",
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
export const DEFAULT_TEMPLATE = "static";
|
|
32
|
+
const TEMPLATES_DIR = fileURLToPath(new URL("../templates/", import.meta.url));
|
|
33
|
+
/** Tool versions the generated package.json asks for (the Lumiose packages share a version). */
|
|
34
|
+
const VERSIONS = {
|
|
35
|
+
lumiose: `^${lumiosePackage.version}`,
|
|
36
|
+
vite: cliPackage.peerDependencies.vite,
|
|
37
|
+
typescript: "^7.0.2",
|
|
38
|
+
oxlint: "^1.87.0",
|
|
39
|
+
oxfmt: "^0.72.0",
|
|
40
|
+
};
|
|
41
|
+
/** A problem with the target (not empty, invalid name): the CLI exits with 1. */
|
|
42
|
+
export class ScaffoldError extends Error {
|
|
43
|
+
name = "ScaffoldError";
|
|
44
|
+
}
|
|
45
|
+
export async function scaffold(options) {
|
|
46
|
+
const dir = resolve(options.dir);
|
|
47
|
+
const template = TEMPLATES.find((candidate) => candidate.name === options.template);
|
|
48
|
+
if (!template)
|
|
49
|
+
throw new ScaffoldError(`Unknown template "${options.template}".`);
|
|
50
|
+
const name = options.name ?? packageName(basename(dir));
|
|
51
|
+
if (!isValidPackageName(name)) {
|
|
52
|
+
throw new ScaffoldError(`"${name}" is not a valid package name: use lowercase letters, digits, "-", "." and "_" (pass --name).`);
|
|
53
|
+
}
|
|
54
|
+
if (!options.force && existsSync(dir) && (await readdir(dir)).some((entry) => entry !== ".git")) {
|
|
55
|
+
throw new ScaffoldError(`${dir} is not empty. Pick a new directory, or pass --force.`);
|
|
56
|
+
}
|
|
57
|
+
const files = new Map();
|
|
58
|
+
const templateDir = join(TEMPLATES_DIR, template.name);
|
|
59
|
+
for (const file of await listFiles(templateDir)) {
|
|
60
|
+
const text = await readFile(join(templateDir, file), "utf8");
|
|
61
|
+
files.set(file, text.replaceAll("{{name}}", name));
|
|
62
|
+
}
|
|
63
|
+
files.set("package.json", packageJson(name, template));
|
|
64
|
+
files.set("tsconfig.json", formatTsconfig());
|
|
65
|
+
files.set("vite.config.ts", viteConfig(template));
|
|
66
|
+
files.set(".gitignore", "node_modules\ndist\n.lumiose\n");
|
|
67
|
+
files.set("README.md", readme(name, template));
|
|
68
|
+
for (const [file, text] of files) {
|
|
69
|
+
await mkdir(dirname(join(dir, file)), { recursive: true });
|
|
70
|
+
await writeFile(join(dir, file), text);
|
|
71
|
+
}
|
|
72
|
+
const agentFiles = await agentsInit(dir, {
|
|
73
|
+
name,
|
|
74
|
+
...(options.mcp === undefined ? {} : { mcp: options.mcp }),
|
|
75
|
+
});
|
|
76
|
+
return {
|
|
77
|
+
dir,
|
|
78
|
+
name,
|
|
79
|
+
template,
|
|
80
|
+
files: [...files.keys(), ...agentFiles.map((file) => file.file)].toSorted(),
|
|
81
|
+
agentFiles,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/** `My App!` → `my-app`. */
|
|
85
|
+
export function packageName(text) {
|
|
86
|
+
return (text
|
|
87
|
+
.trim()
|
|
88
|
+
.toLowerCase()
|
|
89
|
+
.replace(/[^a-z0-9._~-]+/g, "-")
|
|
90
|
+
.replace(/^[-._]+|-+$/g, "") || "lumiose-app");
|
|
91
|
+
}
|
|
92
|
+
export function isValidPackageName(name) {
|
|
93
|
+
return /^(?:@[a-z0-9][a-z0-9._~-]*\/)?[a-z0-9][a-z0-9._~-]*$/.test(name) && name.length <= 214;
|
|
94
|
+
}
|
|
95
|
+
function packageJson(name, template) {
|
|
96
|
+
const server = template.mode === "server";
|
|
97
|
+
// The adapter serves `lumiose preview` everywhere and is the production server of `ssr`.
|
|
98
|
+
const adapter = { "@lumiose/adapter-node": VERSIONS.lumiose };
|
|
99
|
+
const manifest = {
|
|
100
|
+
name,
|
|
101
|
+
version: "0.0.0",
|
|
102
|
+
private: true,
|
|
103
|
+
type: "module",
|
|
104
|
+
scripts: {
|
|
105
|
+
dev: "lumiose dev",
|
|
106
|
+
build: "lumiose build",
|
|
107
|
+
preview: "lumiose preview",
|
|
108
|
+
...(server ? { start: "node server.ts" } : {}),
|
|
109
|
+
check: "lumiose check",
|
|
110
|
+
lint: "lumiose lint",
|
|
111
|
+
fmt: "lumiose fmt",
|
|
112
|
+
},
|
|
113
|
+
dependencies: { ...(server ? adapter : {}), lumiose: VERSIONS.lumiose },
|
|
114
|
+
devDependencies: {
|
|
115
|
+
...(server ? {} : adapter),
|
|
116
|
+
"@lumiose/cli": VERSIONS.lumiose,
|
|
117
|
+
"@lumiose/vite": VERSIONS.lumiose,
|
|
118
|
+
oxfmt: VERSIONS.oxfmt,
|
|
119
|
+
oxlint: VERSIONS.oxlint,
|
|
120
|
+
typescript: VERSIONS.typescript,
|
|
121
|
+
vite: VERSIONS.vite,
|
|
122
|
+
},
|
|
123
|
+
engines: { node: ">=24" },
|
|
124
|
+
};
|
|
125
|
+
return `${JSON.stringify(manifest, null, 2)}\n`;
|
|
126
|
+
}
|
|
127
|
+
function viteConfig(template) {
|
|
128
|
+
return `import lumiose from "@lumiose/vite";
|
|
129
|
+
import { defineConfig } from "vite";
|
|
130
|
+
|
|
131
|
+
export default defineConfig({
|
|
132
|
+
// The default mode of every route: "static" (built HTML), "server" (rendered per request) or
|
|
133
|
+
// "spa" (rendered in the browser). A route or layout overrides it with \`export const mode\`.
|
|
134
|
+
plugins: [lumiose({ mode: "${template.mode}" })],
|
|
135
|
+
});
|
|
136
|
+
`;
|
|
137
|
+
}
|
|
138
|
+
function readme(name, template) {
|
|
139
|
+
const server = template.mode === "server";
|
|
140
|
+
return `# ${name}
|
|
141
|
+
|
|
142
|
+
${template.description}. Made with Lumiose (\`create-lumiose --template ${template.name}\`).
|
|
143
|
+
|
|
144
|
+
## Commands
|
|
145
|
+
|
|
146
|
+
- \`pnpm dev\`: start the dev server with hot reload.
|
|
147
|
+
- \`pnpm build\`: build into \`dist/\` and prerender the static routes.
|
|
148
|
+
- \`pnpm preview\`: serve the build locally.${server ? "\n- `pnpm start`: serve the build in production (`server.ts`, `@lumiose/adapter-node`)." : ""}
|
|
149
|
+
- \`pnpm check\`: type-check and report Lumiose diagnostics (\`--format json\` for tools).
|
|
150
|
+
- \`pnpm lint\` and \`pnpm fmt\`: lint and format, \`.stsx\` files and \`<style>\` blocks included.
|
|
151
|
+
|
|
152
|
+
## Layout
|
|
153
|
+
|
|
154
|
+
- \`src/routes/\`: pages (\`.stsx\`) and endpoints (\`.ts\`); the file path is the URL.
|
|
155
|
+
- \`vite.config.ts\`: \`lumiose({ mode: "${template.mode}" })\` sets the default route mode.
|
|
156
|
+
- \`.lumiose/\`: generated types and shadow files (git-ignored).
|
|
157
|
+
|
|
158
|
+
\`.stsx\` files are TSX with raw-CSS \`<style>\` blocks. The docs for your Lumiose version are in
|
|
159
|
+
\`node_modules/lumiose/docs\` (\`npx lumiose docs <topic>\`). Coding agents: see \`AGENTS.md\`.
|
|
160
|
+
`;
|
|
161
|
+
}
|
|
162
|
+
async function listFiles(dir, base = dir) {
|
|
163
|
+
const entries = await readdir(dir, { withFileTypes: true });
|
|
164
|
+
const nested = await Promise.all(entries.map(async (entry) => {
|
|
165
|
+
const path = join(dir, entry.name);
|
|
166
|
+
if (entry.isDirectory())
|
|
167
|
+
return listFiles(path, base);
|
|
168
|
+
return [relative(base, path).split(sep).join("/")];
|
|
169
|
+
}));
|
|
170
|
+
return nested.flat();
|
|
171
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-lumiose",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Create a Lumiose app: `pnpm create lumiose my-app --template ssr`. Every project starts agent-ready (AGENTS.md, CLAUDE.md, the lumiose skill).",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/itsjavi/lumiose.git",
|
|
9
|
+
"directory": "packages/create"
|
|
10
|
+
},
|
|
11
|
+
"bin": {
|
|
12
|
+
"create-lumiose": "./dist/bin.js"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"templates"
|
|
17
|
+
],
|
|
18
|
+
"type": "module",
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@lumiose/cli": "0.1.0",
|
|
21
|
+
"lumiose": "0.1.0"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@lumiose/adapter-node": "0.1.0",
|
|
25
|
+
"typescript": "^7.0.2",
|
|
26
|
+
"vite": "^8.3.4"
|
|
27
|
+
},
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=24"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
33
|
+
"test": "vitest run",
|
|
34
|
+
"build": "node ../../scripts/build-package.ts"
|
|
35
|
+
}
|
|
6
36
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Title } from "lumiose";
|
|
2
|
+
|
|
3
|
+
export default function Home() {
|
|
4
|
+
return (
|
|
5
|
+
<main>
|
|
6
|
+
<Title>{{name}}</Title>
|
|
7
|
+
<h1>{{name}}</h1>
|
|
8
|
+
<p>
|
|
9
|
+
Edit <code>src/routes/index.stsx</code>: pages are files in <code>src/routes</code>.
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
<style>
|
|
13
|
+
main {
|
|
14
|
+
max-width: 40rem;
|
|
15
|
+
margin: 4rem auto;
|
|
16
|
+
padding: 0 1rem;
|
|
17
|
+
font-family: system-ui, sans-serif;
|
|
18
|
+
}
|
|
19
|
+
</style>
|
|
20
|
+
</main>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { signal } from "lumiose";
|
|
2
|
+
|
|
3
|
+
export function Counter(props: { start?: number }) {
|
|
4
|
+
const count = signal(props.start ?? 0);
|
|
5
|
+
|
|
6
|
+
return (
|
|
7
|
+
<button class={{ counter: true, hot: count() >= 5 }} onClick={() => count.update((n) => n + 1)}>
|
|
8
|
+
Clicked {count()} times
|
|
9
|
+
<style>
|
|
10
|
+
.counter {
|
|
11
|
+
font: inherit;
|
|
12
|
+
padding: 0.5rem 1rem;
|
|
13
|
+
}
|
|
14
|
+
.hot {
|
|
15
|
+
color: crimson;
|
|
16
|
+
}
|
|
17
|
+
</style>
|
|
18
|
+
</button>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// The root layout: in an `spa` app it stays mounted while the pages change.
|
|
2
|
+
import { href, type LayoutProps } from "lumiose";
|
|
3
|
+
|
|
4
|
+
export default function Layout(props: LayoutProps<"/">) {
|
|
5
|
+
return (
|
|
6
|
+
<div class="app">
|
|
7
|
+
<nav>
|
|
8
|
+
<a href={href("/")}>Home</a>
|
|
9
|
+
<a href={href("/about")}>About</a>
|
|
10
|
+
</nav>
|
|
11
|
+
{props.children}
|
|
12
|
+
|
|
13
|
+
<style>
|
|
14
|
+
.app {
|
|
15
|
+
max-width: 42rem;
|
|
16
|
+
margin: 0 auto;
|
|
17
|
+
padding: 1.5rem 1rem;
|
|
18
|
+
}
|
|
19
|
+
nav {
|
|
20
|
+
display: flex;
|
|
21
|
+
gap: 1rem;
|
|
22
|
+
margin-bottom: 2rem;
|
|
23
|
+
}
|
|
24
|
+
</style>
|
|
25
|
+
<style global>
|
|
26
|
+
body {
|
|
27
|
+
margin: 0;
|
|
28
|
+
font-family: system-ui, sans-serif;
|
|
29
|
+
}
|
|
30
|
+
</style>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Title } from "lumiose";
|
|
2
|
+
import { Counter } from "../components/Counter.stsx";
|
|
3
|
+
|
|
4
|
+
export default function Home() {
|
|
5
|
+
return (
|
|
6
|
+
<main>
|
|
7
|
+
<Title>{{name}}</Title>
|
|
8
|
+
<h1>{{name}}</h1>
|
|
9
|
+
<p>
|
|
10
|
+
An <code>spa</code> app: the whole page runs in the browser, so components need no
|
|
11
|
+
<code> client:</code> directive.
|
|
12
|
+
</p>
|
|
13
|
+
<Counter start={1} />
|
|
14
|
+
</main>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Production server: serves the `lumiose build` output (dist/) with @lumiose/adapter-node. Static
|
|
2
|
+
// files come from dist/client; every other request goes to the app in dist/server/entry.js.
|
|
3
|
+
// Set PORT, HOST and ORIGIN as needed.
|
|
4
|
+
//
|
|
5
|
+
// pnpm build && pnpm start
|
|
6
|
+
import { createServer } from "@lumiose/adapter-node";
|
|
7
|
+
|
|
8
|
+
const { url } = await createServer({ dir: new URL("dist", import.meta.url) });
|
|
9
|
+
console.log(`Listening on ${url}`);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// The root layout: wraps every page.
|
|
2
|
+
import { href, type LayoutProps } from "lumiose";
|
|
3
|
+
|
|
4
|
+
export default function Layout(props: LayoutProps<"/">) {
|
|
5
|
+
return (
|
|
6
|
+
<div class="app">
|
|
7
|
+
<header>
|
|
8
|
+
<a class="brand" href={href("/")}>
|
|
9
|
+
{{name}}
|
|
10
|
+
</a>
|
|
11
|
+
<nav>
|
|
12
|
+
<a href={href("/guestbook")}>Guestbook</a>
|
|
13
|
+
</nav>
|
|
14
|
+
</header>
|
|
15
|
+
{props.children}
|
|
16
|
+
|
|
17
|
+
<style>
|
|
18
|
+
.app {
|
|
19
|
+
max-width: 42rem;
|
|
20
|
+
margin: 0 auto;
|
|
21
|
+
padding: 1.5rem 1rem;
|
|
22
|
+
}
|
|
23
|
+
header {
|
|
24
|
+
display: flex;
|
|
25
|
+
justify-content: space-between;
|
|
26
|
+
margin-bottom: 2rem;
|
|
27
|
+
}
|
|
28
|
+
.brand {
|
|
29
|
+
font-weight: 700;
|
|
30
|
+
}
|
|
31
|
+
</style>
|
|
32
|
+
<style global>
|
|
33
|
+
body {
|
|
34
|
+
margin: 0;
|
|
35
|
+
font-family: system-ui, sans-serif;
|
|
36
|
+
line-height: 1.6;
|
|
37
|
+
}
|
|
38
|
+
</style>
|
|
39
|
+
</div>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// A form that works without JavaScript: it posts to the `sign` action, which validates the input
|
|
2
|
+
// and redirects back (or returns the errors, which the page reads with actionData()).
|
|
3
|
+
import { actionData, fail, redirect, Title, type ActionContext } from "lumiose";
|
|
4
|
+
import { addEntry, listEntries } from "../server/guestbook.server.ts";
|
|
5
|
+
|
|
6
|
+
interface Errors {
|
|
7
|
+
name?: string;
|
|
8
|
+
message?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const actions = {
|
|
12
|
+
async sign(ctx: ActionContext<"/guestbook">) {
|
|
13
|
+
const form = await ctx.formData();
|
|
14
|
+
const name = String(form.get("name") ?? "").trim();
|
|
15
|
+
const message = String(form.get("message") ?? "").trim();
|
|
16
|
+
const errors: Errors = {};
|
|
17
|
+
if (name === "") errors.name = "Your name is required.";
|
|
18
|
+
if (message === "") errors.message = "Write a message.";
|
|
19
|
+
if (errors.name || errors.message) return fail(400, errors);
|
|
20
|
+
addEntry(name, message);
|
|
21
|
+
redirect("/guestbook");
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default function Guestbook() {
|
|
26
|
+
const errors = actionData<typeof actions>();
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<main>
|
|
30
|
+
<Title>Guestbook · {{name}}</Title>
|
|
31
|
+
<h1>Guestbook</h1>
|
|
32
|
+
<form method="post" action="?/sign">
|
|
33
|
+
<label>
|
|
34
|
+
Name <input name="name" />
|
|
35
|
+
</label>
|
|
36
|
+
<p class="error">{errors?.name}</p>
|
|
37
|
+
<label>
|
|
38
|
+
Message <textarea name="message" />
|
|
39
|
+
</label>
|
|
40
|
+
<p class="error">{errors?.message}</p>
|
|
41
|
+
<button>Sign</button>
|
|
42
|
+
</form>
|
|
43
|
+
<ul class="entries">
|
|
44
|
+
{listEntries().map((entry) => (
|
|
45
|
+
<li key={entry.id}>
|
|
46
|
+
<strong>{entry.name}</strong>: {entry.message}
|
|
47
|
+
</li>
|
|
48
|
+
))}
|
|
49
|
+
</ul>
|
|
50
|
+
|
|
51
|
+
<style>
|
|
52
|
+
form {
|
|
53
|
+
display: grid;
|
|
54
|
+
gap: 0.25rem;
|
|
55
|
+
max-width: 24rem;
|
|
56
|
+
}
|
|
57
|
+
label {
|
|
58
|
+
display: grid;
|
|
59
|
+
}
|
|
60
|
+
.error {
|
|
61
|
+
margin: 0;
|
|
62
|
+
color: crimson;
|
|
63
|
+
}
|
|
64
|
+
.entries {
|
|
65
|
+
padding: 0;
|
|
66
|
+
list-style: none;
|
|
67
|
+
}
|
|
68
|
+
</style>
|
|
69
|
+
</main>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Suspense, Title } from "lumiose";
|
|
2
|
+
import { listEntries } from "../server/guestbook.server.ts";
|
|
3
|
+
|
|
4
|
+
/** Slow data: the page is sent first and this part streams in when it resolves. */
|
|
5
|
+
async function GuestCount() {
|
|
6
|
+
await new Promise((resolve) => setTimeout(resolve, 300));
|
|
7
|
+
return <p class="count">{listEntries().length} guestbook entries so far.</p>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default function Home() {
|
|
11
|
+
return (
|
|
12
|
+
<main>
|
|
13
|
+
<Title>{{name}}</Title>
|
|
14
|
+
<h1>{{name}}</h1>
|
|
15
|
+
<p>Rendered on the server at {new Date().toLocaleTimeString("en")}, on every request.</p>
|
|
16
|
+
<Suspense fallback={<p class="count">Counting entries…</p>}>
|
|
17
|
+
<GuestCount />
|
|
18
|
+
</Suspense>
|
|
19
|
+
|
|
20
|
+
<style>
|
|
21
|
+
.count {
|
|
22
|
+
color: #555;
|
|
23
|
+
}
|
|
24
|
+
</style>
|
|
25
|
+
</main>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// A demo store: entries live in memory and are lost when the server restarts. Swap it for a
|
|
2
|
+
// database (node:sqlite, Postgres, …). `*.server.ts` modules never reach the browser:
|
|
3
|
+
// `lumiose dev` and `lumiose build` fail if client code imports one (LUM4003).
|
|
4
|
+
|
|
5
|
+
export interface Entry {
|
|
6
|
+
id: number;
|
|
7
|
+
name: string;
|
|
8
|
+
message: string;
|
|
9
|
+
createdAt: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const entries: Entry[] = [];
|
|
13
|
+
|
|
14
|
+
/** Newest first. */
|
|
15
|
+
export function listEntries(): Entry[] {
|
|
16
|
+
return entries.toReversed();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function addEntry(name: string, message: string): Entry {
|
|
20
|
+
const entry = { id: entries.length + 1, name, message, createdAt: new Date().toISOString() };
|
|
21
|
+
entries.push(entry);
|
|
22
|
+
return entry;
|
|
23
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// The blog's content. Replace it with Markdown files (`import.meta.glob("./posts/*.md", { query:
|
|
2
|
+
// "?raw" })`), a CMS or a database: pages read it at build time.
|
|
3
|
+
|
|
4
|
+
export interface Post {
|
|
5
|
+
slug: string;
|
|
6
|
+
title: string;
|
|
7
|
+
date: string;
|
|
8
|
+
body: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const posts: Post[] = [
|
|
12
|
+
{
|
|
13
|
+
slug: "hello-lumiose",
|
|
14
|
+
title: "Hello, Lumiose",
|
|
15
|
+
date: "2026-10-01",
|
|
16
|
+
body: "This site is static: every page is HTML built by `lumiose build`, with no JavaScript.",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
slug: "adding-pages",
|
|
20
|
+
title: "Adding pages",
|
|
21
|
+
date: "2026-10-02",
|
|
22
|
+
body: "Add a file under src/routes. Pages with params list their paths in staticPaths().",
|
|
23
|
+
},
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
export function findPost(slug: string): Post | undefined {
|
|
27
|
+
return posts.find((post) => post.slug === slug);
|
|
28
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// The root layout: wraps every page.
|
|
2
|
+
import { href, type LayoutProps } from "lumiose";
|
|
3
|
+
|
|
4
|
+
export default function Layout(props: LayoutProps<"/">) {
|
|
5
|
+
return (
|
|
6
|
+
<div class="site">
|
|
7
|
+
<header>
|
|
8
|
+
<a class="brand" href={href("/")}>
|
|
9
|
+
{{name}}
|
|
10
|
+
</a>
|
|
11
|
+
<nav>
|
|
12
|
+
<a href={href("/about")}>About</a>
|
|
13
|
+
</nav>
|
|
14
|
+
</header>
|
|
15
|
+
{props.children}
|
|
16
|
+
<footer>Built with Lumiose.</footer>
|
|
17
|
+
|
|
18
|
+
<style>
|
|
19
|
+
.site {
|
|
20
|
+
max-width: 42rem;
|
|
21
|
+
margin: 0 auto;
|
|
22
|
+
padding: 1.5rem 1rem;
|
|
23
|
+
}
|
|
24
|
+
header {
|
|
25
|
+
display: flex;
|
|
26
|
+
justify-content: space-between;
|
|
27
|
+
margin-bottom: 2rem;
|
|
28
|
+
}
|
|
29
|
+
.brand {
|
|
30
|
+
font-weight: 700;
|
|
31
|
+
}
|
|
32
|
+
footer {
|
|
33
|
+
margin-top: 3rem;
|
|
34
|
+
color: #666;
|
|
35
|
+
}
|
|
36
|
+
</style>
|
|
37
|
+
<style global>
|
|
38
|
+
body {
|
|
39
|
+
margin: 0;
|
|
40
|
+
font-family: system-ui, sans-serif;
|
|
41
|
+
line-height: 1.6;
|
|
42
|
+
}
|
|
43
|
+
a {
|
|
44
|
+
color: #4338ca;
|
|
45
|
+
}
|
|
46
|
+
</style>
|
|
47
|
+
</div>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Title } from "lumiose";
|
|
2
|
+
|
|
3
|
+
export default function About() {
|
|
4
|
+
return (
|
|
5
|
+
<main>
|
|
6
|
+
<Title>About · {{name}}</Title>
|
|
7
|
+
<h1>About</h1>
|
|
8
|
+
<p>
|
|
9
|
+
A static site made with Lumiose. <code>lumiose build</code> prerenders every page to HTML in
|
|
10
|
+
<code> dist/client</code>, ready for any static host.
|
|
11
|
+
</p>
|
|
12
|
+
</main>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { notFound, params, Title } from "lumiose";
|
|
2
|
+
import { findPost, posts } from "../../lib/posts.ts";
|
|
3
|
+
|
|
4
|
+
/** The paths `lumiose build` prerenders for this route. */
|
|
5
|
+
export async function staticPaths() {
|
|
6
|
+
return posts.map((post) => ({ params: { slug: post.slug } }));
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default function BlogPost() {
|
|
10
|
+
const post = findPost(params<"/blog/[slug]">().slug);
|
|
11
|
+
if (!post) notFound();
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<article>
|
|
15
|
+
<Title>{post.title} · {{name}}</Title>
|
|
16
|
+
<h1>{post.title}</h1>
|
|
17
|
+
<time>{post.date}</time>
|
|
18
|
+
<p>{post.body}</p>
|
|
19
|
+
|
|
20
|
+
<style>
|
|
21
|
+
time {
|
|
22
|
+
color: #666;
|
|
23
|
+
}
|
|
24
|
+
</style>
|
|
25
|
+
</article>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { href, Title } from "lumiose";
|
|
2
|
+
import { posts } from "../lib/posts.ts";
|
|
3
|
+
|
|
4
|
+
export default function Home() {
|
|
5
|
+
return (
|
|
6
|
+
<main>
|
|
7
|
+
<Title>{{name}}</Title>
|
|
8
|
+
<h1>Posts</h1>
|
|
9
|
+
<ul class="posts">
|
|
10
|
+
{posts.map((post) => (
|
|
11
|
+
<li key={post.slug}>
|
|
12
|
+
<a href={href("/blog/[slug]", { slug: post.slug })}>{post.title}</a>
|
|
13
|
+
<time>{post.date}</time>
|
|
14
|
+
</li>
|
|
15
|
+
))}
|
|
16
|
+
</ul>
|
|
17
|
+
|
|
18
|
+
<style>
|
|
19
|
+
.posts {
|
|
20
|
+
padding: 0;
|
|
21
|
+
list-style: none;
|
|
22
|
+
}
|
|
23
|
+
time {
|
|
24
|
+
margin-left: 0.5rem;
|
|
25
|
+
color: #666;
|
|
26
|
+
}
|
|
27
|
+
</style>
|
|
28
|
+
</main>
|
|
29
|
+
);
|
|
30
|
+
}
|
package/README.md
DELETED