@ahmedrowaihi/8n 0.2.2 → 0.4.0

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 +62 -15
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -15070,11 +15070,19 @@ const pipelineType = ZodPipeline.create;
15070
15070
  const configSchema = objectType({
15071
15071
  content: stringType().default("./content"),
15072
15072
  locales: arrayType(stringType()).min(1).default(["en"]),
15073
- github: objectType({
15074
- repo: stringType(),
15075
- branch: stringType().default("main")
15076
- }).optional(),
15077
- siteName: stringType().optional()
15073
+ github: objectType({ repo: stringType() }).optional(),
15074
+ siteName: stringType().optional(),
15075
+ version: stringType().optional(),
15076
+ sections: recordType(unionType([literalType(false), objectType({
15077
+ nav: literalType(false).optional(),
15078
+ search: literalType(false).optional(),
15079
+ sitemap: literalType(false).optional()
15080
+ })])).optional(),
15081
+ nav: objectType({ links: arrayType(objectType({
15082
+ text: stringType(),
15083
+ url: stringType()
15084
+ })).default([]) }).default({}),
15085
+ animations: booleanType().default(true)
15078
15086
  });
15079
15087
 
15080
15088
  //#endregion
@@ -36995,13 +37003,13 @@ async function getLatestHash() {
36995
37003
  if (!res.ok) throw new Error(`GitHub API error: ${res.status}`);
36996
37004
  return (await res.text()).trim();
36997
37005
  }
