@heyo-sh/create-heyo-docs 0.2.1 → 0.2.3
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/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -3
- package/dist/scaffold.d.ts +2 -0
- package/dist/scaffold.d.ts.map +1 -1
- package/package.json +1 -1
- package/templates/next/next.config.ts +7 -0
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":";AAeA,OAAO,KAAK,EAAE,aAAa,EAAY,MAAM,SAAS,CAAC;AAEvD,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
|
@@ -62,7 +62,7 @@ function assertProjectName(value) {
|
|
|
62
62
|
// src/scaffold.ts
|
|
63
63
|
import { spawn } from "node:child_process";
|
|
64
64
|
import { existsSync } from "node:fs";
|
|
65
|
-
import { mkdir as mkdir2, readdir as readdir2 } from "node:fs/promises";
|
|
65
|
+
import { mkdir as mkdir2, readdir as readdir2, writeFile as writeFile2 } from "node:fs/promises";
|
|
66
66
|
import { join as join2, resolve } from "node:path";
|
|
67
67
|
|
|
68
68
|
// src/utils.ts
|
|
@@ -117,15 +117,21 @@ function isRecord(value) {
|
|
|
117
117
|
|
|
118
118
|
// src/scaffold.ts
|
|
119
119
|
var packageRoot = resolve(import.meta.dirname, "..");
|
|
120
|
+
var REACT_ROUTER_VERCEL_UNSUPPORTED_MESSAGE = "Vercel does not support React Router 8 yet. Choose Cloudflare or configure deployment later. https://github.com/vercel/vercel/issues/16730";
|
|
121
|
+
function assertSupportedProjectOptions(options) {
|
|
122
|
+
if (options.template === "react-router" && options.deployment === "vercel")
|
|
123
|
+
throw new Error(REACT_ROUTER_VERCEL_UNSUPPORTED_MESSAGE);
|
|
124
|
+
}
|
|
120
125
|
async function scaffoldProject(options) {
|
|
121
126
|
const cwd = options.cwd ?? process.cwd();
|
|
122
127
|
const projectName = assertProjectName(options.projectName);
|
|
128
|
+
assertSupportedProjectOptions(options);
|
|
123
129
|
const projectPath = resolve(cwd, projectName);
|
|
124
130
|
if (existsSync(projectPath))
|
|
125
131
|
throw new Error(`Directory already exists: ${projectPath}`);
|
|
126
132
|
const placeholders = {
|
|
127
133
|
PROJECT_NAME: projectName,
|
|
128
|
-
HEYO_DOCS_VERSION: options.heyoDocsVersion ?? "
|
|
134
|
+
HEYO_DOCS_VERSION: options.heyoDocsVersion ?? "latest",
|
|
129
135
|
PACKAGE_MANAGER: packageManagerField(options.packageManager),
|
|
130
136
|
THEME: options.theme
|
|
131
137
|
};
|
|
@@ -133,6 +139,9 @@ async function scaffoldProject(options) {
|
|
|
133
139
|
const deploymentPath = join2(packageRoot, "deployments", options.deployment, options.template);
|
|
134
140
|
await mkdir2(projectPath, { recursive: true });
|
|
135
141
|
await copyTemplate(templatePath, projectPath, placeholders);
|
|
142
|
+
if (options.packageManager === "yarn")
|
|
143
|
+
await writeFile2(join2(projectPath, ".yarnrc.yml"), `nodeLinker: node-modules
|
|
144
|
+
`);
|
|
136
145
|
const basePackage = await readJson(join2(projectPath, "package.json"));
|
|
137
146
|
const overlayPackage = options.deployment === "later" ? {} : await readJson(join2(deploymentPath, "package.json"));
|
|
138
147
|
if (options.deployment !== "later") {
|
|
@@ -293,7 +302,7 @@ async function askQuestions(defaults) {
|
|
|
293
302
|
"next",
|
|
294
303
|
"astro"
|
|
295
304
|
]);
|
|
296
|
-
const deployment = await
|
|
305
|
+
const deployment = await selectDeployment(template, defaults.deployment);
|
|
297
306
|
const theme = await selectAvailable("Theme", THEME_OPTIONS, [
|
|
298
307
|
"grain",
|
|
299
308
|
"shade",
|
|
@@ -315,6 +324,14 @@ async function askQuestions(defaults) {
|
|
|
315
324
|
install
|
|
316
325
|
};
|
|
317
326
|
}
|
|
327
|
+
async function selectDeployment(template, initialValue) {
|
|
328
|
+
for (;; ) {
|
|
329
|
+
const deployment = await selectAvailable("Deployment", DEPLOYMENT_OPTIONS, ["cloudflare", "vercel", "later"], initialValue);
|
|
330
|
+
if (template !== "react-router" || deployment !== "vercel")
|
|
331
|
+
return deployment;
|
|
332
|
+
p.log.warn(REACT_ROUTER_VERCEL_UNSUPPORTED_MESSAGE);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
318
335
|
async function selectAvailable(message, options, available, initialValue) {
|
|
319
336
|
for (;; ) {
|
|
320
337
|
const answer = await p.select({ message, options, initialValue });
|
package/dist/scaffold.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { CreateOptions } from "./types";
|
|
2
|
+
export declare const REACT_ROUTER_VERCEL_UNSUPPORTED_MESSAGE = "Vercel does not support React Router 8 yet. Choose Cloudflare or configure deployment later. https://github.com/vercel/vercel/issues/16730";
|
|
3
|
+
export declare function assertSupportedProjectOptions(options: Pick<CreateOptions, "template" | "deployment">): void;
|
|
2
4
|
export declare function scaffoldProject(options: CreateOptions): Promise<{
|
|
3
5
|
projectPath: string;
|
|
4
6
|
}>;
|
package/dist/scaffold.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,
|
|
1
|
+
{"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../src/scaffold.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAK7C,eAAO,MAAM,uCAAuC,+IAC0F,CAAC;AAE/I,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,IAAI,CAAC,aAAa,EAAE,UAAU,GAAG,YAAY,CAAC,GACtD,IAAI,CAGN;AAED,wBAAsB,eAAe,CACnC,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,CAgDlC"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
|
+
import { dirname } from "node:path";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
1
3
|
import createMDX from "@next/mdx";
|
|
2
4
|
import type { NextConfig } from "next";
|
|
3
5
|
import { heyoDocsMdxOptions } from "@heyo-sh/heyo-docs/next";
|
|
4
6
|
|
|
7
|
+
const projectRoot = dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
|
|
5
9
|
const nextConfig: NextConfig = {
|
|
10
|
+
turbopack: {
|
|
11
|
+
root: projectRoot,
|
|
12
|
+
},
|
|
6
13
|
pageExtensions: ["ts", "tsx", "md", "mdx"],
|
|
7
14
|
async rewrites() {
|
|
8
15
|
return {
|