@ahmedrowaihi/8n 0.5.1 → 0.5.2
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 +73 -9
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -15081,6 +15081,45 @@ 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
|
+
return {
|
|
15113
|
+
succeed(msg) {
|
|
15114
|
+
clearInterval(id);
|
|
15115
|
+
process.stdout.write(`\r${import_picocolors.default.green("✓")} ${import_picocolors.default.dim(msg)}\n`);
|
|
15116
|
+
},
|
|
15117
|
+
fail(msg) {
|
|
15118
|
+
clearInterval(id);
|
|
15119
|
+
process.stdout.write(`\r${import_picocolors.default.red("✗")} ${msg}\n`);
|
|
15120
|
+
}
|
|
15121
|
+
};
|
|
15122
|
+
}
|
|
15084
15123
|
function getCacheBase() {
|
|
15085
15124
|
if (process.platform === "win32") return join(process.env.LOCALAPPDATA ?? join(homedir(), "AppData", "Local"), "8n");
|
|
15086
15125
|
return join(process.env.XDG_CACHE_HOME ?? join(homedir(), ".cache"), "8n");
|
|
@@ -15103,7 +15142,7 @@ async function checkSelfUpdate() {
|
|
|
15103
15142
|
});
|
|
15104
15143
|
if (!res.ok) return;
|
|
15105
15144
|
const { version: latest } = await res.json();
|
|
15106
|
-
const current = "0.5.
|
|
15145
|
+
const current = "0.5.2";
|
|
15107
15146
|
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
15147
|
} catch {}
|
|
15109
15148
|
}
|
|
@@ -15134,23 +15173,48 @@ async function prepareSudocs(options) {
|
|
|
15134
15173
|
};
|
|
15135
15174
|
const latestVersion = options?.version ?? await getLatestVersion();
|
|
15136
15175
|
const sudocsDir = getGlobalCacheDir(latestVersion);
|
|
15137
|
-
if (existsSync(join(sudocsDir, "
|
|
15176
|
+
if (existsSync(join(sudocsDir, "node_modules"))) return {
|
|
15138
15177
|
updated: false,
|
|
15139
15178
|
version: latestVersion,
|
|
15140
15179
|
dir: sudocsDir
|
|
15141
15180
|
};
|
|
15142
|
-
|
|
15143
|
-
|
|
15144
|
-
|
|
15145
|
-
|
|
15146
|
-
}
|
|
15181
|
+
const dlSpin = spinner(`downloading starter ${latestVersion}`);
|
|
15182
|
+
try {
|
|
15183
|
+
await downloadAndExtract(latestVersion, sudocsDir);
|
|
15184
|
+
dlSpin.succeed(`downloaded starter ${latestVersion}`);
|
|
15185
|
+
} catch (err) {
|
|
15186
|
+
dlSpin.fail(`download failed: ${err.message}`);
|
|
15187
|
+
throw err;
|
|
15188
|
+
}
|
|
15189
|
+
const installSpin = spinner("installing dependencies");
|
|
15190
|
+
try {
|
|
15191
|
+
await R("npm", existsSync(join(sudocsDir, "package-lock.json")) ? [
|
|
15192
|
+
"ci",
|
|
15193
|
+
"--prefer-offline",
|
|
15194
|
+
"--no-audit",
|
|
15195
|
+
"--no-fund",
|
|
15196
|
+
"--legacy-peer-deps"
|
|
15197
|
+
] : [
|
|
15198
|
+
"install",
|
|
15199
|
+
"--prefer-offline",
|
|
15200
|
+
"--no-audit",
|
|
15201
|
+
"--no-fund",
|
|
15202
|
+
"--legacy-peer-deps"
|
|
15203
|
+
], { nodeOptions: {
|
|
15204
|
+
cwd: sudocsDir,
|
|
15205
|
+
stdio: process.env.DEBUG_8N ? "inherit" : "pipe"
|
|
15206
|
+
} });
|
|
15207
|
+
installSpin.succeed("dependencies installed");
|
|
15208
|
+
} catch (err) {
|
|
15209
|
+
installSpin.fail(`install failed: ${err.message}`);
|
|
15210
|
+
throw err;
|
|
15211
|
+
}
|
|
15147
15212
|
return {
|
|
15148
15213
|
updated: true,
|
|
15149
15214
|
version: latestVersion,
|
|
15150
15215
|
dir: sudocsDir
|
|
15151
15216
|
};
|
|
15152
15217
|
}
|
|
15153
|
-
/** Returns path to a binary in node_modules/.bin/ of the given dir */
|
|
15154
15218
|
function getSudocsBin(sudocsDir, name) {
|
|
15155
15219
|
return join(sudocsDir, "node_modules", ".bin", name);
|
|
15156
15220
|
}
|
|
@@ -15365,7 +15429,7 @@ async function init() {
|
|
|
15365
15429
|
|
|
15366
15430
|
//#endregion
|
|
15367
15431
|
//#region src/index.ts
|
|
15368
|
-
const program = new Command().name("8n").description("Run your Thmanyah docs site").version("0.5.
|
|
15432
|
+
const program = new Command().name("8n").description("Run your Thmanyah docs site").version("0.5.2").addOption(new Option("--debug").hideHelp()).hook("preAction", (cmd) => {
|
|
15369
15433
|
if (cmd.opts().debug) process.env.DEBUG_8N = "1";
|
|
15370
15434
|
});
|
|
15371
15435
|
program.command("init").description("Scaffold a new docs project in the current directory").action(init);
|