@farming-labs/docs 0.2.61 → 0.2.62
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/package.json +1 -1
- package/dist/agent-DFHlw_JC.mjs +0 -624
- package/dist/agent-Fl0pjVNF.mjs +0 -4352
- package/dist/agent-evals-f4_OL10T.mjs +0 -2144
- package/dist/agent-export-D0zQhasD.mjs +0 -910
- package/dist/agent-scope-C_U--OZ7.mjs +0 -283
- package/dist/agent-skills-bundle.d.mts +0 -13
- package/dist/agent-skills-bundle.mjs +0 -12
- package/dist/agent-skills-server-CIeBszxp.mjs +0 -263
- package/dist/agent-skills-server-CKq3_jMj.d.mts +0 -12
- package/dist/agent-skills-vite.d.mts +0 -31
- package/dist/agent-skills-vite.mjs +0 -70
- package/dist/agents-ibnXrWyp.mjs +0 -221
- package/dist/analytics-Bx44lg6d.mjs +0 -177
- package/dist/cli/index.d.mts +0 -15
- package/dist/cli/index.mjs +0 -452
- package/dist/client/react.d.mts +0 -45
- package/dist/client/react.mjs +0 -223
- package/dist/cloud-analytics-CSyFE6SS.mjs +0 -132
- package/dist/cloud-ask-ai-D7ZgF47y.d.mts +0 -23
- package/dist/cloud-ask-ai-sbpjOR2K.mjs +0 -382
- package/dist/cloud-pdNC-tyj.mjs +0 -1615
- package/dist/code-blocks-DnNVNK2M.mjs +0 -871
- package/dist/codeblocks-CFuurVIH.mjs +0 -250
- package/dist/config-Wcdj-D0a.mjs +0 -369
- package/dist/dev-Cmy6DtdF.mjs +0 -1333
- package/dist/docs-cloud-server.d.mts +0 -70
- package/dist/docs-cloud-server.mjs +0 -310
- package/dist/doctor-CXostbsI.mjs +0 -2036
- package/dist/downgrade-w7e6Se0L.mjs +0 -184
- package/dist/errors-DbOhkE1h.mjs +0 -20
- package/dist/golden-evaluations-CBZ_JZjf.mjs +0 -1498
- package/dist/i18n-CCaFUnAN.mjs +0 -40
- package/dist/index.d.mts +0 -1141
- package/dist/index.mjs +0 -10
- package/dist/init-CQY0Woe3.mjs +0 -1264
- package/dist/mcp-DyPcoLwm.mjs +0 -156
- package/dist/mcp.d.mts +0 -298
- package/dist/mcp.mjs +0 -4426
- package/dist/metadata-Dv1ah0Aj.mjs +0 -237
- package/dist/package-version-n5AFur8a.mjs +0 -128
- package/dist/reading-time-C-SAhQT9.mjs +0 -742
- package/dist/review-D2UBrxFq.mjs +0 -673
- package/dist/robots-5Yqz9mz7.mjs +0 -179
- package/dist/robots-C08kDLsz.mjs +0 -201
- package/dist/search-9OnMGMvt.mjs +0 -1758
- package/dist/search-C6heDO8h.d.mts +0 -274
- package/dist/search-CNsRpz90.mjs +0 -104
- package/dist/server.d.mts +0 -342
- package/dist/server.mjs +0 -13
- package/dist/sitemap-BpYnSsfJ.mjs +0 -249
- package/dist/sitemap-server-D_0Kzanj.mjs +0 -1137
- package/dist/standards-discovery-C4HUqMd2.d.mts +0 -227
- package/dist/standards-discovery-C54V_aJH.mjs +0 -510
- package/dist/templates-Bq_P7ctv.mjs +0 -2465
- package/dist/types-EhFhYGfr.d.mts +0 -3305
- package/dist/upgrade-oz-GChgt.mjs +0 -56
- package/dist/utils-DpiIioYb.mjs +0 -225
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { c as fileExists, o as exec } from "./utils-DpiIioYb.mjs";
|
|
2
|
-
import { a as getPackagesForFramework, c as resolveDocsPackageManager, i as frameworkFromPreset, l as validateUpgradeVersion, n as PRESETS, o as presetFromFramework, r as buildDocsPackageInstallCommand, s as resolveDocsPackageFramework, t as PACKAGES_BY_FRAMEWORK } from "./package-version-n5AFur8a.mjs";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import pc from "picocolors";
|
|
5
|
-
import * as p from "@clack/prompts";
|
|
6
|
-
|
|
7
|
-
//#region src/cli/upgrade.ts
|
|
8
|
-
/**
|
|
9
|
-
* Upgrade @farming-labs/* packages to a dist-tag or exact version.
|
|
10
|
-
* Detects framework from package.json by default, or use --framework (next, tanstack-start, nuxt, sveltekit, astro).
|
|
11
|
-
*/
|
|
12
|
-
function resolveUpgradeTarget(options) {
|
|
13
|
-
if (options.version !== void 0) return validateUpgradeVersion(options.version);
|
|
14
|
-
return options.tag ?? "latest";
|
|
15
|
-
}
|
|
16
|
-
/** Build the install command for upgrade (for testing). */
|
|
17
|
-
function buildUpgradeCommand(framework, target, pm) {
|
|
18
|
-
return buildDocsPackageInstallCommand(framework, target, pm);
|
|
19
|
-
}
|
|
20
|
-
async function upgrade(options = {}) {
|
|
21
|
-
const cwd = process.cwd();
|
|
22
|
-
p.intro(pc.bgCyan(pc.black(" @farming-labs/docs upgrade ")));
|
|
23
|
-
let target;
|
|
24
|
-
try {
|
|
25
|
-
target = resolveUpgradeTarget(options);
|
|
26
|
-
} catch (error) {
|
|
27
|
-
p.log.error(error instanceof Error ? error.message : "Invalid upgrade version.");
|
|
28
|
-
process.exit(1);
|
|
29
|
-
}
|
|
30
|
-
if (!fileExists(path.join(cwd, "package.json"))) {
|
|
31
|
-
p.log.error("No package.json found in the current directory. Run this from your project root.");
|
|
32
|
-
process.exit(1);
|
|
33
|
-
}
|
|
34
|
-
const { framework, preset } = resolveDocsPackageFramework(cwd, options.framework);
|
|
35
|
-
const pm = await resolveDocsPackageManager(cwd, "upgrade");
|
|
36
|
-
const cmd = buildUpgradeCommand(framework, target, pm);
|
|
37
|
-
const packages = getPackagesForFramework(framework);
|
|
38
|
-
p.log.step(`Upgrading ${preset} docs packages to ${target}...`);
|
|
39
|
-
p.log.message(pc.dim(packages.join(", ")));
|
|
40
|
-
if (options.dryRun) {
|
|
41
|
-
p.log.info("Dry run. Would run:\n " + pc.cyan(cmd));
|
|
42
|
-
p.outro(pc.green("Dry run complete. No changes made."));
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
try {
|
|
46
|
-
exec(cmd, cwd);
|
|
47
|
-
p.log.success(`Packages upgraded to ${target}.`);
|
|
48
|
-
p.outro(pc.green("Done. Run your dev server to confirm everything works."));
|
|
49
|
-
} catch {
|
|
50
|
-
p.log.error("Upgrade failed. Try running manually:\n " + pc.cyan(cmd));
|
|
51
|
-
process.exit(1);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
//#endregion
|
|
56
|
-
export { upgrade };
|
package/dist/utils-DpiIioYb.mjs
DELETED
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { execSync, spawn } from "node:child_process";
|
|
4
|
-
|
|
5
|
-
//#region src/cli/utils.ts
|
|
6
|
-
function detectFramework(cwd) {
|
|
7
|
-
const pkgPath = path.join(cwd, "package.json");
|
|
8
|
-
if (!fs.existsSync(pkgPath)) return null;
|
|
9
|
-
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
|
10
|
-
const allDeps = {
|
|
11
|
-
...pkg.dependencies,
|
|
12
|
-
...pkg.devDependencies
|
|
13
|
-
};
|
|
14
|
-
if (allDeps["next"]) return "nextjs";
|
|
15
|
-
if (allDeps["@tanstack/react-start"]) return "tanstack-start";
|
|
16
|
-
if (allDeps["@sveltejs/kit"]) return "sveltekit";
|
|
17
|
-
if (allDeps["astro"]) return "astro";
|
|
18
|
-
if (allDeps["nuxt"]) return "nuxt";
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
const PACKAGE_MANAGER_LOCKFILES = [
|
|
22
|
-
{
|
|
23
|
-
fileName: "pnpm-lock.yaml",
|
|
24
|
-
packageManager: "pnpm"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
fileName: "bun.lockb",
|
|
28
|
-
packageManager: "bun"
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
fileName: "bun.lock",
|
|
32
|
-
packageManager: "bun"
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
fileName: "yarn.lock",
|
|
36
|
-
packageManager: "yarn"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
fileName: "package-lock.json",
|
|
40
|
-
packageManager: "npm"
|
|
41
|
-
}
|
|
42
|
-
];
|
|
43
|
-
function readPackageManagerName(value) {
|
|
44
|
-
if (typeof value !== "string") return null;
|
|
45
|
-
const name = value.trim().split("@")[0];
|
|
46
|
-
if (name === "pnpm" || name === "yarn" || name === "npm" || name === "bun") return name;
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
function detectPackageManagerLockfileInDirectory(directory) {
|
|
50
|
-
for (const { fileName, packageManager } of PACKAGE_MANAGER_LOCKFILES) {
|
|
51
|
-
const filePath = path.join(directory, fileName);
|
|
52
|
-
if (fs.existsSync(filePath)) return {
|
|
53
|
-
packageManager,
|
|
54
|
-
directory,
|
|
55
|
-
filePath,
|
|
56
|
-
source: "lockfile"
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
61
|
-
function detectPackageManagerInDirectory(directory) {
|
|
62
|
-
const lockfile = detectPackageManagerLockfileInDirectory(directory);
|
|
63
|
-
if (lockfile) return lockfile;
|
|
64
|
-
const packageJsonPath = path.join(directory, "package.json");
|
|
65
|
-
if (!fs.existsSync(packageJsonPath)) return null;
|
|
66
|
-
try {
|
|
67
|
-
const packageManager = readPackageManagerName(JSON.parse(fs.readFileSync(packageJsonPath, "utf-8")).packageManager);
|
|
68
|
-
if (!packageManager) return null;
|
|
69
|
-
return {
|
|
70
|
-
packageManager,
|
|
71
|
-
directory,
|
|
72
|
-
filePath: packageJsonPath,
|
|
73
|
-
source: "packageManager"
|
|
74
|
-
};
|
|
75
|
-
} catch {
|
|
76
|
-
return null;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
function detectPackageManagerFromProject(cwd) {
|
|
80
|
-
let current = path.resolve(cwd);
|
|
81
|
-
while (true) {
|
|
82
|
-
const detected = detectPackageManagerInDirectory(current);
|
|
83
|
-
if (detected) return detected;
|
|
84
|
-
const parent = path.dirname(current);
|
|
85
|
-
if (parent === current) return null;
|
|
86
|
-
current = parent;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
function formatPackageManagerDetection(cwd, detection) {
|
|
90
|
-
const displayPath = path.relative(path.resolve(cwd), detection.filePath) || path.basename(detection.filePath);
|
|
91
|
-
if (detection.source === "packageManager") return `packageManager in ${displayPath}`;
|
|
92
|
-
return displayPath;
|
|
93
|
-
}
|
|
94
|
-
function installCommand(pm) {
|
|
95
|
-
return pm === "yarn" ? "yarn add" : `${pm} add`;
|
|
96
|
-
}
|
|
97
|
-
function devInstallCommand(pm) {
|
|
98
|
-
if (pm === "yarn") return "yarn add -D";
|
|
99
|
-
if (pm === "npm") return "npm install -D";
|
|
100
|
-
return `${pm} add -D`;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Write a file, creating parent directories as needed.
|
|
104
|
-
* Returns true if the file was written, false if it already existed and was skipped.
|
|
105
|
-
*/
|
|
106
|
-
function writeFileSafe(filePath, content, overwrite = false) {
|
|
107
|
-
if (fs.existsSync(filePath) && !overwrite) return false;
|
|
108
|
-
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
109
|
-
fs.writeFileSync(filePath, content, "utf-8");
|
|
110
|
-
return true;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Check if a file exists.
|
|
114
|
-
*/
|
|
115
|
-
function fileExists(filePath) {
|
|
116
|
-
return fs.existsSync(filePath);
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Read a file, returning null if it does not exist.
|
|
120
|
-
*/
|
|
121
|
-
function readFileSafe(filePath) {
|
|
122
|
-
if (!fs.existsSync(filePath)) return null;
|
|
123
|
-
return fs.readFileSync(filePath, "utf-8");
|
|
124
|
-
}
|
|
125
|
-
/** Common locations where global CSS files live in Next.js / SvelteKit projects. */
|
|
126
|
-
const GLOBAL_CSS_CANDIDATES = [
|
|
127
|
-
"app/globals.css",
|
|
128
|
-
"app/global.css",
|
|
129
|
-
"src/app/globals.css",
|
|
130
|
-
"src/app/global.css",
|
|
131
|
-
"src/app.css",
|
|
132
|
-
"src/styles/app.css",
|
|
133
|
-
"styles/globals.css",
|
|
134
|
-
"styles/global.css",
|
|
135
|
-
"src/styles/globals.css",
|
|
136
|
-
"src/styles/global.css",
|
|
137
|
-
"assets/css/main.css",
|
|
138
|
-
"assets/main.css"
|
|
139
|
-
];
|
|
140
|
-
/**
|
|
141
|
-
* Find existing global CSS files in the project.
|
|
142
|
-
* Returns relative paths that exist.
|
|
143
|
-
*/
|
|
144
|
-
function detectGlobalCssFiles(cwd) {
|
|
145
|
-
return GLOBAL_CSS_CANDIDATES.filter((rel) => fs.existsSync(path.join(cwd, rel)));
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Detect whether the Next.js project uses `app` or `src/app` for the App Router.
|
|
149
|
-
* Returns the directory that exists; if both exist, prefers src/app; if neither, returns null.
|
|
150
|
-
*/
|
|
151
|
-
function detectNextAppDir(cwd) {
|
|
152
|
-
const hasSrcApp = fs.existsSync(path.join(cwd, "src", "app"));
|
|
153
|
-
const hasApp = fs.existsSync(path.join(cwd, "app"));
|
|
154
|
-
if (hasSrcApp) return "src/app";
|
|
155
|
-
if (hasApp) return "app";
|
|
156
|
-
return null;
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Run a shell command synchronously, inheriting stdio.
|
|
160
|
-
*/
|
|
161
|
-
function exec(command, cwd) {
|
|
162
|
-
execSync(command, {
|
|
163
|
-
cwd,
|
|
164
|
-
stdio: "inherit"
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Run a shell command synchronously and return stdout.
|
|
169
|
-
*/
|
|
170
|
-
function execOutput(command, cwd) {
|
|
171
|
-
return execSync(command, {
|
|
172
|
-
cwd,
|
|
173
|
-
encoding: "utf-8",
|
|
174
|
-
stdio: [
|
|
175
|
-
"ignore",
|
|
176
|
-
"pipe",
|
|
177
|
-
"pipe"
|
|
178
|
-
]
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Spawn a process and wait for a specific string in stdout,
|
|
183
|
-
* then resolve with the child process (still running).
|
|
184
|
-
*/
|
|
185
|
-
function spawnAndWaitFor(command, args, cwd, waitFor, timeoutMs = 6e4) {
|
|
186
|
-
return new Promise((resolve, reject) => {
|
|
187
|
-
const child = spawn(command, args, {
|
|
188
|
-
cwd,
|
|
189
|
-
stdio: [
|
|
190
|
-
"ignore",
|
|
191
|
-
"pipe",
|
|
192
|
-
"pipe"
|
|
193
|
-
],
|
|
194
|
-
shell: true
|
|
195
|
-
});
|
|
196
|
-
let output = "";
|
|
197
|
-
const timer = setTimeout(() => {
|
|
198
|
-
child.kill();
|
|
199
|
-
reject(/* @__PURE__ */ new Error(`Timed out waiting for "${waitFor}" after ${timeoutMs}ms`));
|
|
200
|
-
}, timeoutMs);
|
|
201
|
-
child.stdout?.on("data", (data) => {
|
|
202
|
-
const text = data.toString();
|
|
203
|
-
output += text;
|
|
204
|
-
process.stdout.write(text);
|
|
205
|
-
if (output.includes(waitFor)) {
|
|
206
|
-
clearTimeout(timer);
|
|
207
|
-
resolve(child);
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
child.stderr?.on("data", (data) => {
|
|
211
|
-
process.stderr.write(data.toString());
|
|
212
|
-
});
|
|
213
|
-
child.on("error", (err) => {
|
|
214
|
-
clearTimeout(timer);
|
|
215
|
-
reject(err);
|
|
216
|
-
});
|
|
217
|
-
child.on("close", (code) => {
|
|
218
|
-
clearTimeout(timer);
|
|
219
|
-
if (!output.includes(waitFor)) reject(/* @__PURE__ */ new Error(`Process exited with code ${code} before "${waitFor}" appeared`));
|
|
220
|
-
});
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
//#endregion
|
|
225
|
-
export { devInstallCommand as a, fileExists as c, readFileSafe as d, spawnAndWaitFor as f, detectPackageManagerFromProject as i, formatPackageManagerDetection as l, detectGlobalCssFiles as n, exec as o, writeFileSafe as p, detectNextAppDir as r, execOutput as s, detectFramework as t, installCommand as u };
|