@ahmedrowaihi/8n 0.5.14 → 0.5.15
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/adapter.cjs +47 -0
- package/dist/index.mjs +9 -22
- package/package.json +2 -1
package/dist/adapter.cjs
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
let node_fs = require("node:fs");
|
|
2
|
+
let node_path = require("node:path");
|
|
3
|
+
|
|
4
|
+
//#region src/adapter.ts
|
|
5
|
+
const adapter = {
|
|
6
|
+
name: "8n",
|
|
7
|
+
modifyConfig(config, { phase }) {
|
|
8
|
+
if (phase !== "phase-production-build") return config;
|
|
9
|
+
const basePath = process.env.NEXT_BASE_PATH || "";
|
|
10
|
+
const staticExport = process.env.NEXT_STATIC_EXPORT === "true";
|
|
11
|
+
return {
|
|
12
|
+
...config,
|
|
13
|
+
...staticExport ? {
|
|
14
|
+
output: "export",
|
|
15
|
+
trailingSlash: true
|
|
16
|
+
} : {},
|
|
17
|
+
...basePath ? {
|
|
18
|
+
basePath,
|
|
19
|
+
assetPrefix: basePath
|
|
20
|
+
} : {}
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
async onBuildComplete({ projectDir }) {
|
|
24
|
+
const docsProjectDir = process.env.DOCS_PROJECT_DIR;
|
|
25
|
+
const staticExport = process.env.NEXT_STATIC_EXPORT === "true";
|
|
26
|
+
if (!docsProjectDir || !staticExport) return;
|
|
27
|
+
const src = (0, node_path.join)(projectDir, "out");
|
|
28
|
+
const dest = (0, node_path.join)(docsProjectDir, "out");
|
|
29
|
+
if ((0, node_fs.existsSync)(dest)) (0, node_fs.rmSync)(dest, {
|
|
30
|
+
recursive: true,
|
|
31
|
+
force: true
|
|
32
|
+
});
|
|
33
|
+
try {
|
|
34
|
+
(0, node_fs.renameSync)(src, dest);
|
|
35
|
+
} catch (err) {
|
|
36
|
+
if (err.code !== "EXDEV") throw err;
|
|
37
|
+
(0, node_fs.cpSync)(src, dest, { recursive: true });
|
|
38
|
+
(0, node_fs.rmSync)(src, {
|
|
39
|
+
recursive: true,
|
|
40
|
+
force: true
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
module.exports = adapter;
|
|
46
|
+
|
|
47
|
+
//#endregion
|
package/dist/index.mjs
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
import { builtinModules, createRequire } from "node:module";
|
|
3
3
|
import { spawn } from "node:child_process";
|
|
4
4
|
import path, { delimiter, dirname, join, normalize, resolve } from "node:path";
|
|
5
|
-
import fs, { appendFileSync, cpSync, existsSync, mkdirSync, promises, readFileSync, readdirSync, realpathSync,
|
|
5
|
+
import fs, { appendFileSync, cpSync, existsSync, mkdirSync, promises, readFileSync, readdirSync, realpathSync, rmSync, statSync, watch, writeFileSync } from "node:fs";
|
|
6
6
|
import process$1, { cwd } from "node:process";
|
|
7
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
7
8
|
import { readFile, rm, writeFile } from "node:fs/promises";
|
|
8
9
|
import { homedir } from "node:os";
|
|
9
10
|
import { parseTarGzip } from "nanotar";
|
|
10
11
|
import { PassThrough } from "node:stream";
|
|
11
12
|
import c from "node:readline";
|
|
12
13
|
import { createJiti } from "jiti";
|
|
13
|
-
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
14
14
|
import assert from "node:assert";
|
|
15
15
|
import v8 from "node:v8";
|
|
16
16
|
import { format, inspect } from "node:util";
|
|
@@ -15147,7 +15147,7 @@ async function checkSelfUpdate() {
|
|
|
15147
15147
|
});
|
|
15148
15148
|
if (!res.ok) return;
|
|
15149
15149
|
const { version: latest } = await res.json();
|
|
15150
|
-
const current = "0.5.
|
|
15150
|
+
const current = "0.5.15";
|
|
15151
15151
|
if (latest !== current) console.log(import_picocolors.default.yellow("⚠") + import_picocolors.default.dim(` new CLI version available: `) + import_picocolors.default.cyan(latest) + import_picocolors.default.dim(` (current: ${current}) — run `) + import_picocolors.default.cyan("npm i -g @ahmedrowaihi/8n") + import_picocolors.default.dim(" to update"));
|
|
15152
15152
|
} catch {}
|
|
15153
15153
|
}
|
|
@@ -15255,6 +15255,7 @@ async function runNext(sudocsDir, cmd, env) {
|
|
|
15255
15255
|
env
|
|
15256
15256
|
} });
|
|
15257
15257
|
}
|
|
15258
|
+
const adapterPath = join(dirname(fileURLToPath(import.meta.url)), "adapter.cjs");
|
|
15258
15259
|
function buildEnv({ config, contentDir, staticExport = false }) {
|
|
15259
15260
|
const ghRepo = process.env.GITHUB_REPOSITORY;
|
|
15260
15261
|
const ghServer = process.env.GITHUB_SERVER_URL ?? "https://github.com";
|
|
@@ -15270,7 +15271,9 @@ function buildEnv({ config, contentDir, staticExport = false }) {
|
|
|
15270
15271
|
NEXT_PUBLIC_NAV_LINKS: JSON.stringify(config.nav?.links ?? []),
|
|
15271
15272
|
NEXT_PUBLIC_ANIMATIONS: config.animations === false ? "false" : "true",
|
|
15272
15273
|
NEXT_BASE_PATH: config.basePath ?? ghPagesBasePath ?? "",
|
|
15273
|
-
NEXT_STATIC_EXPORT: staticExport ? "true" : "false"
|
|
15274
|
+
NEXT_STATIC_EXPORT: staticExport ? "true" : "false",
|
|
15275
|
+
NEXT_ADAPTER_PATH: adapterPath,
|
|
15276
|
+
DOCS_PROJECT_DIR: process.cwd()
|
|
15274
15277
|
};
|
|
15275
15278
|
}
|
|
15276
15279
|
|
|
@@ -15326,23 +15329,7 @@ async function build() {
|
|
|
15326
15329
|
contentDir,
|
|
15327
15330
|
staticExport: true
|
|
15328
15331
|
}));
|
|
15329
|
-
|
|
15330
|
-
const outDir = join(process.cwd(), "out");
|
|
15331
|
-
if (existsSync(outDir)) rmSync(outDir, {
|
|
15332
|
-
recursive: true,
|
|
15333
|
-
force: true
|
|
15334
|
-
});
|
|
15335
|
-
try {
|
|
15336
|
-
renameSync(src, outDir);
|
|
15337
|
-
} catch (err) {
|
|
15338
|
-
if (err.code !== "EXDEV") throw err;
|
|
15339
|
-
cpSync(src, outDir, { recursive: true });
|
|
15340
|
-
rmSync(src, {
|
|
15341
|
-
recursive: true,
|
|
15342
|
-
force: true
|
|
15343
|
-
});
|
|
15344
|
-
}
|
|
15345
|
-
console.log(import_picocolors.default.green("✓") + import_picocolors.default.dim(` build complete → ${outDir}`));
|
|
15332
|
+
console.log(import_picocolors.default.green("✓") + import_picocolors.default.dim(` build complete → out/`));
|
|
15346
15333
|
}
|
|
15347
15334
|
|
|
15348
15335
|
//#endregion
|
|
@@ -15521,7 +15508,7 @@ async function prune() {
|
|
|
15521
15508
|
|
|
15522
15509
|
//#endregion
|
|
15523
15510
|
//#region src/index.ts
|
|
15524
|
-
const program = new Command().name("8n").description("Run your Thmanyah docs site").version("0.5.
|
|
15511
|
+
const program = new Command().name("8n").description("Run your Thmanyah docs site").version("0.5.15").addOption(new Option("--debug").hideHelp()).hook("preAction", (cmd) => {
|
|
15525
15512
|
if (cmd.opts().debug) process.env.DEBUG_8N = "1";
|
|
15526
15513
|
});
|
|
15527
15514
|
program.command("init").description("Scaffold a new docs project in the current directory").action(init);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ahmedrowaihi/8n",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.15",
|
|
4
4
|
"description": "Thmanyah Docs — run your docs site from your content directory",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"@types/node": "^22.0.0",
|
|
26
26
|
"c12": "^2.0.0",
|
|
27
27
|
"commander": "^14.0.0",
|
|
28
|
+
"next": "^16.2.0",
|
|
28
29
|
"nypm": "^0.3.0",
|
|
29
30
|
"picocolors": "^1.1.0",
|
|
30
31
|
"tinyexec": "^1.0.0",
|