@knitli/astro-docs-template 0.1.1 → 0.2.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/package.json +45 -37
- package/scaffolding/package.json +2 -1
- package/src/cli.ts +20 -12
- package/src/index.ts +7 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knitli/astro-docs-template",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Opinionated Astro + Starlight docs site template with Knitli branding",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"knitli",
|
|
@@ -32,47 +32,49 @@
|
|
|
32
32
|
"CHANGELOG.md"
|
|
33
33
|
],
|
|
34
34
|
"scripts": {
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
35
|
+
"prebuild": "bun run clean",
|
|
36
|
+
"build": "bun run build.ts",
|
|
37
|
+
"postbuild": "tsc --noCheck --emitDeclarationOnly --declaration --declarationDir dist",
|
|
38
|
+
"clean": "rm -rf dist",
|
|
39
|
+
"deploy": "bun publish --tag latest",
|
|
40
|
+
"prepack": "bun run build"
|
|
39
41
|
},
|
|
40
42
|
"dependencies": {
|
|
41
|
-
"@astrojs/cloudflare": "
|
|
42
|
-
"@astrojs/markdoc": "
|
|
43
|
-
"@astrojs/mdx": "
|
|
44
|
-
"@astrojs/sitemap": "
|
|
45
|
-
"@astrojs/starlight": "
|
|
46
|
-
"@knitli/docs-components": "
|
|
47
|
-
"@nuasite/llm-enhancements": "
|
|
48
|
-
"astro": "
|
|
49
|
-
"astro-cloudflare-pages-headers": "
|
|
50
|
-
"astro-d2": "
|
|
51
|
-
"astro-favicons": "
|
|
43
|
+
"@astrojs/cloudflare": "^13.1.1",
|
|
44
|
+
"@astrojs/markdoc": "^1.0.0",
|
|
45
|
+
"@astrojs/mdx": "^5.0.0",
|
|
46
|
+
"@astrojs/sitemap": "^3.6.0",
|
|
47
|
+
"@astrojs/starlight": "^0.38.1",
|
|
48
|
+
"@knitli/docs-components": "1.3.6",
|
|
49
|
+
"@nuasite/llm-enhancements": "^0.18.0",
|
|
50
|
+
"astro": "^6.0.4",
|
|
51
|
+
"astro-cloudflare-pages-headers": "^1.7.7",
|
|
52
|
+
"astro-d2": "^0.10.0",
|
|
53
|
+
"astro-favicons": "3.1.6",
|
|
52
54
|
"rehype-external-links": "^3.0.0",
|
|
53
|
-
"starlight-announcement": "
|
|
54
|
-
"starlight-changelogs": "
|
|
55
|
-
"starlight-heading-badges": "
|
|
56
|
-
"starlight-links-validator": "
|
|
57
|
-
"starlight-llms-txt": "
|
|
58
|
-
"starlight-page-actions": "
|
|
59
|
-
"starlight-plugin-icons": "
|
|
60
|
-
"starlight-scroll-to-top": "
|
|
61
|
-
"starlight-sidebar-topics": "
|
|
62
|
-
"starlight-tags": "
|
|
63
|
-
"vite-tsconfig-paths": "
|
|
55
|
+
"starlight-announcement": ">=0.1.1",
|
|
56
|
+
"starlight-changelogs": " >=0.1.0",
|
|
57
|
+
"starlight-heading-badges": ">=0.6.1",
|
|
58
|
+
"starlight-links-validator": ">=0.1.0",
|
|
59
|
+
"starlight-llms-txt": ">=0.8.0",
|
|
60
|
+
"starlight-page-actions": ">=0.1.0",
|
|
61
|
+
"starlight-plugin-icons": ">=0.1.0",
|
|
62
|
+
"starlight-scroll-to-top": ">=0.4.0",
|
|
63
|
+
"starlight-sidebar-topics": ">=0.7.1",
|
|
64
|
+
"starlight-tags": ">=0.4.0",
|
|
65
|
+
"vite-tsconfig-paths": "6.1.1"
|
|
64
66
|
},
|
|
65
67
|
"devDependencies": {
|
|
66
|
-
"@astrojs/check": "
|
|
67
|
-
"@astrojs/compiler-rs": "
|
|
68
|
-
"@biomejs/biome": "
|
|
69
|
-
"@knitli/tsconfig": "
|
|
70
|
-
"@types/node": "
|
|
71
|
-
"bun": "
|
|
72
|
-
"lightningcss": "
|
|
73
|
-
"sharp": "
|
|
74
|
-
"svgo": "
|
|
75
|
-
"typescript": "
|
|
68
|
+
"@astrojs/check": "^0.9.6",
|
|
69
|
+
"@astrojs/compiler-rs": "^0.1.4",
|
|
70
|
+
"@biomejs/biome": "^2.4.2",
|
|
71
|
+
"@knitli/tsconfig": "0.2.0",
|
|
72
|
+
"@types/node": "^24.0.2",
|
|
73
|
+
"bun": "^1.3.9",
|
|
74
|
+
"lightningcss": "^1.30.2",
|
|
75
|
+
"sharp": "^0.34.5",
|
|
76
|
+
"svgo": "^4.0.0",
|
|
77
|
+
"typescript": "^5.9.3"
|
|
76
78
|
},
|
|
77
79
|
"devEngines": {
|
|
78
80
|
"packageManager": {
|
|
@@ -80,5 +82,11 @@
|
|
|
80
82
|
"version": "catalog:dev-common",
|
|
81
83
|
"onFail": "download"
|
|
82
84
|
}
|
|
85
|
+
},
|
|
86
|
+
"publishConfig": {
|
|
87
|
+
"access": "public",
|
|
88
|
+
"provenance": false,
|
|
89
|
+
"registry": "https://registry.npmjs.org/",
|
|
90
|
+
"tag": "latest"
|
|
83
91
|
}
|
|
84
92
|
}
|
package/scaffolding/package.json
CHANGED
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"astro": "bunx astro",
|
|
8
|
-
"prebuild": "
|
|
8
|
+
"prebuild": "bunx wrangler types; bunx astro sync",
|
|
9
9
|
"build": "bunx astro build",
|
|
10
10
|
"deploy": "bun run build && bunx wrangler deploy",
|
|
11
11
|
"dev": "bunx astro dev",
|
|
12
|
+
"prepare": "test -f ./node_modules/bun/install.js && node ./node_modules/bun/install.js || true",
|
|
12
13
|
"preview": "bunx astro preview",
|
|
13
14
|
"wrangler": "bunx wrangler"
|
|
14
15
|
},
|
package/src/cli.ts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
+
|
|
2
3
|
// SPDX-FileCopyrightText: 2026 Knitli Inc.
|
|
3
4
|
//
|
|
4
5
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
6
|
|
|
6
|
-
import { createInterface } from "node:readline/promises";
|
|
7
7
|
import { stdin, stdout } from "node:process";
|
|
8
|
+
import { createInterface } from "node:readline/promises";
|
|
8
9
|
import {
|
|
9
10
|
addPieces,
|
|
11
|
+
type InitOptions,
|
|
10
12
|
initDocsTemplate,
|
|
11
|
-
PIECES,
|
|
12
13
|
PIECE_NAMES,
|
|
13
|
-
|
|
14
|
+
PIECES,
|
|
14
15
|
type PieceName,
|
|
15
|
-
} from "./index
|
|
16
|
+
} from "./index";
|
|
16
17
|
|
|
17
18
|
// ── Arg parsing ──
|
|
18
19
|
|
|
@@ -21,13 +22,23 @@ function parseArgs(argv: string[]) {
|
|
|
21
22
|
const positional: string[] = [];
|
|
22
23
|
|
|
23
24
|
for (let i = 0; i < argv.length; i++) {
|
|
24
|
-
const arg = argv[i]
|
|
25
|
+
const arg = argv[i];
|
|
26
|
+
if (arg === undefined) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
|
|
25
30
|
if (arg === "--help" || arg === "-h") {
|
|
26
31
|
flags.help = "true";
|
|
27
32
|
} else if (arg === "--force" || arg === "-f") {
|
|
28
33
|
flags.force = "true";
|
|
29
|
-
} else if (arg.startsWith("--")
|
|
30
|
-
|
|
34
|
+
} else if (arg.startsWith("--")) {
|
|
35
|
+
const nextArg = argv[i + 1];
|
|
36
|
+
if (nextArg !== undefined) {
|
|
37
|
+
flags[arg.slice(2)] = nextArg;
|
|
38
|
+
i++;
|
|
39
|
+
} else {
|
|
40
|
+
positional.push(arg);
|
|
41
|
+
}
|
|
31
42
|
} else {
|
|
32
43
|
positional.push(arg);
|
|
33
44
|
}
|
|
@@ -62,9 +73,7 @@ Options:
|
|
|
62
73
|
|
|
63
74
|
// ── Interactive prompts ──
|
|
64
75
|
|
|
65
|
-
async function getOptions(
|
|
66
|
-
flags: Record<string, string>,
|
|
67
|
-
): Promise<InitOptions> {
|
|
76
|
+
async function getOptions(flags: Record<string, string>): Promise<InitOptions> {
|
|
68
77
|
const rl = createInterface({ input: stdin, output: stdout });
|
|
69
78
|
|
|
70
79
|
const ask = async (
|
|
@@ -90,8 +99,7 @@ async function getOptions(
|
|
|
90
99
|
"npm package name",
|
|
91
100
|
`@knitli-site/${appName.toLowerCase()}-docs`,
|
|
92
101
|
));
|
|
93
|
-
const description =
|
|
94
|
-
flags.description || (await ask("Short description"));
|
|
102
|
+
const description = flags.description || (await ask("Short description"));
|
|
95
103
|
const workerName =
|
|
96
104
|
flags["worker-name"] ||
|
|
97
105
|
(await ask("Worker name", `${appName.toLowerCase()}-docs`));
|
package/src/index.ts
CHANGED
|
@@ -225,7 +225,13 @@ export function addPieces(
|
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
if (statSync(srcPath).isDirectory()) {
|
|
228
|
-
copyDirRecursive(
|
|
228
|
+
copyDirRecursive(
|
|
229
|
+
srcPath,
|
|
230
|
+
destPath,
|
|
231
|
+
replacements,
|
|
232
|
+
created,
|
|
233
|
+
options.force,
|
|
234
|
+
);
|
|
229
235
|
} else {
|
|
230
236
|
copyFile(srcPath, destPath, replacements, created, options.force);
|
|
231
237
|
}
|