@ahmedrowaihi/8n 0.2.1 → 0.3.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.
- package/dist/index.mjs +46 -11
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -15074,7 +15074,17 @@ const configSchema = objectType({
|
|
|
15074
15074
|
repo: stringType(),
|
|
15075
15075
|
branch: stringType().default("main")
|
|
15076
15076
|
}).optional(),
|
|
15077
|
-
siteName: stringType().optional()
|
|
15077
|
+
siteName: stringType().optional(),
|
|
15078
|
+
version: stringType().optional(),
|
|
15079
|
+
sections: recordType(unionType([literalType(false), objectType({
|
|
15080
|
+
nav: literalType(false).optional(),
|
|
15081
|
+
search: literalType(false).optional(),
|
|
15082
|
+
sitemap: literalType(false).optional()
|
|
15083
|
+
})])).optional(),
|
|
15084
|
+
nav: objectType({ links: arrayType(objectType({
|
|
15085
|
+
text: stringType(),
|
|
15086
|
+
url: stringType()
|
|
15087
|
+
})).default([]) }).default({})
|
|
15078
15088
|
});
|
|
15079
15089
|
|
|
15080
15090
|
//#endregion
|
|
@@ -36995,13 +37005,13 @@ async function getLatestHash() {
|
|
|
36995
37005
|
if (!res.ok) throw new Error(`GitHub API error: ${res.status}`);
|
|
36996
37006
|
return (await res.text()).trim();
|
|
36997
37007
|
}
|
|
36998
|
-
async function prepareSudocs(sudocsDir) {
|
|
37008
|
+
async function prepareSudocs(sudocsDir, options) {
|
|
36999
37009
|
if (process.env.SUDOCS_LOCAL) return {
|
|
37000
37010
|
updated: false,
|
|
37001
37011
|
hash: "local",
|
|
37002
37012
|
dir: resolve(process.env.SUDOCS_LOCAL)
|
|
37003
37013
|
};
|
|
37004
|
-
const latestHash = await getLatestHash();
|
|
37014
|
+
const latestHash = options?.version ?? await getLatestHash();
|
|
37005
37015
|
const versionFile = join(sudocsDir, ".8n-version");
|
|
37006
37016
|
if ((existsSync(versionFile) ? readFileSync(versionFile, "utf8").trim() : null) === latestHash && existsSync(sudocsDir)) return {
|
|
37007
37017
|
updated: false,
|
|
@@ -37040,11 +37050,12 @@ function getSudocsBin(sudocsDir, name) {
|
|
|
37040
37050
|
function buildEnv(config, contentDir) {
|
|
37041
37051
|
return {
|
|
37042
37052
|
...process.env,
|
|
37043
|
-
|
|
37044
|
-
|
|
37045
|
-
|
|
37046
|
-
|
|
37047
|
-
|
|
37053
|
+
CONTENT_DIR: contentDir,
|
|
37054
|
+
LOCALES: (config.locales ?? ["en"]).join(","),
|
|
37055
|
+
NEXT_PUBLIC_SITE_NAME: config.siteName ?? "Docs",
|
|
37056
|
+
GITHUB_REPO: config.github?.repo,
|
|
37057
|
+
SECTIONS: JSON.stringify(config.sections ?? {}),
|
|
37058
|
+
NAV_LINKS: JSON.stringify(config.nav?.links ?? [])
|
|
37048
37059
|
};
|
|
37049
37060
|
}
|
|
37050
37061
|
|
|
@@ -37056,7 +37067,7 @@ async function dev() {
|
|
|
37056
37067
|
const fallbackDir = resolve(process.cwd(), ".sudocs");
|
|
37057
37068
|
console.log(import_picocolors.default.cyan("8n") + import_picocolors.default.dim(` dev → ${contentDir}`));
|
|
37058
37069
|
if (!process.env.SUDOCS_LOCAL) console.log(import_picocolors.default.dim(" checking for updates..."));
|
|
37059
|
-
const { updated, hash, dir: sudocsDir } = await prepareSudocs(fallbackDir);
|
|
37070
|
+
const { updated, hash, dir: sudocsDir } = await prepareSudocs(fallbackDir, { version: config.version });
|
|
37060
37071
|
if (updated) console.log(import_picocolors.default.green("✓") + import_picocolors.default.dim(` starter updated to ${hash.slice(0, 7)}`));
|
|
37061
37072
|
if (process.env.SUDOCS_LOCAL) console.log(import_picocolors.default.yellow("⚑") + import_picocolors.default.dim(` using local starter → ${sudocsDir}`));
|
|
37062
37073
|
await R$1(getSudocsBin(sudocsDir, "next"), ["dev"], { nodeOptions: {
|
|
@@ -37080,7 +37091,7 @@ async function build() {
|
|
|
37080
37091
|
const fallbackDir = resolve(process.cwd(), ".sudocs");
|
|
37081
37092
|
console.log(import_picocolors.default.cyan("8n") + import_picocolors.default.dim(` build → ${contentDir}`));
|
|
37082
37093
|
if (!process.env.SUDOCS_LOCAL) console.log(import_picocolors.default.dim(" checking for updates..."));
|
|
37083
|
-
const { updated, hash, dir: sudocsDir } = await prepareSudocs(fallbackDir);
|
|
37094
|
+
const { updated, hash, dir: sudocsDir } = await prepareSudocs(fallbackDir, { version: config.version });
|
|
37084
37095
|
if (updated) console.log(import_picocolors.default.green("✓") + import_picocolors.default.dim(` starter updated to ${hash.slice(0, 7)}`));
|
|
37085
37096
|
await R$1(getSudocsBin(sudocsDir, "next"), ["build"], { nodeOptions: {
|
|
37086
37097
|
cwd: sudocsDir,
|
|
@@ -37112,11 +37123,22 @@ const SCAFFOLD = {
|
|
|
37112
37123
|
content: "./content",
|
|
37113
37124
|
locales: ["en"],
|
|
37114
37125
|
siteName: "Docs",
|
|
37126
|
+
|
|
37127
|
+
// Pin to a specific starter version (git tag or commit SHA).
|
|
37128
|
+
// Remove this line to always track the latest release.
|
|
37129
|
+
// version: "v1.0.0",
|
|
37130
|
+
|
|
37131
|
+
// Sections auto-show when content exists, auto-hide when empty.
|
|
37132
|
+
// Set a section to false to hide it even if content is present.
|
|
37133
|
+
// sections: { api: false },
|
|
37134
|
+
|
|
37135
|
+
// Add links to the top navigation bar.
|
|
37136
|
+
// nav: { links: [{ text: "Blog", url: "https://example.com/blog" }] },
|
|
37115
37137
|
};
|
|
37116
37138
|
`,
|
|
37117
37139
|
["content/docs/en/meta.json"]: JSON.stringify({
|
|
37118
37140
|
title: "Documentation",
|
|
37119
|
-
pages: ["index"]
|
|
37141
|
+
pages: ["index", "getting-started"]
|
|
37120
37142
|
}, null, 2) + "\n",
|
|
37121
37143
|
["content/docs/en/index.mdx"]: `---
|
|
37122
37144
|
title: Introduction
|
|
@@ -37124,6 +37146,19 @@ description: Welcome to the docs.
|
|
|
37124
37146
|
---
|
|
37125
37147
|
|
|
37126
37148
|
Welcome to your documentation. Edit files in \`content/\` and run \`8n dev\` to start.
|
|
37149
|
+
`,
|
|
37150
|
+
["content/docs/en/getting-started/meta.json"]: JSON.stringify({
|
|
37151
|
+
title: "Getting Started",
|
|
37152
|
+
pages: ["installation"]
|
|
37153
|
+
}, null, 2) + "\n",
|
|
37154
|
+
["content/docs/en/getting-started/installation.mdx"]: `---
|
|
37155
|
+
title: Installation
|
|
37156
|
+
description: How to install and set up the project.
|
|
37157
|
+
---
|
|
37158
|
+
|
|
37159
|
+
## Installation
|
|
37160
|
+
|
|
37161
|
+
Add your installation steps here.
|
|
37127
37162
|
`,
|
|
37128
37163
|
["content/changelog/en/meta.json"]: JSON.stringify({ title: "Changelog" }, null, 2) + "\n",
|
|
37129
37164
|
["content/changelog/en/v1.0.0.mdx"]: `---
|