idcmd 0.0.7 → 0.0.8
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/README.md +10 -10
- package/package.json +4 -4
- package/src/build.ts +36 -34
- package/src/cli/commands/build.ts +1 -1
- package/src/cli/commands/client.ts +4 -4
- package/src/cli/commands/deploy.ts +4 -4
- package/src/cli/commands/dev.ts +1 -1
- package/src/cli/commands/preview.ts +3 -3
- package/src/cli/runtime-assets.ts +2 -2
- package/src/project/paths.ts +11 -11
- package/src/render/layout-loader.ts +1 -1
- package/src/render/right-rail-loader.ts +1 -1
- package/src/search/index.ts +1 -1
- package/src/search/search-page-loader.ts +1 -1
- package/src/seo/server.ts +6 -6
- package/src/server/static.ts +3 -3
- package/src/server.ts +5 -5
- package/templates/default/README.md +8 -8
- package/templates/default/scripts/check-internal.ts +2 -2
- package/templates/default/scripts/check.ts +1 -1
- package/templates/default/site/{code → src}/server.ts +1 -1
- package/templates/default/vercel.json +1 -1
- package/public/anthropic-black.svg +0 -16
- package/public/anthropic-white.svg +0 -16
- package/public/favicon.svg +0 -13
- package/public/openai-black.svg +0 -15
- package/public/openai-white.svg +0 -15
- /package/templates/default/site/{code → src}/routes/api/hello.ts +0 -0
- /package/templates/default/site/{code → src}/runtime/live-reload.ts +0 -0
- /package/templates/default/site/{code → src}/runtime/llm-menu.ts +0 -0
- /package/templates/default/site/{code → src}/runtime/nav-prefetch.ts +0 -0
- /package/templates/default/site/{code → src}/runtime/right-rail-scrollspy.ts +0 -0
- /package/templates/default/site/{code → src}/ui/layout.tsx +0 -0
- /package/templates/default/site/{code → src}/ui/right-rail.tsx +0 -0
- /package/templates/default/site/{code → src}/ui/search-page.tsx +0 -0
package/README.md
CHANGED
|
@@ -16,22 +16,22 @@ Everything you edit lives in `site/`.
|
|
|
16
16
|
```bash
|
|
17
17
|
idcmd init [dir] # scaffold a new site
|
|
18
18
|
idcmd dev # tailwind watch + SSR dev server
|
|
19
|
-
idcmd build # static
|
|
20
|
-
idcmd preview # serve
|
|
19
|
+
idcmd build # static public/
|
|
20
|
+
idcmd preview # serve public/ locally
|
|
21
21
|
idcmd deploy # build + validate Vercel static deploy config
|
|
22
|
-
idcmd client ... # add/update local site/
|
|
22
|
+
idcmd client ... # add/update local site/src implementations
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
## Layout (V1)
|
|
26
26
|
|
|
27
27
|
- `site/content/<slug>.md` -> `/<slug>/` (`index.md` -> `/`)
|
|
28
|
-
- `site/
|
|
29
|
-
- `site/
|
|
30
|
-
- `site/
|
|
31
|
-
- `site/styles/tailwind.css` -> `
|
|
28
|
+
- `site/src/ui/*` is local UI source code (you own and edit these files)
|
|
29
|
+
- `site/src/runtime/*.ts` is local browser runtime code (compiled to `public/_idcmd/*.js`)
|
|
30
|
+
- `site/src/routes/**` file-based server routes (dev/server-host only)
|
|
31
|
+
- `site/styles/tailwind.css` -> `public/styles.css`
|
|
32
32
|
- `site/assets/` static assets
|
|
33
33
|
- `site/site.jsonc` site config
|
|
34
|
-
- `
|
|
34
|
+
- `public/` generated output (gitignored)
|
|
35
35
|
|
|
36
36
|
## Syncing Local Client Code
|
|
37
37
|
|
|
@@ -45,7 +45,7 @@ idcmd client update runtime --yes
|
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
`add` creates missing files. `update` overwrites changed files and requires `--yes` unless `--dry-run` is used.
|
|
48
|
-
Runtime files in `site/
|
|
48
|
+
Runtime files in `site/src/runtime/` are compiled automatically by `idcmd dev` and `idcmd build`.
|
|
49
49
|
|
|
50
50
|
## Example: Add A Page
|
|
51
51
|
|
|
@@ -68,7 +68,7 @@ It renders at `/hello/`.
|
|
|
68
68
|
|
|
69
69
|
## Custom Server Routes (V1)
|
|
70
70
|
|
|
71
|
-
Add `site/
|
|
71
|
+
Add `site/src/routes/api/hello.ts`:
|
|
72
72
|
|
|
73
73
|
```ts
|
|
74
74
|
export const GET = (): Response => Response.json({ ok: true });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "idcmd",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/rustydotwtf/idcmd"
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
24
|
"dev": "concurrently -k -n css,server -c blue,green \"bun run dev:css\" \"bun run dev:server\"",
|
|
25
|
-
"dev:css": "bunx @tailwindcss/cli -i
|
|
25
|
+
"dev:css": "bunx @tailwindcss/cli -i site/styles/tailwind.css -o public/styles.css --watch",
|
|
26
26
|
"dev:server": "bun --hot src/server.ts",
|
|
27
|
-
"build:css": "bunx @tailwindcss/cli -i
|
|
27
|
+
"build:css": "bunx @tailwindcss/cli -i site/styles/tailwind.css -o public/styles.css --minify",
|
|
28
28
|
"build": "bun run build:css && bun src/build.ts",
|
|
29
|
-
"preview": "bunx serve
|
|
29
|
+
"preview": "bunx serve public",
|
|
30
30
|
"start": "bun src/server.ts",
|
|
31
31
|
"check": "bun run scripts/check.ts",
|
|
32
32
|
"test": "bun test",
|
package/src/build.ts
CHANGED
|
@@ -40,26 +40,26 @@ console.log(
|
|
|
40
40
|
`Found ${navigation.length} groups with ${navigation.reduce((acc, g) => acc + g.items.length, 0)} total pages`
|
|
41
41
|
);
|
|
42
42
|
|
|
43
|
-
// Ensure
|
|
44
|
-
await Bun.write(`${project.
|
|
43
|
+
// Ensure output directory exists
|
|
44
|
+
await Bun.write(`${project.outputDir}/.gitkeep`, "");
|
|
45
45
|
|
|
46
|
-
const
|
|
47
|
-
// Do not overwrite the minified `
|
|
46
|
+
const shouldCopyAssetPath = (relativePath: string): boolean =>
|
|
47
|
+
// Do not overwrite the minified `public/styles.css` produced by `build:css`.
|
|
48
48
|
relativePath !== "styles.css";
|
|
49
49
|
|
|
50
|
-
const
|
|
51
|
-
const file = Bun.file(`${project.
|
|
50
|
+
const copyAssetFileToOutput = async (relativePath: string): Promise<void> => {
|
|
51
|
+
const file = Bun.file(`${project.assetsDir}/${relativePath}`);
|
|
52
52
|
if (!(await file.exists())) {
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
|
-
await Bun.write(`${project.
|
|
55
|
+
await Bun.write(`${project.outputDir}/${relativePath}`, file);
|
|
56
56
|
};
|
|
57
57
|
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
for await (const relativePath of
|
|
61
|
-
if (
|
|
62
|
-
await
|
|
58
|
+
const copyAssetsToOutput = async (): Promise<void> => {
|
|
59
|
+
const assetFiles = new Bun.Glob("**/*").scan(project.assetsDir);
|
|
60
|
+
for await (const relativePath of assetFiles) {
|
|
61
|
+
if (shouldCopyAssetPath(relativePath)) {
|
|
62
|
+
await copyAssetFileToOutput(relativePath);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
};
|
|
@@ -70,8 +70,8 @@ const writeMarkdownOutputs = async (
|
|
|
70
70
|
): Promise<void> => {
|
|
71
71
|
const flatMarkdownPath =
|
|
72
72
|
slug === "index"
|
|
73
|
-
? `${project.
|
|
74
|
-
: `${project.
|
|
73
|
+
? `${project.outputDir}/index.md`
|
|
74
|
+
: `${project.outputDir}/${slug}.md`;
|
|
75
75
|
|
|
76
76
|
const expanded = await expandMarkdownForAgent(markdown, {
|
|
77
77
|
currentPath: slug === "index" ? "/" : `/${slug}/`,
|
|
@@ -84,14 +84,14 @@ const writeMarkdownOutputs = async (
|
|
|
84
84
|
console.log(` markdown -> ${flatMarkdownPath}`);
|
|
85
85
|
};
|
|
86
86
|
|
|
87
|
-
await
|
|
87
|
+
await copyAssetsToOutput();
|
|
88
88
|
|
|
89
89
|
const resolveCssSource = async (): Promise<string | null> => {
|
|
90
|
-
if (await Bun.file(`${project.
|
|
91
|
-
return `${project.
|
|
90
|
+
if (await Bun.file(`${project.outputDir}/styles.css`).exists()) {
|
|
91
|
+
return `${project.outputDir}/styles.css`;
|
|
92
92
|
}
|
|
93
|
-
if (await Bun.file(`${project.
|
|
94
|
-
return `${project.
|
|
93
|
+
if (await Bun.file(`${project.assetsDir}/styles.css`).exists()) {
|
|
94
|
+
return `${project.assetsDir}/styles.css`;
|
|
95
95
|
}
|
|
96
96
|
return null;
|
|
97
97
|
};
|
|
@@ -138,10 +138,10 @@ const renderStaticSearchPage = async (): Promise<string> => {
|
|
|
138
138
|
};
|
|
139
139
|
|
|
140
140
|
await Bun.write(
|
|
141
|
-
`${project.
|
|
141
|
+
`${project.outputDir}/search/index.html`,
|
|
142
142
|
await renderStaticSearchPage()
|
|
143
143
|
);
|
|
144
|
-
console.log(` generated ${project.
|
|
144
|
+
console.log(` generated ${project.outputDir}/search/index.html`);
|
|
145
145
|
|
|
146
146
|
for (const file of contentFiles) {
|
|
147
147
|
const filePath = `${project.contentDir}/${file}`;
|
|
@@ -160,11 +160,11 @@ for (const file of contentFiles) {
|
|
|
160
160
|
|
|
161
161
|
let outPath: string;
|
|
162
162
|
if (slug === "index") {
|
|
163
|
-
outPath = `${project.
|
|
163
|
+
outPath = `${project.outputDir}/index.html`;
|
|
164
164
|
} else if (slug === "404") {
|
|
165
|
-
outPath = `${project.
|
|
165
|
+
outPath = `${project.outputDir}/404.html`;
|
|
166
166
|
} else {
|
|
167
|
-
outPath = `${project.
|
|
167
|
+
outPath = `${project.outputDir}/${slug}/index.html`;
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
await Bun.write(outPath, html);
|
|
@@ -172,24 +172,26 @@ for (const file of contentFiles) {
|
|
|
172
172
|
await writeMarkdownOutputs(slug, markdown);
|
|
173
173
|
|
|
174
174
|
if (slug === "404") {
|
|
175
|
-
const nested404Path = `${project.
|
|
175
|
+
const nested404Path = `${project.outputDir}/404/index.html`;
|
|
176
176
|
await Bun.write(nested404Path, html);
|
|
177
177
|
console.log(` ${filePath} -> ${nested404Path}`);
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
const llmsTxt = await generateLlmsTxt();
|
|
182
|
-
await Bun.write(`${project.
|
|
183
|
-
console.log(` generated ${project.
|
|
182
|
+
await Bun.write(`${project.outputDir}/llms.txt`, llmsTxt);
|
|
183
|
+
console.log(` generated ${project.outputDir}/llms.txt`);
|
|
184
184
|
|
|
185
185
|
const searchIndex = await generateSearchIndexFromContent({ siteConfig });
|
|
186
186
|
await Bun.write(
|
|
187
|
-
`${project.
|
|
187
|
+
`${project.outputDir}/search-index.json`,
|
|
188
188
|
JSON.stringify(searchIndex)
|
|
189
189
|
);
|
|
190
|
-
const searchIndexBytes = Bun.file(
|
|
190
|
+
const searchIndexBytes = Bun.file(
|
|
191
|
+
`${project.outputDir}/search-index.json`
|
|
192
|
+
).size;
|
|
191
193
|
console.log(
|
|
192
|
-
` generated
|
|
194
|
+
` generated public/search-index.json (${(searchIndexBytes / (1024 * 1024)).toFixed(2)} MB)`
|
|
193
195
|
);
|
|
194
196
|
if (searchIndexBytes > MAX_INDEX_BYTES) {
|
|
195
197
|
console.warn(
|
|
@@ -200,16 +202,16 @@ if (searchIndexBytes > MAX_INDEX_BYTES) {
|
|
|
200
202
|
if (siteConfig.baseUrl) {
|
|
201
203
|
const sitemapPages = await collectSitemapPagesFromContent();
|
|
202
204
|
await Bun.write(
|
|
203
|
-
`${project.
|
|
205
|
+
`${project.outputDir}/sitemap.xml`,
|
|
204
206
|
generateSitemapXml(sitemapPages, siteConfig.baseUrl)
|
|
205
207
|
);
|
|
206
|
-
console.log(` generated ${project.
|
|
208
|
+
console.log(` generated ${project.outputDir}/sitemap.xml`);
|
|
207
209
|
|
|
208
210
|
await Bun.write(
|
|
209
|
-
`${project.
|
|
211
|
+
`${project.outputDir}/robots.txt`,
|
|
210
212
|
generateRobotsTxt(siteConfig.baseUrl)
|
|
211
213
|
);
|
|
212
|
-
console.log(` generated ${project.
|
|
214
|
+
console.log(` generated ${project.outputDir}/robots.txt`);
|
|
213
215
|
} else {
|
|
214
216
|
console.log(
|
|
215
217
|
"Warning: site/site.jsonc missing baseUrl; skipping sitemap.xml and robots.txt."
|
|
@@ -9,7 +9,7 @@ const TEMPLATE_UI_DIR = joinPath(
|
|
|
9
9
|
"templates",
|
|
10
10
|
"default",
|
|
11
11
|
"site",
|
|
12
|
-
"
|
|
12
|
+
"src",
|
|
13
13
|
"ui"
|
|
14
14
|
);
|
|
15
15
|
const TEMPLATE_RUNTIME_DIR = joinPath(
|
|
@@ -20,12 +20,12 @@ const TEMPLATE_RUNTIME_DIR = joinPath(
|
|
|
20
20
|
"templates",
|
|
21
21
|
"default",
|
|
22
22
|
"site",
|
|
23
|
-
"
|
|
23
|
+
"src",
|
|
24
24
|
"runtime"
|
|
25
25
|
);
|
|
26
26
|
|
|
27
|
-
const SITE_UI_DIR = joinPath("site", "
|
|
28
|
-
const SITE_RUNTIME_DIR = joinPath("site", "
|
|
27
|
+
const SITE_UI_DIR = joinPath("site", "src", "ui");
|
|
28
|
+
const SITE_RUNTIME_DIR = joinPath("site", "src", "runtime");
|
|
29
29
|
const SITE_CONFIG_PATH = joinPath("site", "site.jsonc");
|
|
30
30
|
|
|
31
31
|
const CLIENT_PARTS = [
|
|
@@ -14,17 +14,17 @@ const warnIfVercelMisconfigured = async (): Promise<void> => {
|
|
|
14
14
|
if (!raw) {
|
|
15
15
|
// eslint-disable-next-line no-console
|
|
16
16
|
console.warn(
|
|
17
|
-
"Warning: vercel.json not found. Vercel static deploy expects
|
|
17
|
+
"Warning: vercel.json not found. Vercel static deploy expects public/ output."
|
|
18
18
|
);
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
const record = raw as Record<string, unknown>;
|
|
23
23
|
const out = record.outputDirectory;
|
|
24
|
-
if (out !== "
|
|
24
|
+
if (out !== "public") {
|
|
25
25
|
// eslint-disable-next-line no-console
|
|
26
26
|
console.warn(
|
|
27
|
-
`Warning: vercel.json outputDirectory is not "
|
|
27
|
+
`Warning: vercel.json outputDirectory is not "public" (got ${JSON.stringify(out)}).`
|
|
28
28
|
);
|
|
29
29
|
}
|
|
30
30
|
};
|
|
@@ -76,7 +76,7 @@ const printDeployInstructions = (): void => {
|
|
|
76
76
|
// eslint-disable-next-line no-console
|
|
77
77
|
console.log(" 2. Import the repo in Vercel");
|
|
78
78
|
// eslint-disable-next-line no-console
|
|
79
|
-
console.log(" 3. Vercel will run `bun run build` and serve `
|
|
79
|
+
console.log(" 3. Vercel will run `bun run build` and serve `public/`");
|
|
80
80
|
// eslint-disable-next-line no-console
|
|
81
81
|
console.log("");
|
|
82
82
|
};
|
package/src/cli/commands/dev.ts
CHANGED
|
@@ -20,7 +20,7 @@ const findTailwindInput = async (): Promise<string> => {
|
|
|
20
20
|
);
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
const resolveTailwindOutput = (): string => "
|
|
23
|
+
const resolveTailwindOutput = (): string => "public/styles.css";
|
|
24
24
|
|
|
25
25
|
const idcmdServerEntry = (): string =>
|
|
26
26
|
// `src/server.ts` lives two levels up from `src/cli/commands/*`.
|
|
@@ -7,7 +7,7 @@ const stripLeadingSlash = (pathname: string): string =>
|
|
|
7
7
|
pathname.startsWith("/") ? pathname.slice(1) : pathname;
|
|
8
8
|
|
|
9
9
|
const tryServeFile = async (relativePath: string): Promise<Response | null> => {
|
|
10
|
-
const file = Bun.file(`
|
|
10
|
+
const file = Bun.file(`public/${stripLeadingSlash(relativePath)}`);
|
|
11
11
|
if (!(await file.exists())) {
|
|
12
12
|
return null;
|
|
13
13
|
}
|
|
@@ -37,9 +37,9 @@ const serveHtml = async (pathname: string): Promise<Response> => {
|
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
export const previewCommand = async (port: number): Promise<number> => {
|
|
40
|
-
const exists = await Bun.file("
|
|
40
|
+
const exists = await Bun.file("public/index.html").exists();
|
|
41
41
|
if (!exists) {
|
|
42
|
-
throw new Error("
|
|
42
|
+
throw new Error("public/ not found. Run `idcmd build` first.");
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
const server = Bun.serve({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { joinPath } from "./path";
|
|
2
2
|
|
|
3
|
-
const RUNTIME_SOURCE_DIR = joinPath("site", "
|
|
4
|
-
const RUNTIME_OUTPUT_DIR = joinPath("
|
|
3
|
+
const RUNTIME_SOURCE_DIR = joinPath("site", "src", "runtime");
|
|
4
|
+
const RUNTIME_OUTPUT_DIR = joinPath("public", "_idcmd");
|
|
5
5
|
|
|
6
6
|
const RUNTIME_ENTRY_FILES = [
|
|
7
7
|
"live-reload.ts",
|
package/src/project/paths.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
const DEFAULT_SITE_DIR = "site";
|
|
2
|
-
const
|
|
2
|
+
const DEFAULT_OUTPUT_DIR = "public";
|
|
3
3
|
const ASSET_PREFIX = "/_idcmd" as const;
|
|
4
4
|
const CONTENT_DIR = "content";
|
|
5
|
-
const
|
|
5
|
+
const ASSETS_DIR = "assets";
|
|
6
6
|
const ICONS_DIR = "assets/icons";
|
|
7
|
-
const ROUTES_DIR = "
|
|
7
|
+
const ROUTES_DIR = "src/routes";
|
|
8
8
|
const SITE_CONFIG_FILE = "site.jsonc";
|
|
9
9
|
|
|
10
10
|
export interface ProjectPaths {
|
|
11
11
|
assetPrefix: typeof ASSET_PREFIX;
|
|
12
12
|
contentDir: string;
|
|
13
|
-
|
|
13
|
+
outputDir: string;
|
|
14
14
|
iconsDir: string;
|
|
15
|
-
|
|
15
|
+
assetsDir: string;
|
|
16
16
|
routesDir: string;
|
|
17
17
|
siteConfigPath: string;
|
|
18
18
|
siteDir: string | null;
|
|
@@ -20,7 +20,7 @@ export interface ProjectPaths {
|
|
|
20
20
|
|
|
21
21
|
export interface ResolveProjectPathsOptions {
|
|
22
22
|
cwd?: string;
|
|
23
|
-
|
|
23
|
+
outputDir?: string;
|
|
24
24
|
siteDir?: string;
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -44,16 +44,16 @@ const joinPath = (...parts: string[]): string => {
|
|
|
44
44
|
|
|
45
45
|
const buildPaths = (args: {
|
|
46
46
|
cwd: string;
|
|
47
|
-
|
|
47
|
+
outputDirName: string;
|
|
48
48
|
siteDirName: string;
|
|
49
49
|
}): ProjectPaths => {
|
|
50
50
|
const siteRoot = joinPath(args.cwd, args.siteDirName);
|
|
51
51
|
return {
|
|
52
52
|
assetPrefix: ASSET_PREFIX,
|
|
53
|
+
assetsDir: joinPath(siteRoot, ASSETS_DIR),
|
|
53
54
|
contentDir: joinPath(siteRoot, CONTENT_DIR),
|
|
54
|
-
distDir: joinPath(args.cwd, args.distDirName),
|
|
55
55
|
iconsDir: joinPath(siteRoot, ICONS_DIR),
|
|
56
|
-
|
|
56
|
+
outputDir: joinPath(args.cwd, args.outputDirName),
|
|
57
57
|
routesDir: joinPath(siteRoot, ROUTES_DIR),
|
|
58
58
|
siteConfigPath: joinPath(siteRoot, SITE_CONFIG_FILE),
|
|
59
59
|
siteDir: siteRoot,
|
|
@@ -64,9 +64,9 @@ export const resolveProjectPaths = (
|
|
|
64
64
|
options: ResolveProjectPathsOptions = {}
|
|
65
65
|
): Promise<ProjectPaths> => {
|
|
66
66
|
const cwd = trimTrailingSlash(options.cwd ?? process.cwd());
|
|
67
|
-
const
|
|
67
|
+
const outputDirName = options.outputDir ?? DEFAULT_OUTPUT_DIR;
|
|
68
68
|
const siteDirName = options.siteDir ?? DEFAULT_SITE_DIR;
|
|
69
|
-
return Promise.resolve(buildPaths({ cwd,
|
|
69
|
+
return Promise.resolve(buildPaths({ cwd, outputDirName, siteDirName }));
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
let cached: Promise<ProjectPaths> | null = null;
|
|
@@ -2,7 +2,7 @@ import type { RenderLayout } from "./layout";
|
|
|
2
2
|
|
|
3
3
|
import { renderLayout as defaultRenderLayout } from "./layout";
|
|
4
4
|
|
|
5
|
-
const USER_LAYOUT_PATH = "site/
|
|
5
|
+
const USER_LAYOUT_PATH = "site/src/ui/layout.tsx";
|
|
6
6
|
|
|
7
7
|
const loadUserLayout = async (
|
|
8
8
|
filePath: string
|
|
@@ -2,7 +2,7 @@ import type { RightRailComponent } from "./right-rail";
|
|
|
2
2
|
|
|
3
3
|
import { RightRail as defaultRightRail } from "./right-rail";
|
|
4
4
|
|
|
5
|
-
const USER_RIGHT_RAIL_PATH = "site/
|
|
5
|
+
const USER_RIGHT_RAIL_PATH = "site/src/ui/right-rail.tsx";
|
|
6
6
|
|
|
7
7
|
const loadUserRightRail = async (
|
|
8
8
|
filePath: string
|
package/src/search/index.ts
CHANGED
|
@@ -26,7 +26,7 @@ export interface SearchIndexV1 {
|
|
|
26
26
|
documents: SearchIndexDocumentV1[];
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
const SEARCH_INDEX_PATH = "
|
|
29
|
+
const SEARCH_INDEX_PATH = "public/search-index.json";
|
|
30
30
|
const MIN_QUERY_TOKEN_LENGTH = 2;
|
|
31
31
|
const DEFAULT_BODY_MAX_CHARS = 2000;
|
|
32
32
|
|
|
@@ -2,7 +2,7 @@ import type { RenderSearchPageContent } from "./page";
|
|
|
2
2
|
|
|
3
3
|
import { renderSearchPageContent as defaultRenderSearchPageContent } from "./page";
|
|
4
4
|
|
|
5
|
-
const USER_SEARCH_PAGE_PATH = "site/
|
|
5
|
+
const USER_SEARCH_PAGE_PATH = "site/src/ui/search-page.tsx";
|
|
6
6
|
|
|
7
7
|
const loadUserSearchPage = async (
|
|
8
8
|
filePath: string
|
package/src/seo/server.ts
CHANGED
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
} from "./files";
|
|
8
8
|
|
|
9
9
|
export interface SeoHandlerEnv {
|
|
10
|
-
|
|
10
|
+
outputDir: string;
|
|
11
11
|
isDev: boolean;
|
|
12
12
|
staticCacheHeaders: HeadersInit;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const tryServeOutputFile = async (
|
|
16
16
|
filePath: string,
|
|
17
17
|
contentType: string,
|
|
18
18
|
env: SeoHandlerEnv
|
|
@@ -42,8 +42,8 @@ export const handleRobotsTxt = async (
|
|
|
42
42
|
return undefined;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
const served = await
|
|
46
|
-
`${env.
|
|
45
|
+
const served = await tryServeOutputFile(
|
|
46
|
+
`${env.outputDir}/robots.txt`,
|
|
47
47
|
"text/plain; charset=utf-8",
|
|
48
48
|
env
|
|
49
49
|
);
|
|
@@ -75,8 +75,8 @@ export const handleSitemapXml = async (
|
|
|
75
75
|
return undefined;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
const served = await
|
|
79
|
-
`${env.
|
|
78
|
+
const served = await tryServeOutputFile(
|
|
79
|
+
`${env.outputDir}/sitemap.xml`,
|
|
80
80
|
"application/xml; charset=utf-8",
|
|
81
81
|
env
|
|
82
82
|
);
|
package/src/server/static.ts
CHANGED
|
@@ -13,9 +13,9 @@ const mimeTypes: Record<string, string> = {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
export interface ServeStaticEnv {
|
|
16
|
-
|
|
16
|
+
outputDir: string;
|
|
17
17
|
isDev: boolean;
|
|
18
|
-
|
|
18
|
+
assetsDir: string;
|
|
19
19
|
staticCacheHeaders: HeadersInit;
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -46,7 +46,7 @@ export const serveStaticFile = async (
|
|
|
46
46
|
pathname: string,
|
|
47
47
|
env: ServeStaticEnv
|
|
48
48
|
): Promise<Response | null> => {
|
|
49
|
-
const roots = [env.
|
|
49
|
+
const roots = [env.outputDir, env.assetsDir];
|
|
50
50
|
|
|
51
51
|
for (const root of roots) {
|
|
52
52
|
const served = await tryServeFileFromRoot(root, pathname, env);
|
package/src/server.ts
CHANGED
|
@@ -24,8 +24,8 @@ import {
|
|
|
24
24
|
type ServerInstance = Server<undefined>;
|
|
25
25
|
|
|
26
26
|
const project = await getProjectPaths();
|
|
27
|
-
const
|
|
28
|
-
const
|
|
27
|
+
const ASSETS_DIR = project.assetsDir;
|
|
28
|
+
const OUTPUT_DIR = project.outputDir;
|
|
29
29
|
const isDev = process.env.NODE_ENV !== "production";
|
|
30
30
|
const LIVE_RELOAD_POLL_MS = 250;
|
|
31
31
|
const MIN_SEARCH_QUERY_LENGTH = 2;
|
|
@@ -185,7 +185,7 @@ const handleRequest = async (
|
|
|
185
185
|
return undefined;
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
const seoEnv = {
|
|
188
|
+
const seoEnv = { isDev, outputDir: OUTPUT_DIR, staticCacheHeaders };
|
|
189
189
|
const searchPageEnv = {
|
|
190
190
|
cacheHeaders,
|
|
191
191
|
isDev,
|
|
@@ -193,9 +193,9 @@ const handleRequest = async (
|
|
|
193
193
|
minQueryLength: MIN_SEARCH_QUERY_LENGTH,
|
|
194
194
|
};
|
|
195
195
|
const staticEnv = {
|
|
196
|
-
|
|
196
|
+
assetsDir: ASSETS_DIR,
|
|
197
197
|
isDev,
|
|
198
|
-
|
|
198
|
+
outputDir: OUTPUT_DIR,
|
|
199
199
|
staticCacheHeaders,
|
|
200
200
|
};
|
|
201
201
|
const userRoutesEnv = { isDev, routesDir: project.routesDir };
|
|
@@ -21,15 +21,15 @@ bun run smoke
|
|
|
21
21
|
## Layout
|
|
22
22
|
|
|
23
23
|
- Content: `site/content/` markdown pages (`index.md` -> `/`, `about.md` -> `/about/`)
|
|
24
|
-
- Code: `site/
|
|
25
|
-
- Code: `site/
|
|
26
|
-
- Code: `site/
|
|
24
|
+
- Code: `site/src/ui/` (`layout.tsx`, `right-rail.tsx`, `search-page.tsx`)
|
|
25
|
+
- Code: `site/src/runtime/` browser runtime TS (`*_idcmd` scripts compile from here)
|
|
26
|
+
- Code: `site/src/routes/` file-based server routes (dev/server-host only)
|
|
27
27
|
- Assets: `site/assets/` static files you own (icons, images, favicon, etc.)
|
|
28
28
|
- Styles source: `site/styles/tailwind.css`
|
|
29
29
|
- Config: `site/site.jsonc`
|
|
30
|
-
- Generated output: `
|
|
30
|
+
- Generated output: `public/` (`public/styles.css`, `public/_idcmd/*.js`, built pages)
|
|
31
31
|
|
|
32
|
-
The mental model is simple: edit `site/content` and `site/
|
|
32
|
+
The mental model is simple: edit `site/content` and `site/src`, treat `public/` as generated output.
|
|
33
33
|
|
|
34
34
|
## Sync Local Client Files
|
|
35
35
|
|
|
@@ -40,8 +40,8 @@ idcmd client update layout --yes
|
|
|
40
40
|
idcmd client update runtime --yes
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
These commands copy the latest baseline implementations from `idcmd` into `site/
|
|
44
|
-
Runtime files in `site/
|
|
43
|
+
These commands copy the latest baseline implementations from `idcmd` into `site/src/ui/` and `site/src/runtime/`.
|
|
44
|
+
Runtime files in `site/src/runtime/` are compiled automatically by `idcmd dev` and `idcmd build`.
|
|
45
45
|
|
|
46
46
|
## Deploy (Vercel static)
|
|
47
47
|
|
|
@@ -49,4 +49,4 @@ Runtime files in `site/code/runtime/` are compiled automatically by `idcmd dev`
|
|
|
49
49
|
bun run build
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
This produces a static `
|
|
52
|
+
This produces a static `public/` directory for Vercel.
|
|
@@ -19,8 +19,8 @@ const checks: InternalCheck[] = [
|
|
|
19
19
|
run: () => fileExists("site/styles/tailwind.css"),
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
|
-
description: "site
|
|
23
|
-
run: () => fileExists("site/
|
|
22
|
+
description: "site source UI entry must exist (site/src/ui/layout.tsx)",
|
|
23
|
+
run: () => fileExists("site/src/ui/layout.tsx"),
|
|
24
24
|
},
|
|
25
25
|
];
|
|
26
26
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// Optional: this file is here as the obvious place to put server-side code.
|
|
2
|
-
// V1 runs the built-in idcmd server; add custom endpoints via `site/
|
|
2
|
+
// V1 runs the built-in idcmd server; add custom endpoints via `site/src/routes/**`.
|
|
3
3
|
|
|
4
4
|
export const serverPlaceholder = true;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<svg version="1.1" id="Layer_1" xmlns:x="ns_extend;" xmlns:i="ns_ai;" xmlns:graph="ns_graphs;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 92.2 65" style="enable-background:new 0 0 92.2 65;" xml:space="preserve">
|
|
2
|
-
<style type="text/css">
|
|
3
|
-
.st0{fill:#181818;}
|
|
4
|
-
</style>
|
|
5
|
-
<metadata>
|
|
6
|
-
<sfw xmlns="ns_sfw;">
|
|
7
|
-
<slices>
|
|
8
|
-
</slices>
|
|
9
|
-
<sliceSourceBounds bottomLeftOrigin="true" height="65" width="92.2" x="-43.7" y="-98">
|
|
10
|
-
</sliceSourceBounds>
|
|
11
|
-
</sfw>
|
|
12
|
-
</metadata>
|
|
13
|
-
<path class="st0" d="M66.5,0H52.4l25.7,65h14.1L66.5,0z M25.7,0L0,65h14.4l5.3-13.6h26.9L51.8,65h14.4L40.5,0C40.5,0,25.7,0,25.7,0z
|
|
14
|
-
M24.3,39.3l8.8-22.8l8.8,22.8H24.3z">
|
|
15
|
-
</path>
|
|
16
|
-
</svg>
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<svg version="1.1" id="Layer_1" xmlns:x="ns_extend;" xmlns:i="ns_ai;" xmlns:graph="ns_graphs;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 92.2 65" style="enable-background:new 0 0 92.2 65;" xml:space="preserve">
|
|
2
|
-
<style type="text/css">
|
|
3
|
-
.st0{fill:#FFFFFF;}
|
|
4
|
-
</style>
|
|
5
|
-
<metadata>
|
|
6
|
-
<sfw xmlns="ns_sfw;">
|
|
7
|
-
<slices>
|
|
8
|
-
</slices>
|
|
9
|
-
<sliceSourceBounds bottomLeftOrigin="true" height="65" width="92.2" x="-43.7" y="-98">
|
|
10
|
-
</sliceSourceBounds>
|
|
11
|
-
</sfw>
|
|
12
|
-
</metadata>
|
|
13
|
-
<path class="st0" d="M66.5,0H52.4l25.7,65h14.1L66.5,0z M25.7,0L0,65h14.4l5.3-13.6h26.9L51.8,65h14.4L40.5,0C40.5,0,25.7,0,25.7,0z
|
|
14
|
-
M24.3,39.3l8.8-22.8l8.8,22.8H24.3z">
|
|
15
|
-
</path>
|
|
16
|
-
</svg>
|
package/public/favicon.svg
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" role="img" aria-label="IDC favicon">
|
|
2
|
-
<rect width="64" height="64" rx="12" fill="#0B0B0B" />
|
|
3
|
-
<text
|
|
4
|
-
x="32"
|
|
5
|
-
y="40"
|
|
6
|
-
font-family="JetBrains Mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace"
|
|
7
|
-
font-size="22"
|
|
8
|
-
text-anchor="middle"
|
|
9
|
-
fill="#F9FAFB"
|
|
10
|
-
>
|
|
11
|
-
idc
|
|
12
|
-
</text>
|
|
13
|
-
</svg>
|
package/public/openai-black.svg
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<svg width="721" height="721" viewBox="0 0 721 721" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<g clip-path="url(#clip0_1637_2934)">
|
|
3
|
-
<g clip-path="url(#clip1_1637_2934)">
|
|
4
|
-
<path d="M304.246 294.611V249.028C304.246 245.189 305.687 242.309 309.044 240.392L400.692 187.612C413.167 180.415 428.042 177.058 443.394 177.058C500.971 177.058 537.44 221.682 537.44 269.182C537.44 272.54 537.44 276.379 536.959 280.218L441.954 224.558C436.197 221.201 430.437 221.201 424.68 224.558L304.246 294.611ZM518.245 472.145V363.224C518.245 356.505 515.364 351.707 509.608 348.349L389.174 278.296L428.519 255.743C431.877 253.826 434.757 253.826 438.115 255.743L529.762 308.523C556.154 323.879 573.905 356.505 573.905 388.171C573.905 424.636 552.315 458.225 518.245 472.141V472.145ZM275.937 376.182L236.592 353.152C233.235 351.235 231.794 348.354 231.794 344.515V238.956C231.794 187.617 271.139 148.749 324.4 148.749C344.555 148.749 363.264 155.468 379.102 167.463L284.578 222.164C278.822 225.521 275.942 230.319 275.942 237.039V376.186L275.937 376.182ZM360.626 425.122L304.246 393.455V326.283L360.626 294.616L417.002 326.283V393.455L360.626 425.122ZM396.852 570.989C376.698 570.989 357.989 564.27 342.151 552.276L436.674 497.574C442.431 494.217 445.311 489.419 445.311 482.699V343.552L485.138 366.582C488.495 368.499 489.936 371.379 489.936 375.219V480.778C489.936 532.117 450.109 570.985 396.852 570.985V570.989ZM283.134 463.99L191.486 411.211C165.094 395.854 147.343 363.229 147.343 331.562C147.343 294.616 169.415 261.509 203.48 247.593V356.991C203.48 363.71 206.361 368.508 212.117 371.866L332.074 441.437L292.729 463.99C289.372 465.907 286.491 465.907 283.134 463.99ZM277.859 542.68C223.639 542.68 183.813 501.895 183.813 451.514C183.813 447.675 184.294 443.836 184.771 439.997L279.295 494.698C285.051 498.056 290.812 498.056 296.568 494.698L417.002 425.127V470.71C417.002 474.549 415.562 477.429 412.204 479.346L320.557 532.126C308.081 539.323 293.206 542.68 277.854 542.68H277.859ZM396.852 599.776C454.911 599.776 503.37 558.513 514.41 503.812C568.149 489.896 602.696 439.515 602.696 388.176C602.696 354.587 588.303 321.962 562.392 298.45C564.791 288.373 566.231 278.296 566.231 268.224C566.231 199.611 510.571 148.267 446.274 148.267C433.322 148.267 420.846 150.184 408.37 154.505C386.775 133.392 357.026 119.958 324.4 119.958C266.342 119.958 217.883 161.22 206.843 215.921C153.104 229.837 118.557 280.218 118.557 331.557C118.557 365.146 132.95 397.771 158.861 421.283C156.462 431.36 155.022 441.437 155.022 451.51C155.022 520.123 210.682 571.466 274.978 571.466C287.931 571.466 300.407 569.549 312.883 565.228C334.473 586.341 364.222 599.776 396.852 599.776Z" fill="black"/>
|
|
5
|
-
</g>
|
|
6
|
-
</g>
|
|
7
|
-
<defs>
|
|
8
|
-
<clipPath id="clip0_1637_2934">
|
|
9
|
-
<rect width="720" height="720" fill="white" transform="translate(0.606934 0.0999756)"/>
|
|
10
|
-
</clipPath>
|
|
11
|
-
<clipPath id="clip1_1637_2934">
|
|
12
|
-
<rect width="484.139" height="479.818" fill="white" transform="translate(118.557 119.958)"/>
|
|
13
|
-
</clipPath>
|
|
14
|
-
</defs>
|
|
15
|
-
</svg>
|
package/public/openai-white.svg
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<svg width="721" height="721" viewBox="0 0 721 721" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<g clip-path="url(#clip0_1637_2935)">
|
|
3
|
-
<g clip-path="url(#clip1_1637_2935)">
|
|
4
|
-
<path d="M304.246 295.411V249.828C304.246 245.989 305.687 243.109 309.044 241.191L400.692 188.412C413.167 181.215 428.042 177.858 443.394 177.858C500.971 177.858 537.44 222.482 537.44 269.982C537.44 273.34 537.44 277.179 536.959 281.018L441.954 225.358C436.197 222 430.437 222 424.68 225.358L304.246 295.411ZM518.245 472.945V364.024C518.245 357.304 515.364 352.507 509.608 349.149L389.174 279.096L428.519 256.543C431.877 254.626 434.757 254.626 438.115 256.543L529.762 309.323C556.154 324.679 573.905 357.304 573.905 388.971C573.905 425.436 552.315 459.024 518.245 472.941V472.945ZM275.937 376.982L236.592 353.952C233.235 352.034 231.794 349.154 231.794 345.315V239.756C231.794 188.416 271.139 149.548 324.4 149.548C344.555 149.548 363.264 156.268 379.102 168.262L284.578 222.964C278.822 226.321 275.942 231.119 275.942 237.838V376.986L275.937 376.982ZM360.626 425.922L304.246 394.255V327.083L360.626 295.416L417.002 327.083V394.255L360.626 425.922ZM396.852 571.789C376.698 571.789 357.989 565.07 342.151 553.075L436.674 498.374C442.431 495.017 445.311 490.219 445.311 483.499V344.352L485.138 367.382C488.495 369.299 489.936 372.179 489.936 376.018V481.577C489.936 532.917 450.109 571.785 396.852 571.785V571.789ZM283.134 464.79L191.486 412.01C165.094 396.654 147.343 364.029 147.343 332.362C147.343 295.416 169.415 262.309 203.48 248.393V357.791C203.48 364.51 206.361 369.308 212.117 372.665L332.074 442.237L292.729 464.79C289.372 466.707 286.491 466.707 283.134 464.79ZM277.859 543.48C223.639 543.48 183.813 502.695 183.813 452.314C183.813 448.475 184.294 444.636 184.771 440.797L279.295 495.498C285.051 498.856 290.812 498.856 296.568 495.498L417.002 425.927V471.509C417.002 475.349 415.562 478.229 412.204 480.146L320.557 532.926C308.081 540.122 293.206 543.48 277.854 543.48H277.859ZM396.852 600.576C454.911 600.576 503.37 559.313 514.41 504.612C568.149 490.696 602.696 440.315 602.696 388.976C602.696 355.387 588.303 322.762 562.392 299.25C564.791 289.173 566.231 279.096 566.231 269.024C566.231 200.411 510.571 149.067 446.274 149.067C433.322 149.067 420.846 150.984 408.37 155.305C386.775 134.192 357.026 120.758 324.4 120.758C266.342 120.758 217.883 162.02 206.843 216.721C153.104 230.637 118.557 281.018 118.557 332.357C118.557 365.946 132.95 398.571 158.861 422.083C156.462 432.16 155.022 442.237 155.022 452.309C155.022 520.922 210.682 572.266 274.978 572.266C287.931 572.266 300.407 570.349 312.883 566.028C334.473 587.141 364.222 600.576 396.852 600.576Z" fill="white"/>
|
|
5
|
-
</g>
|
|
6
|
-
</g>
|
|
7
|
-
<defs>
|
|
8
|
-
<clipPath id="clip0_1637_2935">
|
|
9
|
-
<rect width="720" height="720" fill="white" transform="translate(0.606934 0.899902)"/>
|
|
10
|
-
</clipPath>
|
|
11
|
-
<clipPath id="clip1_1637_2935">
|
|
12
|
-
<rect width="484.139" height="479.818" fill="white" transform="translate(118.557 120.758)"/>
|
|
13
|
-
</clipPath>
|
|
14
|
-
</defs>
|
|
15
|
-
</svg>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|