@farming-labs/next 0.0.57 → 0.0.59
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/config.mjs +11 -5
- package/package.json +3 -3
package/dist/config.mjs
CHANGED
|
@@ -93,6 +93,14 @@ const FILE_EXTS = [
|
|
|
93
93
|
function hasFile(root, baseName) {
|
|
94
94
|
return FILE_EXTS.some((ext) => existsSync(join(root, `${baseName}.${ext}`)));
|
|
95
95
|
}
|
|
96
|
+
function isManagedGeneratedFile(filePath) {
|
|
97
|
+
if (!existsSync(filePath)) return false;
|
|
98
|
+
try {
|
|
99
|
+
return readFileSync(filePath, "utf-8").startsWith(GENERATED_BANNER);
|
|
100
|
+
} catch {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
96
104
|
/** Read the docs entry path from docs.config.ts[x] (defaults to "docs"). */
|
|
97
105
|
function readDocsEntry(root) {
|
|
98
106
|
for (const ext of FILE_EXTS) {
|
|
@@ -177,11 +185,9 @@ function withDocs(nextConfig = {}) {
|
|
|
177
185
|
const entry = readDocsEntry(root);
|
|
178
186
|
const appDir = getNextAppDir(root);
|
|
179
187
|
const layoutDir = join(root, appDir, entry);
|
|
180
|
-
if (existsSync(layoutDir)
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
writeFileSync(join(layoutDir, "layout.tsx"), DOCS_LAYOUT_TEMPLATE);
|
|
184
|
-
}
|
|
188
|
+
if (!existsSync(layoutDir)) mkdirSync(layoutDir, { recursive: true });
|
|
189
|
+
const docsLayoutPath = join(layoutDir, "layout.tsx");
|
|
190
|
+
if (!hasFile(layoutDir, "layout") || isManagedGeneratedFile(docsLayoutPath)) writeFileSync(join(layoutDir, "layout.tsx"), DOCS_LAYOUT_TEMPLATE);
|
|
185
191
|
const isStaticExport = nextConfig.output === "export";
|
|
186
192
|
const docsApiRouteDir = join(root, appDir, "api", "docs");
|
|
187
193
|
if (!isStaticExport && !hasFile(docsApiRouteDir, "route")) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farming-labs/next",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.59",
|
|
4
4
|
"description": "Next.js adapter for @farming-labs/docs — MDX config wrapper",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -79,8 +79,8 @@
|
|
|
79
79
|
"tsdown": "^0.20.3",
|
|
80
80
|
"typescript": "^5.9.3",
|
|
81
81
|
"vitest": "^3.2.4",
|
|
82
|
-
"@farming-labs/docs": "0.0.
|
|
83
|
-
"@farming-labs/theme": "0.0.
|
|
82
|
+
"@farming-labs/docs": "0.0.59",
|
|
83
|
+
"@farming-labs/theme": "0.0.59"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
86
|
"@farming-labs/docs": ">=0.0.1",
|