36998
- async function prepareSudocs(sudocsDir) {
37006
+ async function prepareSudocs(sudocsDir, options) {
36999
37007
  if (process.env.SUDOCS_LOCAL) return {
37000
37008
  updated: false,
37001
37009
  hash: "local",
37002
37010
  dir: resolve(process.env.SUDOCS_LOCAL)
37003
37011
  };
37004
- const latestHash = await getLatestHash();
37012
+ const latestHash = options?.version ?? await getLatestHash();
37005
37013
  const versionFile = join(sudocsDir, ".8n-version");
37006
37014
  if ((existsSync(versionFile) ? readFileSync(versionFile, "utf8").trim() : null) === latestHash && existsSync(sudocsDir)) return {
37007
37015
  updated: false,
@@ -37040,11 +37048,13 @@ function getSudocsBin(sudocsDir, name) {
37040
37048
  function buildEnv(config, contentDir) {
37041
37049
  return {
37042
37050
  ...process.env,
37043
- THMANYAH_CONTENT_DIR: contentDir,
37044
- THMANYAH_LOCALES: (config.locales ?? ["en"]).join(","),
37045
- THMANYAH_SITE_NAME: config.siteName ?? "Docs",
37046
- THMANYAH_GITHUB_REPO: config.github?.repo ?? "",
37047
- THMANYAH_GITHUB_BRANCH: config.github?.branch ?? "main"
37051
+ CONTENT_DIR: contentDir,
37052
+ LOCALES: (config.locales ?? ["en"]).join(","),
37053
+ NEXT_PUBLIC_SITE_NAME: config.siteName ?? "Docs",
37054
+ NEXT_PUBLIC_GITHUB_REPO: config.github?.repo,
37055
+ SECTIONS: JSON.stringify(config.sections ?? {}),
37056
+ NEXT_PUBLIC_NAV_LINKS: JSON.stringify(config.nav?.links ?? []),
37057
+ NEXT_PUBLIC_ANIMATIONS: config.animations === false ? "false" : "true"
37048
37058
  };
37049
37059
  }
37050
37060
 
@@ -37056,7 +37066,7 @@ async function dev() {
37056
37066
  const fallbackDir = resolve(process.cwd(), ".sudocs");
37057
37067
  console.log(import_picocolors.default.cyan("8n") + import_picocolors.default.dim(` dev → ${contentDir}`));
37058
37068
  if (!process.env.SUDOCS_LOCAL) console.log(import_picocolors.default.dim(" checking for updates..."));
37059
- const { updated, hash, dir: sudocsDir } = await prepareSudocs(fallbackDir);
37069
+ const { updated, hash, dir: sudocsDir } = await prepareSudocs(fallbackDir, { version: config.version });
37060
37070
  if (updated) console.log(import_picocolors.default.green("✓") + import_picocolors.default.dim(` starter updated to ${hash.slice(0, 7)}`));
37061
37071
  if (process.env.SUDOCS_LOCAL) console.log(import_picocolors.default.yellow("⚑") + import_picocolors.default.dim(` using local starter → ${sudocsDir}`));
37062
37072
  await R$1(getSudocsBin(sudocsDir, "next"), ["dev"], { nodeOptions: {
@@ -37080,7 +37090,7 @@ async function build() {
37080
37090
  const fallbackDir = resolve(process.cwd(), ".sudocs");
37081
37091
  console.log(import_picocolors.default.cyan("8n") + import_picocolors.default.dim(` build → ${contentDir}`));
37082
37092
  if (!process.env.SUDOCS_LOCAL) console.log(import_picocolors.default.dim(" checking for updates..."));
37083
- const { updated, hash, dir: sudocsDir } = await prepareSudocs(fallbackDir);
37093
+ const { updated, hash, dir: sudocsDir } = await prepareSudocs(fallbackDir, { version: config.version });
37084
37094
  if (updated) console.log(import_picocolors.default.green("✓") + import_picocolors.default.dim(` starter updated to ${hash.slice(0, 7)}`));
37085
37095
  await R$1(getSudocsBin(sudocsDir, "next"), ["build"], { nodeOptions: {
37086
37096
  cwd: sudocsDir,
@@ -37112,11 +37122,22 @@ const SCAFFOLD = {
37112
37122
  content: "./content",
37113
37123
  locales: ["en"],
37114
37124
  siteName: "Docs",
37125
+
37126
+ // Pin to a specific starter version (git tag or commit SHA).
37127
+ // Remove this line to always track the latest release.
37128
+ // version: "v1.0.0",
37129
+
37130
+ // Sections auto-show when content exists, auto-hide when empty.
37131
+ // Set a section to false to hide it even if content is present.
37132
+ // sections: { api: false },
37133
+
37134
+ // Add links to the top navigation bar.
37135
+ // nav: { links: [{ text: "Blog", url: "https://example.com/blog" }] },
37115
37136
  };
37116
37137
  `,
37117
37138
  ["content/docs/en/meta.json"]: JSON.stringify({
37118
37139
  title: "Documentation",
37119
- pages: ["index"]
37140
+ pages: ["index", "getting-started"]
37120
37141
  }, null, 2) + "\n",
37121
37142
  ["content/docs/en/index.mdx"]: `---
37122
37143
  title: Introduction
@@ -37124,6 +37145,32 @@ description: Welcome to the docs.
37124
37145
  ---
37125
37146
 
37126
37147
  Welcome to your documentation. Edit files in \`content/\` and run \`8n dev\` to start.
37148
+ `,
37149
+ ["content/docs/en/getting-started/meta.json"]: JSON.stringify({
37150
+ title: "Getting Started",
37151
+ pages: ["installation"]
37152
+ }, null, 2) + "\n",
37153
+ ["content/docs/en/getting-started/installation.mdx"]: `---
37154
+ title: Installation
37155
+ description: How to install and set up the project.
37156
+ ---
37157
+
37158
+ ## Installation
37159
+
37160
+ Add your installation steps here.
37161
+ `,
37162
+ ["content/home/en/index.mdx"]: `---
37163
+ title: Home
37164
+ ---
37165
+
37166
+ <div className="flex flex-col items-center justify-center text-center flex-1 gap-6 px-6 py-24">
37167
+ <h1 className="text-4xl sm:text-5xl md:text-6xl font-bold leading-tight tracking-tight max-w-2xl">
37168
+ Welcome to your docs.
37169
+ </h1>
37170
+ <p className="text-muted-foreground text-lg max-w-md leading-relaxed">
37171
+ Edit \`content/home/en/index.mdx\` to customize this page.
37172
+ </p>
37173
+ </div>
37127
37174
  `,
37128
37175
  ["content/changelog/en/meta.json"]: JSON.stringify({ title: "Changelog" }, null, 2) + "\n",
37129
37176
  ["content/changelog/en/v1.0.0.mdx"]: `---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ahmedrowaihi/8n",
3
- "version": "0.2.2",
3
+ "version": "0.4.0",
4
4
  "description": "Thmanyah Docs — run your docs site from your content directory",
5
5
  "type": "module",
6
6
  "bin": {
@@ -24,7 +24,7 @@
24
24
  "picocolors": "^1.1.0",
25
25
  "tinyexec": "^1.0.0",
26
26
  "tsdown": "^0.20.0",
27
- "@ahmedrowaihi/8n-core": "0.1.0"
27
+ "@ahmedrowaihi/8n-core": "0.2.0"
28
28
  },
29
29
  "scripts": {
30
30
  "build": "tsdown",