@ahmedrowaihi/8n 0.4.0 → 0.4.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.
Files changed (2) hide show
  1. package/dist/index.mjs +43 -5
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -36989,6 +36989,18 @@ async function installDependencies(options = {}) {
36989
36989
 
36990
36990
  //#endregion
36991
36991
  //#region src/web-app.ts
36992
+ async function checkSelfUpdate() {
36993
+ try {
36994
+ const res = await fetch("https://registry.npmjs.org/@ahmedrowaihi/8n/latest", {
36995
+ headers: { Accept: "application/json" },
36996
+ signal: AbortSignal.timeout(3e3)
36997
+ });
36998
+ if (!res.ok) return;
36999
+ const { version: latest } = await res.json();
37000
+ const current = "0.4.2";
37001
+ 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"));
37002
+ } catch {}
37003
+ }
36992
37004
  const DEFAULT_REPO = "ahmedrowaihi/fumadocsudo";
36993
37005
  function getRepo() {
36994
37006
  return process.env.SUDOCS_REPO ?? DEFAULT_REPO;
@@ -37065,10 +37077,36 @@ async function dev() {
37065
37077
  const contentDir = resolve(process.cwd(), config.content ?? "./content");
37066
37078
  const fallbackDir = resolve(process.cwd(), ".sudocs");
37067
37079
  console.log(import_picocolors.default.cyan("8n") + import_picocolors.default.dim(` dev → ${contentDir}`));
37068
- if (!process.env.SUDOCS_LOCAL) console.log(import_picocolors.default.dim(" checking for updates..."));
37069
- const { updated, hash, dir: sudocsDir } = await prepareSudocs(fallbackDir, { version: config.version });
37070
- if (updated) console.log(import_picocolors.default.green("") + import_picocolors.default.dim(` starter updated to ${hash.slice(0, 7)}`));
37071
- if (process.env.SUDOCS_LOCAL) console.log(import_picocolors.default.yellow("") + import_picocolors.default.dim(` using local starter → ${sudocsDir}`));
37080
+ if (process.env.SUDOCS_LOCAL) {
37081
+ const { dir: sudocsDir } = await prepareSudocs(fallbackDir, { version: config.version });
37082
+ console.log(import_picocolors.default.yellow("") + import_picocolors.default.dim(` using local starter ${sudocsDir}`));
37083
+ await R$1(getSudocsBin(sudocsDir, "next"), ["dev"], { nodeOptions: {
37084
+ cwd: sudocsDir,
37085
+ stdio: "inherit",
37086
+ env: buildEnv(config, contentDir)
37087
+ } });
37088
+ return;
37089
+ }
37090
+ console.log(import_picocolors.default.dim(" checking for updates..."));
37091
+ checkSelfUpdate();
37092
+ let sudocsDir;
37093
+ try {
37094
+ const result = await prepareSudocs(fallbackDir, { version: config.version });
37095
+ sudocsDir = result.dir;
37096
+ const short = result.hash === "local" ? "local" : result.hash.slice(0, 7);
37097
+ if (result.updated) console.log(import_picocolors.default.green("✓") + ` starter updated to ${import_picocolors.default.cyan(short)}`);
37098
+ else console.log(import_picocolors.default.green("✓") + import_picocolors.default.dim(` already on latest (${short})`));
37099
+ } catch (err) {
37100
+ if (existsSync(fallbackDir)) {
37101
+ console.log(import_picocolors.default.yellow("⚠") + import_picocolors.default.dim(" update check failed — using cached starter"));
37102
+ console.log(import_picocolors.default.dim(` ${err.message}`));
37103
+ sudocsDir = fallbackDir;
37104
+ } else {
37105
+ console.error(import_picocolors.default.red("✗") + " failed to download starter and no cache found");
37106
+ console.error(import_picocolors.default.dim(` ${err.message}`));
37107
+ process.exit(1);
37108
+ }
37109
+ }
37072
37110
  await R$1(getSudocsBin(sudocsDir, "next"), ["dev"], { nodeOptions: {
37073
37111
  cwd: sudocsDir,
37074
37112
  stdio: "inherit",
@@ -37238,7 +37276,7 @@ async function init() {
37238
37276
 
37239
37277
  //#endregion
37240
37278
  //#region src/index.ts
37241
- const program = new Command().name("8n").description("Run your Thmanyah docs site").version("0.1.0");
37279
+ const program = new Command().name("8n").description("Run your Thmanyah docs site").version("0.4.2");
37242
37280
  program.command("init").description("Scaffold a new docs project in the current directory").action(init);
37243
37281
  program.command("dev").description("Start the dev server").action(dev);
37244
37282
  program.command("build").description("Build for production").action(build);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ahmedrowaihi/8n",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "Thmanyah Docs — run your docs site from your content directory",
5
5
  "type": "module",
6
6
  "bin": {