czon 0.7.3 → 0.7.4
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/build/pipeline.js +3 -10
- package/dist/build/robots.js +1 -1
- package/dist/cli.js +0 -10
- package/dist/ssg/components/CZONHeader.js +1 -1
- package/package.json +1 -1
package/dist/build/pipeline.js
CHANGED
|
@@ -57,13 +57,6 @@ async function applyConfig(options) {
|
|
|
57
57
|
console.log(`🌐 Target languages: ${options.langs.join(', ')}`);
|
|
58
58
|
metadata_1.MetaData.options.langs = options.langs;
|
|
59
59
|
}
|
|
60
|
-
if (options.baseUrl !== undefined) {
|
|
61
|
-
metadata_1.MetaData.options.baseUrl = options.baseUrl;
|
|
62
|
-
}
|
|
63
|
-
if (options.siteTitle !== undefined) {
|
|
64
|
-
console.log(`🏷️ Site title: ${options.siteTitle}`);
|
|
65
|
-
metadata_1.MetaData.options.siteTitle = options.siteTitle;
|
|
66
|
-
}
|
|
67
60
|
}
|
|
68
61
|
/**
|
|
69
62
|
* 构建管道(函数组合)
|
|
@@ -120,11 +113,11 @@ async function buildPipeline(options) {
|
|
|
120
113
|
// 生成 robots.txt
|
|
121
114
|
await (0, robots_1.generateRobotsTxt)();
|
|
122
115
|
// 生成 sitemap.xml
|
|
123
|
-
if (metadata_1.MetaData.options.baseUrl) {
|
|
124
|
-
await (0, sitemap_1.generateSitemap)(metadata_1.MetaData.options.baseUrl);
|
|
116
|
+
if (metadata_1.MetaData.options.site?.baseUrl) {
|
|
117
|
+
await (0, sitemap_1.generateSitemap)(metadata_1.MetaData.options.site.baseUrl);
|
|
125
118
|
}
|
|
126
119
|
else {
|
|
127
|
-
console.log('ℹ️ Skipping sitemap generation (
|
|
120
|
+
console.log('ℹ️ Skipping sitemap generation (site.baseUrl not configured)');
|
|
128
121
|
}
|
|
129
122
|
}
|
|
130
123
|
/**
|
package/dist/build/robots.js
CHANGED
|
@@ -105,7 +105,7 @@ Disallow:
|
|
|
105
105
|
User-agent: KHTML, like Gecko
|
|
106
106
|
Disallow:
|
|
107
107
|
|
|
108
|
-
${metadata_1.MetaData.options.baseUrl ? `Sitemap: ${path.join(metadata_1.MetaData.options.baseUrl, 'sitemap.xml')}` : ''}
|
|
108
|
+
${metadata_1.MetaData.options.site?.baseUrl ? `Sitemap: ${path.join(metadata_1.MetaData.options.site.baseUrl, 'sitemap.xml')}` : ''}
|
|
109
109
|
`;
|
|
110
110
|
const robotsPath = path.join(paths_1.CZON_DIST_DIR, 'robots.txt');
|
|
111
111
|
await (0, writeFile_1.writeFile)(robotsPath, robotsTxtContent);
|
package/dist/cli.js
CHANGED
|
@@ -166,19 +166,11 @@ class BuildCommand extends clipanion_1.Command {
|
|
|
166
166
|
this.lang = clipanion_1.Option.Array('--lang', {
|
|
167
167
|
description: 'Target languages for translation (e.g., en-US, ja-JP)',
|
|
168
168
|
});
|
|
169
|
-
this.baseUrl = clipanion_1.Option.String('--baseUrl', {
|
|
170
|
-
description: 'Base URL for sitemap generation (e.g., https://yoursite.com). If not provided, sitemap will not be generated.',
|
|
171
|
-
});
|
|
172
|
-
this.siteTitle = clipanion_1.Option.String('--siteTitle', {
|
|
173
|
-
description: 'Site title to replace "CZON" in the header (e.g., "My Docs")',
|
|
174
|
-
});
|
|
175
169
|
}
|
|
176
170
|
async execute() {
|
|
177
171
|
try {
|
|
178
172
|
await (0, pipeline_1.buildSite)({
|
|
179
173
|
langs: this.lang,
|
|
180
|
-
baseUrl: this.baseUrl,
|
|
181
|
-
siteTitle: this.siteTitle,
|
|
182
174
|
});
|
|
183
175
|
return 0;
|
|
184
176
|
}
|
|
@@ -198,8 +190,6 @@ BuildCommand.usage = clipanion_1.Command.Usage({
|
|
|
198
190
|
Examples:
|
|
199
191
|
$ czon build
|
|
200
192
|
$ czon build --lang en-US --lang ja-JP (translate to English and Japanese)
|
|
201
|
-
$ czon build --baseUrl https://yoursite.com (generate sitemap.xml)
|
|
202
|
-
$ czon build --siteTitle "My Docs" (replace "CZON" in header)
|
|
203
193
|
`,
|
|
204
194
|
});
|
|
205
195
|
// 创建 CLI 应用
|
|
@@ -10,7 +10,7 @@ const LanguageSwitch_1 = require("./LanguageSwitch");
|
|
|
10
10
|
const CZONHeader = props => {
|
|
11
11
|
return (react_1.default.createElement("header", { className: "czon-header py-4 border-b flex justify-between items-center px-6" },
|
|
12
12
|
react_1.default.createElement("h1", { className: "text-2xl font-bold" },
|
|
13
|
-
react_1.default.createElement("a", { href: "index.html" }, props.ctx.site.options.
|
|
13
|
+
react_1.default.createElement("a", { href: "index.html" }, props.ctx.site.options.site?.title ?? 'CZON')),
|
|
14
14
|
react_1.default.createElement("div", { className: "flex items-center gap-4" },
|
|
15
15
|
react_1.default.createElement(DarkModeSwitch_1.DarkModeSwitch, null),
|
|
16
16
|
props.lang && react_1.default.createElement(LanguageSwitch_1.LanguageSwitch, { ctx: props.ctx, lang: props.lang, file: props.file }))));
|