diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 41f2fa4..ceabe57 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,6 +32,9 @@ jobs: - name: Build and zip Chrome extension run: pnpm run zip + - name: Build and pack Chrome CRX extension + run: pnpm run crx + - name: Build and zip Firefox extension run: pnpm run zip:firefox @@ -40,6 +43,7 @@ jobs: with: files: | .output/inkcre-*-chrome.zip + .output/inkcre-*-chrome.crx .output/inkcre-*-firefox.zip generate_release_notes: true draft: false diff --git a/README.md b/README.md index 0d62c7b..210776b 100644 --- a/README.md +++ b/README.md @@ -45,15 +45,19 @@ pnpm run build:firefox ### 打包 ```bash -# 打包 Chrome 版本 +# 打包 Chrome 版本(ZIP) pnpm run zip +# 打包 Chrome 版本(CRX) +pnpm run crx + # 打包 Firefox 版本 pnpm run zip:firefox ``` 打包后的文件位于 `.output/` 目录: -- `inkcre-{version}-chrome.zip` - Chrome 扩展包 +- `inkcre-{version}-chrome.zip` - Chrome 扩展包(ZIP 格式) +- `inkcre-{version}-chrome.crx` - Chrome 扩展包(CRX 格式,用于发布) - `inkcre-{version}-firefox.zip` - Firefox 扩展包 - `inkcre-{version}-sources.zip` - 源代码包(仅 Firefox) @@ -88,9 +92,9 @@ pnpm run typecheck 2. GitHub Actions 会自动: - 构建 Chrome 和 Firefox 版本 - - 打包扩展 + - 打包扩展(ZIP 和 CRX 格式) - 创建 GitHub Release - - 上传扩展包到 Release + - 上传扩展包到 Release(包含 `.zip` 和 `.crx` 文件) 3. 用户可以从 [Releases 页面](https://github.com/InKCre/client-webext/releases) 下载最新版本 @@ -98,12 +102,17 @@ pnpm run typecheck #### Chrome/Edge -1. 从 [Releases](https://github.com/InKCre/client-webext/releases) 下载 `inkcre-*-chrome.zip` -2. 解压文件 -3. 打开浏览器扩展管理页面(`chrome://extensions/` 或 `edge://extensions/`) -4. 启用"开发者模式" -5. 点击"加载已解压的扩展程序" -6. 选择解压后的文件夹 +1. 从 [Releases](https://github.com/InKCre/client-webext/releases) 下载 `inkcre-*-chrome.zip` 或 `inkcre-*-chrome.crx` +2. **对于 ZIP 文件**: + - 解压文件 + - 打开浏览器扩展管理页面(`chrome://extensions/` 或 `edge://extensions/`) + - 启用"开发者模式" + - 点击"加载已解压的扩展程序" + - 选择解压后的文件夹 +3. **对于 CRX 文件**: + - 打开浏览器扩展管理页面(`chrome://extensions/` 或 `edge://extensions/`) + - 将 `.crx` 文件拖放到浏览器窗口中 + - 确认安装 #### Firefox diff --git a/package.json b/package.json index dfa3de9..67d0e20 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "build:firefox": "wxt build -b firefox", "zip": "wxt zip", "zip:firefox": "wxt zip -b firefox", + "crx": "wxt build && crx3 -p .output/inkcre.pem -o .output/inkcre-$npm_package_version-chrome.crx .output/chrome-mv3", "compile": "vue-tsc --noEmit", "postinstall": "wxt prepare", "typecheck": "tsc --noEmit" @@ -34,6 +35,7 @@ "@types/wink-tokenizer": "^4.0.6", "@unocss/preset-uno": "^66.5.1", "@wxt-dev/module-vue": "^1.0.2", + "crx3": "^1.1.3", "typescript": "^5.9.2", "unocss": "^66.5.1", "vue-tsc": "^3.0.6", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9dcf428..a32e9a9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -57,6 +57,9 @@ importers: '@wxt-dev/module-vue': specifier: ^1.0.2 version: 1.0.3(vite@7.1.12(@types/node@22.18.12)(jiti@2.6.1))(vue@3.5.22(typescript@5.9.3))(wxt@0.20.11(@types/node@22.18.12)(jiti@2.6.1)(rollup@4.52.5)) + crx3: + specifier: ^1.1.3 + version: 1.1.3 typescript: specifier: ^5.9.2 version: 5.9.3 @@ -774,6 +777,9 @@ packages: resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} engines: {node: '>=8'} + buffer-crc32@0.2.13: + resolution: {integrity: sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==} + buffer-from@1.1.2: resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} @@ -886,6 +892,11 @@ packages: core-util-is@1.0.3: resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==} + crx3@1.1.3: + resolution: {integrity: sha512-E4c3y/2ak83wAGN4h9Q8j3A2ii4bpRVf2vxinYYy+wJs8pyscMfEnKGzhgngZcRfOhUMr7/sxzy+lTZmQ/4KpQ==} + engines: {node: '>=12'} + hasBin: true + css-select@5.2.2: resolution: {integrity: sha512-TizTzUddG/xYLA3NXodFM0fSbNizXjOKhqiQQwvhlspadZokn1KDy0NZFS0wuEubIYAV5/c1/lAr0TaaFXEXzw==} @@ -1159,6 +1170,9 @@ packages: htmlparser2@10.0.0: resolution: {integrity: sha512-TwAZM+zE5Tq3lrEHvOlvwgj1XLWQCtaaibSN11Q+gGBAS7Y1uZSWwXXRe4iF6OXnaq1riyQAPFOBtYc77Mxq0g==} + ieee754@1.2.1: + resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} + immediate@3.0.6: resolution: {integrity: sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==} @@ -1430,6 +1444,10 @@ packages: mlly@1.8.0: resolution: {integrity: sha512-l8D9ODSRWLe2KHJSifWGwBqpTZXIXTeo8mlKjY+E2HAakaTeNpqAyBZ8GSqLzHgw4XmHmC8whvpjJNMbFZN7/g==} + mri@1.2.0: + resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==} + engines: {node: '>=4'} + mrmime@2.0.1: resolution: {integrity: sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ==} engines: {node: '>=10'} @@ -1529,6 +1547,10 @@ packages: pathe@2.0.3: resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==} + pbf@3.3.0: + resolution: {integrity: sha512-XDF38WCH3z5OV/OVa8GKUNtLAyneuzbCisx7QUCF8Q6Nutx0WnJrQe5O+kOtBlLfRNUws98Y58Lblp+NJG5T4Q==} + hasBin: true + perfect-debounce@1.0.0: resolution: {integrity: sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==} @@ -1583,6 +1605,9 @@ packages: proto-list@1.2.4: resolution: {integrity: sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==} + protocol-buffers-schema@3.6.0: + resolution: {integrity: sha512-TdDRD+/QNdrCGCE7v8340QyuXd4kIWIgapsE2+n/SaGiSSbomYl4TjHlvIoCWRpE7wFt02EpB35VVA2ImcBVqw==} + publish-browser-extension@3.0.3: resolution: {integrity: sha512-cBINZCkLo7YQaGoUvEHthZ0sDzgJQht28IS+SFMT2omSNhGsPiVNRkWir3qLiTrhGhW9Ci2KVHpA1QAMoBdL2g==} hasBin: true @@ -1638,6 +1663,9 @@ packages: resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} engines: {node: '>=0.10.0'} + resolve-protobuf-schema@2.1.0: + resolution: {integrity: sha512-kI5ffTiZWmJaS/huM8wZfEMer1eRd7oJQhDuxeCLe3t7N7mX3z94CN0xPxBQxFYQTSNz9T0i+v6inKqSdK8xrQ==} + restore-cursor@5.1.0: resolution: {integrity: sha512-oMA2dcrw6u0YfxJQXm342bFKX/E4sG9rbTzO9ptUcR/e8A33cHuvStiYOwH7fszkZlZ1z/ta9AAoPk2F4qIOHA==} engines: {node: '>=18'} @@ -2052,6 +2080,9 @@ packages: resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==} engines: {node: '>=12'} + yazl@2.5.1: + resolution: {integrity: sha512-phENi2PLiHnHb6QBVot+dJnaAZ0xosj7p3fWl+znIjBDlnMI2PsZCJZ306BPTFOaHf5qdDEI8x5qFrSOBN5vrw==} + zip-dir@2.0.0: resolution: {integrity: sha512-uhlsJZWz26FLYXOD6WVuq+fIcZ3aBPGo/cFdiLlv3KNwpa52IF3ISV8fLhQLiqVu5No3VhlqlgthN6gehil1Dg==} @@ -2753,6 +2784,8 @@ snapshots: dependencies: fill-range: 7.1.1 + buffer-crc32@0.2.13: {} + buffer-from@1.1.2: {} bundle-name@4.1.0: @@ -2875,6 +2908,12 @@ snapshots: core-util-is@1.0.3: {} + crx3@1.1.3: + dependencies: + mri: 1.2.0 + pbf: 3.3.0 + yazl: 2.5.1 + css-select@5.2.2: dependencies: boolbase: 1.0.0 @@ -3126,6 +3165,8 @@ snapshots: domutils: 3.2.2 entities: 6.0.1 + ieee754@1.2.1: {} + immediate@3.0.6: {} import-meta-resolve@4.2.0: {} @@ -3360,6 +3401,8 @@ snapshots: pkg-types: 1.3.1 ufo: 1.6.1 + mri@1.2.0: {} + mrmime@2.0.1: {} ms@2.1.3: {} @@ -3470,6 +3513,11 @@ snapshots: pathe@2.0.3: {} + pbf@3.3.0: + dependencies: + ieee754: 1.2.1 + resolve-protobuf-schema: 2.1.0 + perfect-debounce@1.0.0: {} perfect-debounce@2.0.0: {} @@ -3533,6 +3581,8 @@ snapshots: proto-list@1.2.4: {} + protocol-buffers-schema@3.6.0: {} + publish-browser-extension@3.0.3: dependencies: cac: 6.7.14 @@ -3596,6 +3646,10 @@ snapshots: require-directory@2.1.1: {} + resolve-protobuf-schema@2.1.0: + dependencies: + protocol-buffers-schema: 3.6.0 + restore-cursor@5.1.0: dependencies: onetime: 7.0.0 @@ -4103,6 +4157,10 @@ snapshots: y18n: 5.0.8 yargs-parser: 21.1.1 + yazl@2.5.1: + dependencies: + buffer-crc32: 0.2.13 + zip-dir@2.0.0: dependencies: async: 3.2.6