@farming-labs/docs 0.0.19 → 0.0.21
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 +70 -5
- package/package.json +1 -1
package/dist/cli/index.mjs
CHANGED
|
@@ -1793,13 +1793,46 @@ async function init(options = {}) {
|
|
|
1793
1793
|
p.log.error("Failed to bootstrap. Check your connection and that the repo exists.");
|
|
1794
1794
|
process.exit(1);
|
|
1795
1795
|
}
|
|
1796
|
-
p.
|
|
1796
|
+
const pmAnswer = await p.select({
|
|
1797
|
+
message: "Which package manager do you want to use in this new project?",
|
|
1798
|
+
options: [
|
|
1799
|
+
{
|
|
1800
|
+
value: "pnpm",
|
|
1801
|
+
label: "pnpm",
|
|
1802
|
+
hint: "Fast, disk-efficient (recommended)"
|
|
1803
|
+
},
|
|
1804
|
+
{
|
|
1805
|
+
value: "npm",
|
|
1806
|
+
label: "npm",
|
|
1807
|
+
hint: "Default Node.js package manager"
|
|
1808
|
+
},
|
|
1809
|
+
{
|
|
1810
|
+
value: "yarn",
|
|
1811
|
+
label: "yarn",
|
|
1812
|
+
hint: "Classic yarn (script: yarn dev)"
|
|
1813
|
+
},
|
|
1814
|
+
{
|
|
1815
|
+
value: "bun",
|
|
1816
|
+
label: "bun",
|
|
1817
|
+
hint: "Bun runtime + bun install/dev"
|
|
1818
|
+
}
|
|
1819
|
+
]
|
|
1820
|
+
});
|
|
1821
|
+
if (p.isCancel(pmAnswer)) {
|
|
1822
|
+
p.outro(pc.red("Init cancelled."));
|
|
1823
|
+
process.exit(0);
|
|
1824
|
+
}
|
|
1825
|
+
const pmFresh = pmAnswer;
|
|
1826
|
+
p.log.success(`Bootstrapped ${pc.cyan(`'${projectName}'`)}. Installing dependencies with ${pc.cyan(pmFresh)}...`);
|
|
1827
|
+
const installCmd = pmFresh === "yarn" ? "yarn install" : pmFresh === "npm" ? "npm install" : pmFresh === "bun" ? "bun install" : "pnpm install";
|
|
1797
1828
|
try {
|
|
1798
|
-
exec(
|
|
1829
|
+
exec(installCmd, targetDir);
|
|
1799
1830
|
} catch {
|
|
1800
|
-
p.log.warn(
|
|
1831
|
+
p.log.warn(`${pmFresh} install failed. Run ${pc.cyan(installCmd)} manually inside the project.`);
|
|
1801
1832
|
}
|
|
1802
|
-
|
|
1833
|
+
const devCmd = pmFresh === "yarn" ? "yarn dev" : pmFresh === "npm" ? "npm run dev" : pmFresh === "bun" ? "bun dev" : "pnpm dev";
|
|
1834
|
+
p.outro(pc.green(`Done! Run ${pc.cyan(`cd ${projectName} && ${devCmd}`)} to start the dev server and navigate to the /docs.`));
|
|
1835
|
+
p.outro(pc.green("Happy documenting!"));
|
|
1803
1836
|
process.exit(0);
|
|
1804
1837
|
}
|
|
1805
1838
|
let framework = detectFramework(cwd);
|
|
@@ -2026,7 +2059,39 @@ async function init(options = {}) {
|
|
|
2026
2059
|
s.stop("Files scaffolded");
|
|
2027
2060
|
if (written.length > 0) p.log.success(`Created ${written.length} file${written.length > 1 ? "s" : ""}:\n` + written.map((f) => ` ${pc.green("+")} ${f}`).join("\n"));
|
|
2028
2061
|
if (skipped.length > 0) p.log.info(`Skipped ${skipped.length} existing file${skipped.length > 1 ? "s" : ""}:\n` + skipped.map((f) => ` ${pc.dim("-")} ${f}`).join("\n"));
|
|
2029
|
-
|
|
2062
|
+
let pm = detectPackageManager(cwd);
|
|
2063
|
+
p.log.info(`Detected ${pc.cyan(pm)} as package manager`);
|
|
2064
|
+
const pmAnswerExisting = await p.select({
|
|
2065
|
+
initialValue: pm,
|
|
2066
|
+
message: "Which package manager do you want to use in this project?",
|
|
2067
|
+
options: [
|
|
2068
|
+
{
|
|
2069
|
+
value: "pnpm",
|
|
2070
|
+
label: "pnpm",
|
|
2071
|
+
hint: "Fast, disk-efficient (recommended)"
|
|
2072
|
+
},
|
|
2073
|
+
{
|
|
2074
|
+
value: "npm",
|
|
2075
|
+
label: "npm",
|
|
2076
|
+
hint: "Default Node.js package manager"
|
|
2077
|
+
},
|
|
2078
|
+
{
|
|
2079
|
+
value: "yarn",
|
|
2080
|
+
label: "yarn",
|
|
2081
|
+
hint: "Classic yarn (script: yarn dev)"
|
|
2082
|
+
},
|
|
2083
|
+
{
|
|
2084
|
+
value: "bun",
|
|
2085
|
+
label: "bun",
|
|
2086
|
+
hint: "Bun runtime + bun install/dev"
|
|
2087
|
+
}
|
|
2088
|
+
]
|
|
2089
|
+
});
|
|
2090
|
+
if (p.isCancel(pmAnswerExisting)) {
|
|
2091
|
+
p.outro(pc.red("Init cancelled."));
|
|
2092
|
+
process.exit(0);
|
|
2093
|
+
}
|
|
2094
|
+
pm = pmAnswerExisting;
|
|
2030
2095
|
p.log.info(`Using ${pc.cyan(pm)} as package manager`);
|
|
2031
2096
|
const s2 = p.spinner();
|
|
2032
2097
|
s2.start("Installing dependencies");
|