@farming-labs/docs 0.0.19 → 0.0.20
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 +69 -5
- package/package.json +1 -1
package/dist/cli/index.mjs
CHANGED
|
@@ -1793,13 +1793,45 @@ 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.`));
|
|
1803
1835
|
process.exit(0);
|
|
1804
1836
|
}
|
|
1805
1837
|
let framework = detectFramework(cwd);
|
|
@@ -2026,7 +2058,39 @@ async function init(options = {}) {
|
|
|
2026
2058
|
s.stop("Files scaffolded");
|
|
2027
2059
|
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
2060
|
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
|
-
|
|
2061
|
+
let pm = detectPackageManager(cwd);
|
|
2062
|
+
p.log.info(`Detected ${pc.cyan(pm)} as package manager`);
|
|
2063
|
+
const pmAnswerExisting = await p.select({
|
|
2064
|
+
initialValue: pm,
|
|
2065
|
+
message: "Which package manager do you want to use in this project?",
|
|
2066
|
+
options: [
|
|
2067
|
+
{
|
|
2068
|
+
value: "pnpm",
|
|
2069
|
+
label: "pnpm",
|
|
2070
|
+
hint: "Fast, disk-efficient (recommended)"
|
|
2071
|
+
},
|
|
2072
|
+
{
|
|
2073
|
+
value: "npm",
|
|
2074
|
+
label: "npm",
|
|
2075
|
+
hint: "Default Node.js package manager"
|
|
2076
|
+
},
|
|
2077
|
+
{
|
|
2078
|
+
value: "yarn",
|
|
2079
|
+
label: "yarn",
|
|
2080
|
+
hint: "Classic yarn (script: yarn dev)"
|
|
2081
|
+
},
|
|
2082
|
+
{
|
|
2083
|
+
value: "bun",
|
|
2084
|
+
label: "bun",
|
|
2085
|
+
hint: "Bun runtime + bun install/dev"
|
|
2086
|
+
}
|
|
2087
|
+
]
|
|
2088
|
+
});
|
|
2089
|
+
if (p.isCancel(pmAnswerExisting)) {
|
|
2090
|
+
p.outro(pc.red("Init cancelled."));
|
|
2091
|
+
process.exit(0);
|
|
2092
|
+
}
|
|
2093
|
+
pm = pmAnswerExisting;
|
|
2030
2094
|
p.log.info(`Using ${pc.cyan(pm)} as package manager`);
|
|
2031
2095
|
const s2 = p.spinner();
|
|
2032
2096
|
s2.start("Installing dependencies");
|