@heyo-sh/create-heyo-docs 0.1.0 → 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/README.md +52 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +41 -20
- package/dist/package-manager.d.ts.map +1 -1
- package/dist/scaffold.d.ts.map +1 -1
- package/package.json +7 -4
- package/templates/react-router/content/mdx-components.mdx +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Create Heyo Docs
|
|
2
|
+
|
|
3
|
+
Create a standalone, production-ready documentation site with Heyo Docs. Choose React Router, Next.js, or Astro, plus a built-in theme and deployment target.
|
|
4
|
+
|
|
5
|
+
## Create a project
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# pnpm
|
|
9
|
+
pnpm create @heyo-sh/heyo-docs my-docs
|
|
10
|
+
cd my-docs
|
|
11
|
+
pnpm dev
|
|
12
|
+
|
|
13
|
+
# npm
|
|
14
|
+
npm create @heyo-sh/heyo-docs@latest my-docs
|
|
15
|
+
cd my-docs
|
|
16
|
+
npm run dev
|
|
17
|
+
|
|
18
|
+
# Yarn
|
|
19
|
+
yarn dlx @heyo-sh/create-heyo-docs my-docs
|
|
20
|
+
cd my-docs
|
|
21
|
+
yarn dev
|
|
22
|
+
|
|
23
|
+
# Bun
|
|
24
|
+
bun create @heyo-sh/heyo-docs my-docs
|
|
25
|
+
cd my-docs
|
|
26
|
+
bun run dev
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The creator works with pnpm, npm, Yarn, and Bun.
|
|
30
|
+
|
|
31
|
+
## Options
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pnpm create @heyo-sh/heyo-docs my-docs \
|
|
35
|
+
--template astro \
|
|
36
|
+
--theme moss \
|
|
37
|
+
--deployment cloudflare
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
| Option | Values |
|
|
41
|
+
| ------------------- | ------------------------------- |
|
|
42
|
+
| `--template` | `react-router`, `next`, `astro` |
|
|
43
|
+
| `--theme` | `grain`, `shade`, `moss` |
|
|
44
|
+
| `--deployment` | `cloudflare`, `vercel`, `later` |
|
|
45
|
+
| `--package-manager` | `bun`, `pnpm`, `npm`, `yarn` |
|
|
46
|
+
| `--no-install` | Skip dependency installation |
|
|
47
|
+
|
|
48
|
+
Read the [full documentation](https://docs.heyo.sh) for configuration, content, components, framework integrations, and deployment.
|
|
49
|
+
|
|
50
|
+
## License
|
|
51
|
+
|
|
52
|
+
[MIT](https://github.com/heyo-sh/heyo-docs/blob/main/LICENSE)
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAYA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAChE,mBAAmB,SAAS,CAAC;AAqD7B,wBAAsB,GAAG,CAAC,IAAI,WAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAwBrE;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG;IAC9C,OAAO,EAAE,aAAa,CAAC;IACvB,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;CACnB,CAsDA"}
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
2
|
-
// @bun
|
|
1
|
+
#!/usr/bin/env node
|
|
3
2
|
|
|
4
3
|
// src/index.ts
|
|
4
|
+
import { realpathSync } from "node:fs";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
5
6
|
import * as p from "@clack/prompts";
|
|
6
7
|
|
|
7
8
|
// src/package-manager.ts
|
|
9
|
+
import { spawnSync } from "node:child_process";
|
|
8
10
|
var FALLBACK_VERSIONS = {
|
|
9
11
|
bun: "1.3.1",
|
|
10
12
|
pnpm: "10.17.0",
|
|
@@ -14,7 +16,7 @@ var FALLBACK_VERSIONS = {
|
|
|
14
16
|
function detectPackageManager(userAgent = process.env.npm_config_user_agent ?? "") {
|
|
15
17
|
const match = userAgent.match(/(?:^|\s)(bun|pnpm|npm|yarn)\/([^\s]+)/);
|
|
16
18
|
if (!match)
|
|
17
|
-
return { name: "
|
|
19
|
+
return { name: "npm" };
|
|
18
20
|
return { name: match[1], version: match[2] };
|
|
19
21
|
}
|
|
20
22
|
function packageManagerField(manager, detected = detectPackageManager()) {
|
|
@@ -22,9 +24,11 @@ function packageManagerField(manager, detected = detectPackageManager()) {
|
|
|
22
24
|
return `${manager}@${detected.version}`;
|
|
23
25
|
const executable = manager === "yarn" ? "yarn" : manager;
|
|
24
26
|
try {
|
|
25
|
-
const result =
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
const result = spawnSync(executable, ["--version"], {
|
|
28
|
+
encoding: "utf8"
|
|
29
|
+
});
|
|
30
|
+
const version = result.stdout?.trim();
|
|
31
|
+
if (result.status === 0 && version && /^\d+(?:\.\d+)+/.test(version))
|
|
28
32
|
return `${manager}@${version}`;
|
|
29
33
|
} catch {}
|
|
30
34
|
return `${manager}@${FALLBACK_VERSIONS[manager]}`;
|
|
@@ -56,9 +60,10 @@ function assertProjectName(value) {
|
|
|
56
60
|
}
|
|
57
61
|
|
|
58
62
|
// src/scaffold.ts
|
|
59
|
-
import {
|
|
60
|
-
import {
|
|
61
|
-
import {
|
|
63
|
+
import { spawn } from "node:child_process";
|
|
64
|
+
import { existsSync } from "node:fs";
|
|
65
|
+
import { mkdir as mkdir2, readdir as readdir2 } from "node:fs/promises";
|
|
66
|
+
import { join as join2, resolve } from "node:path";
|
|
62
67
|
|
|
63
68
|
// src/utils.ts
|
|
64
69
|
import {
|
|
@@ -69,8 +74,8 @@ import {
|
|
|
69
74
|
rm,
|
|
70
75
|
stat,
|
|
71
76
|
writeFile
|
|
72
|
-
} from "fs/promises";
|
|
73
|
-
import { dirname, join } from "path";
|
|
77
|
+
} from "node:fs/promises";
|
|
78
|
+
import { dirname, join } from "node:path";
|
|
74
79
|
function replacePlaceholders(source, values) {
|
|
75
80
|
return source.replace(/\{\{([A-Z0-9_]+)\}\}/g, (placeholder, key) => values[key] ?? placeholder);
|
|
76
81
|
}
|
|
@@ -148,13 +153,19 @@ async function copyOverlay(source, destination, placeholders) {
|
|
|
148
153
|
}
|
|
149
154
|
async function installDependencies(projectPath, packageManager) {
|
|
150
155
|
const command = packageManagerInstallCommand(packageManager);
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
156
|
+
const [executable, ...arguments_] = command;
|
|
157
|
+
await new Promise((resolveInstall, rejectInstall) => {
|
|
158
|
+
const child = spawn(executable, arguments_, {
|
|
159
|
+
cwd: projectPath,
|
|
160
|
+
stdio: "inherit"
|
|
161
|
+
});
|
|
162
|
+
child.once("error", rejectInstall);
|
|
163
|
+
child.once("close", (exitCode) => {
|
|
164
|
+
if (exitCode === 0)
|
|
165
|
+
return resolveInstall();
|
|
166
|
+
rejectInstall(new Error(`Dependency installation failed with ${command.join(" ")}.`));
|
|
167
|
+
});
|
|
155
168
|
});
|
|
156
|
-
if (await process2.exited !== 0)
|
|
157
|
-
throw new Error(`Dependency installation failed with ${command.join(" ")}.`);
|
|
158
169
|
}
|
|
159
170
|
|
|
160
171
|
// src/index.ts
|
|
@@ -175,12 +186,12 @@ var THEME_OPTIONS = [
|
|
|
175
186
|
{ value: "moss", label: "Moss" },
|
|
176
187
|
{
|
|
177
188
|
value: "dripper",
|
|
178
|
-
label: "Dripper
|
|
189
|
+
label: "Dripper — Soon",
|
|
179
190
|
hint: "Unavailable in this MVP"
|
|
180
191
|
},
|
|
181
192
|
{
|
|
182
193
|
value: "fixed-gear",
|
|
183
|
-
label: "Fixed Gear
|
|
194
|
+
label: "Fixed Gear — Soon",
|
|
184
195
|
hint: "Unavailable in this MVP"
|
|
185
196
|
}
|
|
186
197
|
];
|
|
@@ -190,12 +201,22 @@ var PACKAGE_MANAGER_OPTIONS = [
|
|
|
190
201
|
{ value: "npm", label: "npm" },
|
|
191
202
|
{ value: "yarn", label: "yarn" }
|
|
192
203
|
];
|
|
193
|
-
if (
|
|
204
|
+
if (isMainModule()) {
|
|
194
205
|
run(process.argv.slice(2)).catch((error) => {
|
|
195
206
|
p.log.error(error instanceof Error ? error.message : String(error));
|
|
196
207
|
process.exitCode = 1;
|
|
197
208
|
});
|
|
198
209
|
}
|
|
210
|
+
function isMainModule() {
|
|
211
|
+
const entryPoint = process.argv[1];
|
|
212
|
+
if (!entryPoint)
|
|
213
|
+
return false;
|
|
214
|
+
try {
|
|
215
|
+
return realpathSync(entryPoint) === fileURLToPath(import.meta.url);
|
|
216
|
+
} catch {
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
199
220
|
async function run(argv = process.argv.slice(2)) {
|
|
200
221
|
const parsed = parseArguments(argv);
|
|
201
222
|
if (parsed.showHelp) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-manager.d.ts","sourceRoot":"","sources":["../src/package-manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"package-manager.d.ts","sourceRoot":"","sources":["../src/package-manager.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAStE,wBAAgB,oBAAoB,CAClC,SAAS,SAA0C,GAClD,sBAAsB,CAIxB;AAED,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,cAAc,EACvB,QAAQ,yBAAyB,GAChC,MAAM,CAeR;AAED,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,cAAc,GACtB,MAAM,EAAE,CAEV;AAED,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,MAAM,GACb,MAAM,CAIR"}
|
package/dist/scaffold.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../src/scaffold.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../src/scaffold.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAK7C,wBAAsB,eAAe,CACnC,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,CA0ClC"}
|
package/package.json
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heyo-sh/create-heyo-docs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Create a standalone Heyo Docs documentation project.",
|
|
5
5
|
"homepage": "https://heyo.sh",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/heyo/heyo-docs.git"
|
|
8
|
+
"url": "git+https://github.com/heyo-sh/heyo-docs.git"
|
|
9
9
|
},
|
|
10
10
|
"bugs": {
|
|
11
|
-
"url": "https://github.com/heyo/heyo-docs/issues"
|
|
11
|
+
"url": "https://github.com/heyo-sh/heyo-docs/issues"
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"type": "module",
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=20.11.0"
|
|
17
|
+
},
|
|
15
18
|
"bin": {
|
|
16
19
|
"create-heyo-docs": "./dist/index.js"
|
|
17
20
|
},
|
|
@@ -28,7 +31,7 @@
|
|
|
28
31
|
},
|
|
29
32
|
"scripts": {
|
|
30
33
|
"dev": "bun run build --watch",
|
|
31
|
-
"build": "bun build src/index.ts --outdir dist --target
|
|
34
|
+
"build": "bun build src/index.ts --outdir dist --target node --external @clack/prompts && bun run build:types",
|
|
32
35
|
"build:types": "tsc -p tsconfig.build.json",
|
|
33
36
|
"typecheck": "tsc -p tsconfig.json",
|
|
34
37
|
"test": "bun test"
|
|
@@ -21,7 +21,7 @@ Every component below is available without an import. The examples show every vi
|
|
|
21
21
|
|
|
22
22
|
<Button
|
|
23
23
|
align="right"
|
|
24
|
-
href="https://github.com/heyo/heyo-docs"
|
|
24
|
+
href="https://github.com/heyo-sh/heyo-docs"
|
|
25
25
|
target="_blank"
|
|
26
26
|
variant="ghost"
|
|
27
27
|
size="xs"
|
|
@@ -262,7 +262,7 @@ export function CompactExample() {
|
|
|
262
262
|
|
|
263
263
|
<GitHub href="https://github.com/react/react" variant="inset" />
|
|
264
264
|
|
|
265
|
-
<GitHub href="https://github.com/heyo/heyo-docs" />
|
|
265
|
+
<GitHub href="https://github.com/heyo-sh/heyo-docs" />
|
|
266
266
|
|
|
267
267
|
## Steps
|
|
268
268
|
|