@farming-labs/docs 0.0.17 → 0.0.18
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/cli/index.mjs +9 -9
- package/package.json +1 -1
package/dist/cli/index.mjs
CHANGED
|
@@ -1759,15 +1759,15 @@ async function init(options = {}) {
|
|
|
1759
1759
|
}
|
|
1760
1760
|
template = templateAnswer;
|
|
1761
1761
|
}
|
|
1762
|
+
const defaultProjectName = "my-docs";
|
|
1762
1763
|
let projectName = options.name?.trim();
|
|
1763
1764
|
if (!projectName) {
|
|
1764
1765
|
const nameAnswer = await p.text({
|
|
1765
1766
|
message: "Project name? (we'll create this folder and bootstrap the app here)",
|
|
1766
|
-
placeholder:
|
|
1767
|
-
defaultValue:
|
|
1767
|
+
placeholder: defaultProjectName,
|
|
1768
|
+
defaultValue: defaultProjectName,
|
|
1768
1769
|
validate: (value) => {
|
|
1769
1770
|
const v = (value ?? "").trim();
|
|
1770
|
-
if (!v) return "Project name is required";
|
|
1771
1771
|
if (v.includes("/") || v.includes("\\")) return "Project name cannot contain path separators";
|
|
1772
1772
|
if (v.includes(" ")) return "Project name cannot contain spaces";
|
|
1773
1773
|
}
|
|
@@ -1776,7 +1776,7 @@ async function init(options = {}) {
|
|
|
1776
1776
|
p.outro(pc.red("Init cancelled."));
|
|
1777
1777
|
process.exit(0);
|
|
1778
1778
|
}
|
|
1779
|
-
projectName = nameAnswer.trim();
|
|
1779
|
+
projectName = nameAnswer.trim() || defaultProjectName;
|
|
1780
1780
|
}
|
|
1781
1781
|
const templateLabel = template === "next" ? "Next.js" : template === "nuxt" ? "Nuxt" : template === "sveltekit" ? "SvelteKit" : "Astro";
|
|
1782
1782
|
const targetDir = path.join(cwd, projectName);
|
|
@@ -1888,25 +1888,25 @@ async function init(options = {}) {
|
|
|
1888
1888
|
p.outro(pc.red("Init cancelled."));
|
|
1889
1889
|
process.exit(0);
|
|
1890
1890
|
}
|
|
1891
|
+
const defaultThemeName = "my-theme";
|
|
1891
1892
|
let customThemeName;
|
|
1892
1893
|
if (theme === "custom") {
|
|
1893
1894
|
const nameAnswer = await p.text({
|
|
1894
1895
|
message: "Theme name? (we'll create themes/<name>.ts and themes/<name>.css)",
|
|
1895
|
-
placeholder:
|
|
1896
|
-
defaultValue:
|
|
1896
|
+
placeholder: defaultThemeName,
|
|
1897
|
+
defaultValue: defaultThemeName,
|
|
1897
1898
|
validate: (value) => {
|
|
1898
1899
|
const v = (value ?? "").trim().replace(/\.(ts|css)$/i, "");
|
|
1899
|
-
if (!v) return "Theme name is required";
|
|
1900
1900
|
if (v.includes("/") || v.includes("\\")) return "Theme name cannot contain path separators";
|
|
1901
1901
|
if (v.includes(" ")) return "Theme name cannot contain spaces";
|
|
1902
|
-
if (!/^[a-z0-9_-]+$/i.test(v)) return "Use only letters, numbers, hyphens, and underscores";
|
|
1902
|
+
if (v && !/^[a-z0-9_-]+$/i.test(v)) return "Use only letters, numbers, hyphens, and underscores";
|
|
1903
1903
|
}
|
|
1904
1904
|
});
|
|
1905
1905
|
if (p.isCancel(nameAnswer)) {
|
|
1906
1906
|
p.outro(pc.red("Init cancelled."));
|
|
1907
1907
|
process.exit(0);
|
|
1908
1908
|
}
|
|
1909
|
-
customThemeName = nameAnswer.trim().replace(/\.(ts|css)$/i, "");
|
|
1909
|
+
customThemeName = nameAnswer.trim().replace(/\.(ts|css)$/i, "") || defaultThemeName;
|
|
1910
1910
|
}
|
|
1911
1911
|
const aliasHint = framework === "nextjs" ? `Uses ${pc.cyan("@/")} prefix (requires tsconfig paths)` : framework === "sveltekit" ? `Uses ${pc.cyan("$lib/")} prefix (SvelteKit built-in)` : framework === "nuxt" ? `Uses ${pc.cyan("~/")} prefix (Nuxt built-in)` : `Uses ${pc.cyan("@/")} prefix (requires tsconfig paths)`;
|
|
1912
1912
|
const useAlias = await p.confirm({
|