czon 0.1.5 → 0.1.7
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/.prettierignore +4 -1
- package/dist/ai/extractMetadataFromMarkdown.js +22 -7
- package/dist/ai/extractMetadataFromMarkdown.js.map +1 -1
- package/dist/build/pipeline.d.ts.map +1 -1
- package/dist/build/pipeline.js +8 -85
- package/dist/build/pipeline.js.map +1 -1
- package/dist/process/enhanceMarkdownSource.d.ts +5 -0
- package/dist/process/enhanceMarkdownSource.d.ts.map +1 -0
- package/dist/process/enhanceMarkdownSource.js +64 -0
- package/dist/process/enhanceMarkdownSource.js.map +1 -0
- package/dist/process/extractMetadataByAI.js +1 -1
- package/dist/process/extractMetadataByAI.js.map +1 -1
- package/dist/process/processTranslations.d.ts +5 -0
- package/dist/process/processTranslations.d.ts.map +1 -0
- package/dist/process/processTranslations.js +58 -0
- package/dist/process/processTranslations.js.map +1 -0
- package/dist/process/template.d.ts +2 -2
- package/dist/process/template.d.ts.map +1 -1
- package/dist/process/template.js +63 -155
- package/dist/process/template.js.map +1 -1
- package/dist/ssg/ContentPage.d.ts +9 -0
- package/dist/ssg/ContentPage.d.ts.map +1 -0
- package/{assets/templates/default/layout.html → dist/ssg/ContentPage.js} +73 -61
- package/dist/ssg/ContentPage.js.map +1 -0
- package/dist/ssg/RedirectPage.d.ts +6 -0
- package/dist/ssg/RedirectPage.d.ts.map +1 -0
- package/dist/ssg/RedirectPage.js +24 -0
- package/dist/ssg/RedirectPage.js.map +1 -0
- package/dist/ssg/app.d.ts +4 -0
- package/dist/ssg/app.d.ts.map +1 -0
- package/dist/ssg/app.js +44 -0
- package/dist/ssg/app.js.map +1 -0
- package/dist/ssg/components/LanguageSwitcher.d.ts +8 -0
- package/dist/ssg/components/LanguageSwitcher.d.ts.map +1 -0
- package/dist/ssg/components/LanguageSwitcher.js +21 -0
- package/dist/ssg/components/LanguageSwitcher.js.map +1 -0
- package/dist/ssg/components/Navigator.d.ts +7 -0
- package/dist/ssg/components/Navigator.d.ts.map +1 -0
- package/dist/ssg/components/Navigator.js +17 -0
- package/dist/ssg/components/Navigator.js.map +1 -0
- package/dist/ssg/components/TagList.d.ts +5 -0
- package/dist/ssg/components/TagList.d.ts.map +1 -0
- package/dist/ssg/components/TagList.js +12 -0
- package/dist/ssg/components/TagList.js.map +1 -0
- package/dist/ssg/index.d.ts +3 -0
- package/dist/ssg/index.d.ts.map +1 -0
- package/dist/ssg/index.js +14 -0
- package/dist/ssg/index.js.map +1 -0
- package/dist/types.d.ts +33 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/writeFile.d.ts +5 -0
- package/dist/utils/writeFile.d.ts.map +1 -1
- package/dist/utils/writeFile.js +5 -0
- package/dist/utils/writeFile.js.map +1 -1
- package/package.json +5 -1
- package/tsconfig.json +1 -0
- package/.github/workflows/bump-version.yml +0 -112
- package/.github/workflows/ci.yml +0 -64
- package/.github/workflows/pages.yml +0 -61
- package/.github/workflows/publish.yml +0 -81
- package/.husky/pre-commit +0 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Navigator = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const Navigator = props => {
|
|
9
|
+
return (react_1.default.createElement("ul", { className: "nav-list" }, props.ctx.site.files.map(file => {
|
|
10
|
+
const link = file.metadata.slug + '.html';
|
|
11
|
+
const isActive = props.file.hash === file.hash;
|
|
12
|
+
return (react_1.default.createElement("li", { className: "nav-item", key: file.hash },
|
|
13
|
+
react_1.default.createElement("a", { href: link, className: `nav-link ${isActive ? 'active' : ''}` }, file.metadata.title)));
|
|
14
|
+
})));
|
|
15
|
+
};
|
|
16
|
+
exports.Navigator = Navigator;
|
|
17
|
+
//# sourceMappingURL=Navigator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Navigator.js","sourceRoot":"","sources":["../../../src/ssg/components/Navigator.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAGnB,MAAM,SAAS,GAGjB,KAAK,CAAC,EAAE;IACX,OAAO,CACL,sCAAI,SAAS,EAAC,UAAU,IACrB,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;QAC/B,MAAM,IAAI,GAAG,IAAI,CAAC,QAAS,CAAC,IAAI,GAAG,OAAO,CAAC;QAC3C,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC;QAE/C,OAAO,CACL,sCAAI,SAAS,EAAC,UAAU,EAAC,GAAG,EAAE,IAAI,CAAC,IAAI;YACrC,qCAAG,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,IAC7D,IAAI,CAAC,QAAS,CAAC,KAAK,CACnB,CACD,CACN,CAAC;IACJ,CAAC,CAAC,CACC,CACN,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,SAAS,aAoBpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TagList.d.ts","sourceRoot":"","sources":["../../../src/ssg/components/TagList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC;IAC7B,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAUA,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TagList = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const TagList = props => {
|
|
9
|
+
return (react_1.default.createElement("ul", { className: "tags-list" }, props.tags.map(tag => (react_1.default.createElement("li", { className: "tag-item", key: tag }, tag)))));
|
|
10
|
+
};
|
|
11
|
+
exports.TagList = TagList;
|
|
12
|
+
//# sourceMappingURL=TagList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TagList.js","sourceRoot":"","sources":["../../../src/ssg/components/TagList.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAEnB,MAAM,OAAO,GAEf,KAAK,CAAC,EAAE;IACX,OAAO,CACL,sCAAI,SAAS,EAAC,WAAW,IACtB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CACrB,sCAAI,SAAS,EAAC,UAAU,EAAC,GAAG,EAAE,GAAG,IAC9B,GAAG,CACD,CACN,CAAC,CACC,CACN,CAAC;AACJ,CAAC,CAAC;AAZW,QAAA,OAAO,WAYlB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ssg/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG1C,eAAO,MAAM,YAAY,GAAI,SAAS,cAAc,WAEnD,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.renderToHTML = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const server_1 = require("react-dom/server");
|
|
9
|
+
const app_1 = require("./app");
|
|
10
|
+
const renderToHTML = (context) => {
|
|
11
|
+
return (0, server_1.renderToStaticMarkup)(react_1.default.createElement(app_1.App, { ...context }));
|
|
12
|
+
};
|
|
13
|
+
exports.renderToHTML = renderToHTML;
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ssg/index.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,6CAAwD;AAExD,+BAA4B;AAErB,MAAM,YAAY,GAAG,CAAC,OAAuB,EAAE,EAAE;IACtD,OAAO,IAAA,6BAAoB,EAAC,8BAAC,SAAG,OAAK,OAAO,GAAI,CAAC,CAAC;AACpD,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB"}
|
package/dist/types.d.ts
CHANGED
|
@@ -6,6 +6,10 @@ export interface FileMetaData {
|
|
|
6
6
|
path: string;
|
|
7
7
|
links: string[];
|
|
8
8
|
metadata?: AIMetadata;
|
|
9
|
+
/**
|
|
10
|
+
* 记录翻译所用的(增强后)母语文件的哈希值
|
|
11
|
+
*/
|
|
12
|
+
nativeMarkdownHash?: string;
|
|
9
13
|
}
|
|
10
14
|
/**
|
|
11
15
|
* .czon/meta.json 文件结构
|
|
@@ -22,7 +26,11 @@ export interface BuildOptions {
|
|
|
22
26
|
}
|
|
23
27
|
export interface AIMetadata {
|
|
24
28
|
title: string;
|
|
29
|
+
description: string;
|
|
25
30
|
summary: string;
|
|
31
|
+
short_summary: string;
|
|
32
|
+
key_points: string[];
|
|
33
|
+
audience: string;
|
|
26
34
|
slug: string;
|
|
27
35
|
tags: string[];
|
|
28
36
|
inferred_date?: string;
|
|
@@ -33,4 +41,29 @@ export interface AIMetadata {
|
|
|
33
41
|
total: number;
|
|
34
42
|
};
|
|
35
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* SSG 渲染上下文
|
|
46
|
+
*/
|
|
47
|
+
export interface IRenderContext {
|
|
48
|
+
path: string;
|
|
49
|
+
/**
|
|
50
|
+
* 全站数据
|
|
51
|
+
*/
|
|
52
|
+
site: MetaDataStore;
|
|
53
|
+
/**
|
|
54
|
+
* 全站文档列表
|
|
55
|
+
*/
|
|
56
|
+
contents: Array<{
|
|
57
|
+
lang: string;
|
|
58
|
+
hash: string;
|
|
59
|
+
/**
|
|
60
|
+
* 渲染后的 HTML 内容
|
|
61
|
+
*/
|
|
62
|
+
body: string;
|
|
63
|
+
/**
|
|
64
|
+
* YAML Frontmatter 数据
|
|
65
|
+
*/
|
|
66
|
+
frontmatter: any;
|
|
67
|
+
}>;
|
|
68
|
+
}
|
|
36
69
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,CAAC,EAAE,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,CAAC,EAAE,UAAU,CAAC;IACtB;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,YAAY,CAAC;IACtB,KAAK,EAAE,YAAY,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,EAAE,aAAa,CAAC;IACpB;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb;;WAEG;QACH,IAAI,EAAE,MAAM,CAAC;QACb;;WAEG;QACH,WAAW,EAAE,GAAG,CAAC;KAClB,CAAC,CAAC;CACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeFile.d.ts","sourceRoot":"","sources":["../../src/utils/writeFile.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,SAAS,GAAU,MAAM,MAAM,EAAE,MAAM,MAAM,KAAG,OAAO,CAAC,IAAI,CAIxE,CAAC"}
|
|
1
|
+
{"version":3,"file":"writeFile.d.ts","sourceRoot":"","sources":["../../src/utils/writeFile.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAU,MAAM,MAAM,EAAE,MAAM,MAAM,KAAG,OAAO,CAAC,IAAI,CAIxE,CAAC"}
|
package/dist/utils/writeFile.js
CHANGED
|
@@ -4,6 +4,11 @@ exports.writeFile = void 0;
|
|
|
4
4
|
const promises_1 = require("fs/promises");
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const metadata_1 = require("../metadata");
|
|
7
|
+
/**
|
|
8
|
+
* Ensure directory exists and write data to file
|
|
9
|
+
* @param path - file path
|
|
10
|
+
* @param data - file content
|
|
11
|
+
*/
|
|
7
12
|
const writeFile = async (path, data) => {
|
|
8
13
|
await (0, promises_1.mkdir)((0, path_1.dirname)(path), { recursive: true });
|
|
9
14
|
await (0, promises_1.writeFile)(path, data, 'utf-8');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeFile.js","sourceRoot":"","sources":["../../src/utils/writeFile.ts"],"names":[],"mappings":";;;AAAA,0CAA6D;AAC7D,+BAA+B;AAC/B,0CAAuC;
|
|
1
|
+
{"version":3,"file":"writeFile.js","sourceRoot":"","sources":["../../src/utils/writeFile.ts"],"names":[],"mappings":";;;AAAA,0CAA6D;AAC7D,+BAA+B;AAC/B,0CAAuC;AAEvC;;;;GAIG;AACI,MAAM,SAAS,GAAG,KAAK,EAAE,IAAY,EAAE,IAAY,EAAiB,EAAE;IAC3E,MAAM,IAAA,gBAAK,EAAC,IAAA,cAAO,EAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAChD,MAAM,IAAA,oBAAU,EAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IACtC,IAAI,mBAAQ,CAAC,OAAO,CAAC,OAAO;QAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC;AACrE,CAAC,CAAC;AAJW,QAAA,SAAS,aAIpB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "czon",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "CZone - AI enhanced Markdown content engine",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -51,6 +51,8 @@
|
|
|
51
51
|
"typescript": "^5.9.3"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
+
"@types/react": "^19.2.7",
|
|
55
|
+
"@types/react-dom": "^19.2.3",
|
|
54
56
|
"chokidar": "^5.0.0",
|
|
55
57
|
"clipanion": "^4.0.0-rc.4",
|
|
56
58
|
"dotenv": "^16.4.7",
|
|
@@ -59,6 +61,8 @@
|
|
|
59
61
|
"marked": "^17.0.1",
|
|
60
62
|
"marked-katex-extension": "^5.1.6",
|
|
61
63
|
"minimatch": "^10.1.1",
|
|
64
|
+
"react": "^19.2.3",
|
|
65
|
+
"react-dom": "^19.2.3",
|
|
62
66
|
"yaml": "^2.8.2"
|
|
63
67
|
}
|
|
64
68
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
name: Bump Version
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
workflow_dispatch:
|
|
5
|
-
inputs:
|
|
6
|
-
version:
|
|
7
|
-
description: 'Version bump type'
|
|
8
|
-
required: true
|
|
9
|
-
type: choice
|
|
10
|
-
options:
|
|
11
|
-
- major
|
|
12
|
-
- minor
|
|
13
|
-
- patch
|
|
14
|
-
default: 'patch'
|
|
15
|
-
|
|
16
|
-
jobs:
|
|
17
|
-
bump-version:
|
|
18
|
-
runs-on: ubuntu-latest
|
|
19
|
-
permissions:
|
|
20
|
-
contents: write
|
|
21
|
-
pull-requests: write
|
|
22
|
-
steps:
|
|
23
|
-
- name: Checkout repository
|
|
24
|
-
uses: actions/checkout@v4
|
|
25
|
-
with:
|
|
26
|
-
fetch-depth: 0
|
|
27
|
-
token: ${{ secrets.GITHUB_TOKEN }}
|
|
28
|
-
persist-credentials: true
|
|
29
|
-
|
|
30
|
-
- name: Setup Git
|
|
31
|
-
run: |
|
|
32
|
-
git config --global user.name 'github-actions[bot]'
|
|
33
|
-
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
|
|
34
|
-
|
|
35
|
-
- name: Sync with remote
|
|
36
|
-
run: |
|
|
37
|
-
git fetch origin
|
|
38
|
-
git checkout -b bump-version-${{ github.run_id }}
|
|
39
|
-
git reset --hard origin/main
|
|
40
|
-
|
|
41
|
-
- name: Setup Node.js
|
|
42
|
-
uses: actions/setup-node@v4
|
|
43
|
-
with:
|
|
44
|
-
node-version: '24.x'
|
|
45
|
-
|
|
46
|
-
- name: Get current version
|
|
47
|
-
id: get_version
|
|
48
|
-
run: |
|
|
49
|
-
CURRENT_VERSION=$(jq -r '.version' package.json)
|
|
50
|
-
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
|
|
51
|
-
echo "Current version: $CURRENT_VERSION"
|
|
52
|
-
|
|
53
|
-
- name: Bump version
|
|
54
|
-
id: bump_version
|
|
55
|
-
run: |
|
|
56
|
-
# 解析当前版本号 (支持 semver 格式)
|
|
57
|
-
CURRENT_VERSION="${{ steps.get_version.outputs.current_version }}"
|
|
58
|
-
echo "Current version: $CURRENT_VERSION"
|
|
59
|
-
|
|
60
|
-
# 使用 npm version 命令来安全地更新版本
|
|
61
|
-
# 这会自动处理 semver 规则
|
|
62
|
-
npm version "${{ github.event.inputs.version }}" --no-git-tag-version
|
|
63
|
-
|
|
64
|
-
# 获取新版本
|
|
65
|
-
NEW_VERSION=$(jq -r '.version' package.json)
|
|
66
|
-
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
|
|
67
|
-
echo "New version: $NEW_VERSION"
|
|
68
|
-
|
|
69
|
-
- name: Install dependencies
|
|
70
|
-
run: npm ci
|
|
71
|
-
|
|
72
|
-
- name: Run tests
|
|
73
|
-
run: |
|
|
74
|
-
npm run test:types
|
|
75
|
-
npm run test:build
|
|
76
|
-
npm run test:cli
|
|
77
|
-
|
|
78
|
-
- name: Show changed files
|
|
79
|
-
run: |
|
|
80
|
-
echo "Changed files:"
|
|
81
|
-
git status --porcelain
|
|
82
|
-
|
|
83
|
-
- name: Create Pull Request
|
|
84
|
-
uses: peter-evans/create-pull-request@v4
|
|
85
|
-
with:
|
|
86
|
-
commit-message: "chore: bump version from ${{ steps.get_version.outputs.current_version }} to ${{ steps.bump_version.outputs.new_version }}"
|
|
87
|
-
title: "chore: bump version from ${{ steps.get_version.outputs.current_version }} to ${{ steps.bump_version.outputs.new_version }}"
|
|
88
|
-
body: |
|
|
89
|
-
This PR was automatically created by the Bump Version workflow.
|
|
90
|
-
|
|
91
|
-
## Changes
|
|
92
|
-
- Bumped version from **${{ steps.get_version.outputs.current_version }}** to **${{ steps.bump_version.outputs.new_version }}**
|
|
93
|
-
- Version bump type: **${{ github.event.inputs.version }}**
|
|
94
|
-
|
|
95
|
-
## Test Results
|
|
96
|
-
- Type checking: ✅ Passed
|
|
97
|
-
- Build test: ✅ Passed
|
|
98
|
-
- CLI test: ✅ Passed
|
|
99
|
-
|
|
100
|
-
🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
|
101
|
-
|
|
102
|
-
Co-Authored-By: Claude <noreply@anthropic.com>
|
|
103
|
-
branch: bump-version-${{ github.run_id }}
|
|
104
|
-
base: main
|
|
105
|
-
labels: |
|
|
106
|
-
automated-pr
|
|
107
|
-
version-bump
|
|
108
|
-
enhancement
|
|
109
|
-
token: ${{ secrets.GITHUB_TOKEN }}
|
|
110
|
-
add-paths: |
|
|
111
|
-
package.json
|
|
112
|
-
package-lock.json
|
package/.github/workflows/ci.yml
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
name: CI
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [main]
|
|
6
|
-
pull_request:
|
|
7
|
-
branches: [main]
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
test:
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
strategy:
|
|
13
|
-
matrix:
|
|
14
|
-
node-version: [22.x, 24.x]
|
|
15
|
-
|
|
16
|
-
steps:
|
|
17
|
-
- name: Checkout repository
|
|
18
|
-
uses: actions/checkout@v4
|
|
19
|
-
|
|
20
|
-
- name: Setup Node.js ${{ matrix.node-version }}
|
|
21
|
-
uses: actions/setup-node@v4
|
|
22
|
-
with:
|
|
23
|
-
node-version: ${{ matrix.node-version }}
|
|
24
|
-
cache: 'npm'
|
|
25
|
-
|
|
26
|
-
- name: Install dependencies
|
|
27
|
-
run: npm ci
|
|
28
|
-
|
|
29
|
-
- name: Run linting (if configured)
|
|
30
|
-
run: |
|
|
31
|
-
if [ -f .eslintrc.js ] || [ -f .eslintrc.json ] || [ -f .eslintrc ]; then
|
|
32
|
-
npx eslint src/ --ext .ts,.tsx
|
|
33
|
-
else
|
|
34
|
-
echo "No ESLint config found, skipping linting"
|
|
35
|
-
fi
|
|
36
|
-
|
|
37
|
-
- name: Type check
|
|
38
|
-
run: npx tsc --noEmit
|
|
39
|
-
|
|
40
|
-
- name: Run tests
|
|
41
|
-
run: npm test
|
|
42
|
-
|
|
43
|
-
- name: Build package
|
|
44
|
-
run: npm run build
|
|
45
|
-
|
|
46
|
-
security:
|
|
47
|
-
runs-on: ubuntu-latest
|
|
48
|
-
steps:
|
|
49
|
-
- name: Checkout repository
|
|
50
|
-
uses: actions/checkout@v4
|
|
51
|
-
|
|
52
|
-
- name: Setup Node.js
|
|
53
|
-
uses: actions/setup-node@v4
|
|
54
|
-
with:
|
|
55
|
-
node-version: '22.x'
|
|
56
|
-
|
|
57
|
-
- name: Install dependencies
|
|
58
|
-
run: npm ci
|
|
59
|
-
|
|
60
|
-
- name: Run npm audit
|
|
61
|
-
run: npm audit --audit-level=moderate
|
|
62
|
-
|
|
63
|
-
- name: Check for outdated dependencies
|
|
64
|
-
run: npm outdated || true
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
name: Deploy to GitHub Pages
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [main]
|
|
6
|
-
workflow_dispatch: # 允许手动触发
|
|
7
|
-
|
|
8
|
-
# 设置 GITHUB_TOKEN 的权限以允许部署到 GitHub Pages
|
|
9
|
-
permissions:
|
|
10
|
-
contents: read
|
|
11
|
-
pages: write
|
|
12
|
-
id-token: write
|
|
13
|
-
|
|
14
|
-
# 只允许一个并发部署,跳过正在运行的队列
|
|
15
|
-
concurrency:
|
|
16
|
-
group: 'pages'
|
|
17
|
-
cancel-in-progress: false
|
|
18
|
-
|
|
19
|
-
jobs:
|
|
20
|
-
build:
|
|
21
|
-
runs-on: ubuntu-latest
|
|
22
|
-
steps:
|
|
23
|
-
- name: Checkout repository
|
|
24
|
-
uses: actions/checkout@v4
|
|
25
|
-
with:
|
|
26
|
-
# 从远程分支开始时,需要先同步分支保证代码正确
|
|
27
|
-
fetch-depth: 0
|
|
28
|
-
ref: ${{ github.head_ref || github.ref }}
|
|
29
|
-
|
|
30
|
-
- name: Setup Node.js
|
|
31
|
-
uses: actions/setup-node@v4
|
|
32
|
-
with:
|
|
33
|
-
node-version: '24.x'
|
|
34
|
-
cache: 'npm'
|
|
35
|
-
|
|
36
|
-
- name: Install dependencies
|
|
37
|
-
run: npm install
|
|
38
|
-
|
|
39
|
-
- name: Create documentation site
|
|
40
|
-
run: |
|
|
41
|
-
npm run build:doc
|
|
42
|
-
|
|
43
|
-
- name: Setup Pages
|
|
44
|
-
uses: actions/configure-pages@v4
|
|
45
|
-
|
|
46
|
-
- name: Upload artifact
|
|
47
|
-
uses: actions/upload-pages-artifact@v3
|
|
48
|
-
with:
|
|
49
|
-
path: './.czon/dist'
|
|
50
|
-
|
|
51
|
-
deploy:
|
|
52
|
-
environment:
|
|
53
|
-
name: github-pages
|
|
54
|
-
url: ${{ steps.deployment.outputs.page_url }}
|
|
55
|
-
runs-on: ubuntu-latest
|
|
56
|
-
needs: build
|
|
57
|
-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
58
|
-
steps:
|
|
59
|
-
- name: Deploy to GitHub Pages
|
|
60
|
-
id: deployment
|
|
61
|
-
uses: actions/deploy-pages@v4
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
name: Publish to npm
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- main
|
|
7
|
-
workflow_dispatch: # 允许手动触发
|
|
8
|
-
|
|
9
|
-
permissions:
|
|
10
|
-
contents: read
|
|
11
|
-
id-token: write # 必需:用于 OIDC 认证
|
|
12
|
-
|
|
13
|
-
jobs:
|
|
14
|
-
publish-npm:
|
|
15
|
-
runs-on: ubuntu-latest
|
|
16
|
-
steps:
|
|
17
|
-
- name: Checkout repository
|
|
18
|
-
uses: actions/checkout@v4
|
|
19
|
-
with:
|
|
20
|
-
fetch-depth: 0
|
|
21
|
-
|
|
22
|
-
- name: Fetch all branches and tags
|
|
23
|
-
run: |
|
|
24
|
-
git fetch --all
|
|
25
|
-
git fetch --tags
|
|
26
|
-
|
|
27
|
-
- name: Setup Node.js for npm publish
|
|
28
|
-
uses: actions/setup-node@v4
|
|
29
|
-
with:
|
|
30
|
-
node-version: '24.x'
|
|
31
|
-
registry-url: 'https://registry.npmjs.org'
|
|
32
|
-
cache: 'npm'
|
|
33
|
-
|
|
34
|
-
- name: Update npm to latest version
|
|
35
|
-
run: npm install -g npm@latest
|
|
36
|
-
|
|
37
|
-
- name: Install dependencies
|
|
38
|
-
run: npm ci
|
|
39
|
-
|
|
40
|
-
- name: Run tests
|
|
41
|
-
run: npm test
|
|
42
|
-
|
|
43
|
-
- name: Build package
|
|
44
|
-
run: npm run build
|
|
45
|
-
|
|
46
|
-
- name: Verify build
|
|
47
|
-
run: |
|
|
48
|
-
ls -la dist/
|
|
49
|
-
test -f dist/index.js && test -f dist/cli.js
|
|
50
|
-
echo "Build verification successful"
|
|
51
|
-
|
|
52
|
-
- name: Check if version already published
|
|
53
|
-
id: check_version
|
|
54
|
-
run: |
|
|
55
|
-
# 获取当前 package.json 中的版本和包名
|
|
56
|
-
CURRENT_VERSION=$(node -p "require('./package.json').version")
|
|
57
|
-
PACKAGE_NAME=$(node -p "require('./package.json').name")
|
|
58
|
-
echo "Package name: $PACKAGE_NAME"
|
|
59
|
-
echo "Current version in package.json: $CURRENT_VERSION"
|
|
60
|
-
|
|
61
|
-
# 尝试从 npm 获取已发布的版本信息
|
|
62
|
-
if npm view $PACKAGE_NAME@$CURRENT_VERSION version > /dev/null 2>&1; then
|
|
63
|
-
echo "Version $CURRENT_VERSION is already published on npm"
|
|
64
|
-
echo "skip_publish=true" >> $GITHUB_OUTPUT
|
|
65
|
-
else
|
|
66
|
-
echo "Version $CURRENT_VERSION is not published yet"
|
|
67
|
-
echo "skip_publish=false" >> $GITHUB_OUTPUT
|
|
68
|
-
fi
|
|
69
|
-
env:
|
|
70
|
-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
71
|
-
|
|
72
|
-
- name: Check npm version
|
|
73
|
-
run: npm --version
|
|
74
|
-
|
|
75
|
-
- name: Publish to npm
|
|
76
|
-
if: steps.check_version.outputs.skip_publish == 'false'
|
|
77
|
-
run: |
|
|
78
|
-
echo "Attempting to publish to npm..."
|
|
79
|
-
npm publish --access public
|
|
80
|
-
env:
|
|
81
|
-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
package/.husky/pre-commit
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
npx lint-staged
|