@ahmedrowaihi/8n 6.0.21 → 6.0.24
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/index.mjs +63 -15
- package/package.json +1 -1
- package/starter/next.config.mjs +6 -0
- package/starter/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command, Option } from "commander";
|
|
3
3
|
import pc from "picocolors";
|
|
4
|
-
import { basename, dirname, extname, join, relative, resolve } from "node:path";
|
|
4
|
+
import { basename, dirname, extname, join, relative, resolve, sep } from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
import { appendFileSync, cpSync, existsSync, mkdirSync, readFileSync, readdirSync, watch, writeFileSync } from "node:fs";
|
|
7
7
|
import { x } from "tinyexec";
|
|
@@ -3674,7 +3674,7 @@ async function checkSelfUpdate() {
|
|
|
3674
3674
|
});
|
|
3675
3675
|
if (!res.ok) return;
|
|
3676
3676
|
const { version: latest } = await res.json();
|
|
3677
|
-
const current = "6.0.
|
|
3677
|
+
const current = "6.0.24";
|
|
3678
3678
|
if (latest !== current) console.log(pc.yellow("⚠") + pc.dim(` new version available: `) + pc.cyan(latest) + pc.dim(` (current: ${current}) — run `) + pc.cyan("npm i -g @ahmedrowaihi/8n") + pc.dim(" to update"));
|
|
3679
3679
|
} catch {}
|
|
3680
3680
|
}
|
|
@@ -3725,13 +3725,50 @@ async function resolveProject() {
|
|
|
3725
3725
|
contentDir: resolve(process.cwd(), config.content ?? "./content")
|
|
3726
3726
|
};
|
|
3727
3727
|
}
|
|
3728
|
-
async function runNext(cmd, env) {
|
|
3729
|
-
await x(getNextBin(), [cmd], { nodeOptions: {
|
|
3728
|
+
async function runNext(cmd, env, flags = []) {
|
|
3729
|
+
await x(getNextBin(), [cmd, ...flags], { nodeOptions: {
|
|
3730
3730
|
cwd: getStarterDir(),
|
|
3731
3731
|
stdio: "inherit",
|
|
3732
3732
|
env
|
|
3733
3733
|
} });
|
|
3734
3734
|
}
|
|
3735
|
+
function getProjectBuildDir(projectDir) {
|
|
3736
|
+
return join(projectDir, ".8n");
|
|
3737
|
+
}
|
|
3738
|
+
async function copyStarterToProject(projectDir) {
|
|
3739
|
+
const starterDir = getStarterDir();
|
|
3740
|
+
const buildDir = getProjectBuildDir(projectDir);
|
|
3741
|
+
const spin = spinner("preparing build environment");
|
|
3742
|
+
try {
|
|
3743
|
+
cpSync(starterDir, buildDir, {
|
|
3744
|
+
recursive: true,
|
|
3745
|
+
force: true,
|
|
3746
|
+
filter: (src) => {
|
|
3747
|
+
const rel = src.slice(starterDir.length);
|
|
3748
|
+
return !rel.startsWith(sep + "node_modules") && !rel.startsWith(sep + ".next") && !rel.startsWith(sep + "out");
|
|
3749
|
+
}
|
|
3750
|
+
});
|
|
3751
|
+
await x("npm", [
|
|
3752
|
+
"install",
|
|
3753
|
+
"--legacy-peer-deps",
|
|
3754
|
+
"--include=dev"
|
|
3755
|
+
], { nodeOptions: {
|
|
3756
|
+
cwd: buildDir,
|
|
3757
|
+
stdio: process.env.DEBUG_8N ? "inherit" : "pipe"
|
|
3758
|
+
} });
|
|
3759
|
+
spin.succeed("build environment ready");
|
|
3760
|
+
} catch (err) {
|
|
3761
|
+
spin.fail(`setup failed: ${err.message}`);
|
|
3762
|
+
throw err;
|
|
3763
|
+
}
|
|
3764
|
+
}
|
|
3765
|
+
async function runNextIn(dir, cmd, env, flags = []) {
|
|
3766
|
+
await x(join(dir, "node_modules", ".bin", "next"), [cmd, ...flags], { nodeOptions: {
|
|
3767
|
+
cwd: dir,
|
|
3768
|
+
stdio: "inherit",
|
|
3769
|
+
env
|
|
3770
|
+
} });
|
|
3771
|
+
}
|
|
3735
3772
|
const adapterPath = join(dirname(fileURLToPath(import.meta.url)), "adapter.cjs");
|
|
3736
3773
|
function buildEnv({ config, contentDir, staticExport = false }) {
|
|
3737
3774
|
const ghRepo = process.env.GITHUB_REPOSITORY;
|
|
@@ -3773,14 +3810,24 @@ async function dev() {
|
|
|
3773
3810
|
//#region src/commands/build.ts
|
|
3774
3811
|
async function build({ server = false } = {}) {
|
|
3775
3812
|
const { config, contentDir } = await resolveProject();
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
syncPublicDir(
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3813
|
+
const projectDir = process.cwd();
|
|
3814
|
+
console.log(pc.cyan("8n") + pc.dim(` v6.0.24 build → ${contentDir}`));
|
|
3815
|
+
syncPublicDir(projectDir);
|
|
3816
|
+
if (server) {
|
|
3817
|
+
await copyStarterToProject(projectDir);
|
|
3818
|
+
await runNextIn(getProjectBuildDir(projectDir), "build", buildEnv({
|
|
3819
|
+
config,
|
|
3820
|
+
contentDir,
|
|
3821
|
+
staticExport: false
|
|
3822
|
+
}));
|
|
3823
|
+
} else {
|
|
3824
|
+
await ensureDepsInstalled();
|
|
3825
|
+
await runNext("build", buildEnv({
|
|
3826
|
+
config,
|
|
3827
|
+
contentDir,
|
|
3828
|
+
staticExport: true
|
|
3829
|
+
}));
|
|
3830
|
+
}
|
|
3784
3831
|
console.log(pc.green("✓") + pc.dim(` build complete → ${server ? ".next/" : "out/"}`));
|
|
3785
3832
|
}
|
|
3786
3833
|
|
|
@@ -3875,7 +3922,8 @@ const GITIGNORE_ENTRIES = [
|
|
|
3875
3922
|
"node_modules",
|
|
3876
3923
|
"package-lock.json",
|
|
3877
3924
|
"out",
|
|
3878
|
-
".next"
|
|
3925
|
+
".next",
|
|
3926
|
+
".8n"
|
|
3879
3927
|
];
|
|
3880
3928
|
function isDirEmpty(dir) {
|
|
3881
3929
|
if (!existsSync(dir)) return true;
|
|
@@ -3971,7 +4019,7 @@ async function mcp() {
|
|
|
3971
4019
|
const mcpDir = join(getStarterDir(), "content", "mcp", "en");
|
|
3972
4020
|
const server = new McpServer({
|
|
3973
4021
|
name: "8n",
|
|
3974
|
-
version: "6.0.
|
|
4022
|
+
version: "6.0.24"
|
|
3975
4023
|
});
|
|
3976
4024
|
server.registerTool("read_me", {
|
|
3977
4025
|
description: "Returns how to use the 8n MCP tools. Call this BEFORE documenting anything with 8n.",
|
|
@@ -4112,7 +4160,7 @@ Example: get_component({ name: "components" }) returns all available MDX compone
|
|
|
4112
4160
|
|
|
4113
4161
|
//#endregion
|
|
4114
4162
|
//#region src/index.ts
|
|
4115
|
-
const program = new Command().name("8n").description("Run your 8n docs site").version("6.0.
|
|
4163
|
+
const program = new Command().name("8n").description("Run your 8n docs site").version("6.0.24").addOption(new Option("--debug").hideHelp()).hook("preAction", (cmd) => {
|
|
4116
4164
|
if (cmd.opts().debug) process.env.DEBUG_8N = "1";
|
|
4117
4165
|
});
|
|
4118
4166
|
program.command("init").description("Scaffold a new docs project in the current directory").action(init);
|
package/package.json
CHANGED
package/starter/next.config.mjs
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
/** @type {import('next').NextConfig} */
|
|
2
|
+
const staticExport = process.env.NEXT_STATIC_EXPORT === "true";
|
|
3
|
+
const basePath = process.env.NEXT_BASE_PATH || "";
|
|
4
|
+
|
|
2
5
|
const config = {
|
|
3
6
|
turbopack: {
|
|
4
7
|
root: import.meta.dirname,
|
|
@@ -11,6 +14,9 @@ const config = {
|
|
|
11
14
|
images: {
|
|
12
15
|
unoptimized: true,
|
|
13
16
|
},
|
|
17
|
+
|
|
18
|
+
...(staticExport ? { output: "export", trailingSlash: true } : {}),
|
|
19
|
+
...(basePath ? { basePath, assetPrefix: basePath } : {}),
|
|
14
20
|
};
|
|
15
21
|
|
|
16
22
|
export default config;
|
package/starter/package.json
CHANGED