@ahmedrowaihi/8n 0.5.1 → 0.5.3
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 +78 -10
- package/package.json +8 -8
package/dist/index.mjs
CHANGED
|
@@ -15048,7 +15048,7 @@ const preprocessType = ZodEffects.createWithPreprocess;
|
|
|
15048
15048
|
const pipelineType = ZodPipeline.create;
|
|
15049
15049
|
|
|
15050
15050
|
//#endregion
|
|
15051
|
-
//#region ../core/
|
|
15051
|
+
//#region ../core/src/config.ts
|
|
15052
15052
|
var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
|
|
15053
15053
|
const configSchema = objectType({
|
|
15054
15054
|
content: stringType().default("./content"),
|
|
@@ -15081,6 +15081,49 @@ async function resolveConfig() {
|
|
|
15081
15081
|
//#endregion
|
|
15082
15082
|
//#region src/web-app.ts
|
|
15083
15083
|
const STARTER_PACKAGE = "@ahmedrowaihi/8n-starter";
|
|
15084
|
+
const FRAMES = [
|
|
15085
|
+
"⠋",
|
|
15086
|
+
"⠙",
|
|
15087
|
+
"⠹",
|
|
15088
|
+
"⠸",
|
|
15089
|
+
"⠼",
|
|
15090
|
+
"⠴",
|
|
15091
|
+
"⠦",
|
|
15092
|
+
"⠧",
|
|
15093
|
+
"⠇",
|
|
15094
|
+
"⠏"
|
|
15095
|
+
];
|
|
15096
|
+
function spinner(text) {
|
|
15097
|
+
if (!process.stdout.isTTY) {
|
|
15098
|
+
process.stdout.write(import_picocolors.default.dim(` ${text}...\n`));
|
|
15099
|
+
return {
|
|
15100
|
+
succeed(msg) {
|
|
15101
|
+
process.stdout.write(import_picocolors.default.green("✓") + import_picocolors.default.dim(` ${msg}\n`));
|
|
15102
|
+
},
|
|
15103
|
+
fail(msg) {
|
|
15104
|
+
process.stdout.write(import_picocolors.default.red("✗") + ` ${msg}\n`);
|
|
15105
|
+
}
|
|
15106
|
+
};
|
|
15107
|
+
}
|
|
15108
|
+
let i = 0;
|
|
15109
|
+
const id = setInterval(() => {
|
|
15110
|
+
process.stdout.write(`\r${import_picocolors.default.cyan(FRAMES[i++ % FRAMES.length])} ${import_picocolors.default.dim(text)}`);
|
|
15111
|
+
}, 80);
|
|
15112
|
+
function clear() {
|
|
15113
|
+
clearInterval(id);
|
|
15114
|
+
process.stdout.clearLine?.(0);
|
|
15115
|
+
}
|
|
15116
|
+
return {
|
|
15117
|
+
succeed(msg) {
|
|
15118
|
+
clear();
|
|
15119
|
+
process.stdout.write(`\r${import_picocolors.default.green("✓")} ${import_picocolors.default.dim(msg)}\n`);
|
|
15120
|
+
},
|
|
15121
|
+
fail(msg) {
|
|
15122
|
+
clear();
|
|
15123
|
+
process.stdout.write(`\r${import_picocolors.default.red("✗")} ${msg}\n`);
|
|
15124
|
+
}
|
|
15125
|
+
};
|
|
15126
|
+
}
|
|
15084
15127
|
function getCacheBase() {
|
|
15085
15128
|
if (process.platform === "win32") return join(process.env.LOCALAPPDATA ?? join(homedir(), "AppData", "Local"), "8n");
|
|
15086
15129
|
return join(process.env.XDG_CACHE_HOME ?? join(homedir(), ".cache"), "8n");
|
|
@@ -15103,7 +15146,7 @@ async function checkSelfUpdate() {
|
|
|
15103
15146
|
});
|
|
15104
15147
|
if (!res.ok) return;
|
|
15105
15148
|
const { version: latest } = await res.json();
|
|
15106
|
-
const current = "0.5.
|
|
15149
|
+
const current = "0.5.3";
|
|
15107
15150
|
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"));
|
|
15108
15151
|
} catch {}
|
|
15109
15152
|
}
|
|
@@ -15134,23 +15177,48 @@ async function prepareSudocs(options) {
|
|
|
15134
15177
|
};
|
|
15135
15178
|
const latestVersion = options?.version ?? await getLatestVersion();
|
|
15136
15179
|
const sudocsDir = getGlobalCacheDir(latestVersion);
|
|
15137
|
-
if (existsSync(join(sudocsDir, "
|
|
15180
|
+
if (existsSync(join(sudocsDir, "node_modules"))) return {
|
|
15138
15181
|
updated: false,
|
|
15139
15182
|
version: latestVersion,
|
|
15140
15183
|
dir: sudocsDir
|
|
15141
15184
|
};
|
|
15142
|
-
|
|
15143
|
-
|
|
15144
|
-
|
|
15145
|
-
|
|
15146
|
-
}
|
|
15185
|
+
const dlSpin = spinner(`downloading starter ${latestVersion}`);
|
|
15186
|
+
try {
|
|
15187
|
+
await downloadAndExtract(latestVersion, sudocsDir);
|
|
15188
|
+
dlSpin.succeed(`downloaded starter ${latestVersion}`);
|
|
15189
|
+
} catch (err) {
|
|
15190
|
+
dlSpin.fail(`download failed: ${err.message}`);
|
|
15191
|
+
throw err;
|
|
15192
|
+
}
|
|
15193
|
+
const installSpin = spinner("installing dependencies");
|
|
15194
|
+
try {
|
|
15195
|
+
await R("npm", existsSync(join(sudocsDir, "package-lock.json")) ? [
|
|
15196
|
+
"ci",
|
|
15197
|
+
"--prefer-offline",
|
|
15198
|
+
"--no-audit",
|
|
15199
|
+
"--no-fund",
|
|
15200
|
+
"--legacy-peer-deps"
|
|
15201
|
+
] : [
|
|
15202
|
+
"install",
|
|
15203
|
+
"--prefer-offline",
|
|
15204
|
+
"--no-audit",
|
|
15205
|
+
"--no-fund",
|
|
15206
|
+
"--legacy-peer-deps"
|
|
15207
|
+
], { nodeOptions: {
|
|
15208
|
+
cwd: sudocsDir,
|
|
15209
|
+
stdio: process.env.DEBUG_8N ? "inherit" : "pipe"
|
|
15210
|
+
} });
|
|
15211
|
+
installSpin.succeed("dependencies installed");
|
|
15212
|
+
} catch (err) {
|
|
15213
|
+
installSpin.fail(`install failed: ${err.message}`);
|
|
15214
|
+
throw err;
|
|
15215
|
+
}
|
|
15147
15216
|
return {
|
|
15148
15217
|
updated: true,
|
|
15149
15218
|
version: latestVersion,
|
|
15150
15219
|
dir: sudocsDir
|
|
15151
15220
|
};
|
|
15152
15221
|
}
|
|
15153
|
-
/** Returns path to a binary in node_modules/.bin/ of the given dir */
|
|
15154
15222
|
function getSudocsBin(sudocsDir, name) {
|
|
15155
15223
|
return join(sudocsDir, "node_modules", ".bin", name);
|
|
15156
15224
|
}
|
|
@@ -15365,7 +15433,7 @@ async function init() {
|
|
|
15365
15433
|
|
|
15366
15434
|
//#endregion
|
|
15367
15435
|
//#region src/index.ts
|
|
15368
|
-
const program = new Command().name("8n").description("Run your Thmanyah docs site").version("0.5.
|
|
15436
|
+
const program = new Command().name("8n").description("Run your Thmanyah docs site").version("0.5.3").addOption(new Option("--debug").hideHelp()).hook("preAction", (cmd) => {
|
|
15369
15437
|
if (cmd.opts().debug) process.env.DEBUG_8N = "1";
|
|
15370
15438
|
});
|
|
15371
15439
|
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.3",
|
|
4
4
|
"description": "Thmanyah Docs — run your docs site from your content directory",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
"exports": {
|
|
10
10
|
".": "./dist/index.mjs"
|
|
11
11
|
},
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsdown",
|
|
14
|
+
"dev": "tsdown --watch"
|
|
15
|
+
},
|
|
12
16
|
"files": [
|
|
13
17
|
"dist"
|
|
14
18
|
],
|
|
@@ -17,17 +21,13 @@
|
|
|
17
21
|
"nanotar": "^0.3.0"
|
|
18
22
|
},
|
|
19
23
|
"devDependencies": {
|
|
24
|
+
"@ahmedrowaihi/8n-core": "workspace:*",
|
|
20
25
|
"@types/node": "^22.0.0",
|
|
21
26
|
"c12": "^2.0.0",
|
|
22
27
|
"commander": "^14.0.0",
|
|
23
28
|
"nypm": "^0.3.0",
|
|
24
29
|
"picocolors": "^1.1.0",
|
|
25
30
|
"tinyexec": "^1.0.0",
|
|
26
|
-
"tsdown": "^0.20.0"
|
|
27
|
-
"@ahmedrowaihi/8n-core": "0.2.0"
|
|
28
|
-
},
|
|
29
|
-
"scripts": {
|
|
30
|
-
"build": "tsdown",
|
|
31
|
-
"dev": "tsdown --watch"
|
|
31
|
+
"tsdown": "^0.20.0"
|
|
32
32
|
}
|
|
33
|
-
}
|
|
33
|
+
}
|