Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .commitlintrc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import {
RuleConfigCondition,
RuleConfigSeverity,
TargetCaseType
} from "@commitlint/types"

export default {
rules: {
"body-leading-blank": [RuleConfigSeverity.Error, "always"] as const,
"body-max-line-length": [RuleConfigSeverity.Error, "always", 100] as const,
"footer-leading-blank": [RuleConfigSeverity.Warning, "never"] as const,
"footer-max-line-length": [
RuleConfigSeverity.Error,
"always",
100,
] as const,
"header-max-length": [RuleConfigSeverity.Error, "always", 100] as const,
"header-trim": [RuleConfigSeverity.Error, "always"] as const,
"subject-case": [
RuleConfigSeverity.Error,
"never",
["sentence-case", "start-case", "pascal-case", "upper-case"],
] as [RuleConfigSeverity, RuleConfigCondition, TargetCaseType[]],
"subject-empty": [RuleConfigSeverity.Error, "never"] as const,
"subject-full-stop": [RuleConfigSeverity.Error, "never", "."] as const,
"type-case": [RuleConfigSeverity.Error, "always", "lower-case"] as const,
"type-empty": [RuleConfigSeverity.Error, "never"] as const,
"type-enum": [
RuleConfigSeverity.Error,
"always",
[
"build",
"chore",
"ci",
"docs",
"feat",
"fix",
"perf",
"refactor",
"revert",
"style",
"test",
],
] satisfies [RuleConfigSeverity, RuleConfigCondition, string[]],
},
prompt: {},
}
43 changes: 43 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Publish to extension/addon store
on:
push:
branches:
- "release"
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
uses: actions/setup-node@v1
with:
node-version: "v20.11.0"
- run: npm install
- name: Build for MV3
run: npm run build
- name: Build for Firefox
run: npm run build:firefox
- name: Upload to chrome webstore
uses: mnao305/chrome-extension-upload@v5.0.0
with:
file-path: market_packages/target.zip
extension-id: dkdhhcbjijekmneelocdllcldcpmekmm
client-id: ${{ secrets.CHROME_CLIENT_ID }}
client-secret: ${{ secrets.CHROME_CLIENT_SECRET }}
refresh-token: ${{ secrets.CHROME_REFRESH_TOKEN }}
# publish: false # Not to publish
- name: Upload to Edge addon store
uses: wdzeng/edge-addon@v2
with:
zip-path: market_packages/target.zip
product-id: 2a99ae83-5ec8-4ad2-aa63-9a276fc708ce
client-id: ${{ secrets.EDGE_CLIENT_ID }}
api-key: ${{ secrets.EDGE_API_KEY}}
upload-only: true # Not to publish
- name: Upload to Firefox addon store
uses: cardinalby/webext-buildtools-firefox-addons-action@v1
with:
extensionId: '{7b312f5e-9680-436b-acc1-9b09f60e8aaa}'
zipFilePath: market_packages/target.firefox.zip
jwtIssuer: ${{ secrets.FIREFOX_API_KEY }}
jwtSecret: ${{ secrets.FIREFOX_API_SECRET }}
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx --no -- commitlint --edit $1
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"analyze": "webpack --config=webpack/webpack.analyze.ts",
"test": "jest --env=jsdom test/",
"test-c": "jest --coverage --reporters=jest-junit --env=jsdom test/",
"test-e2e": "jest test-e2e/ --runInBand"
"test-e2e": "jest test-e2e/ --runInBand",
"prepare": "husky"
},
"author": {
"name": "zhy",
Expand Down Expand Up @@ -43,13 +44,15 @@
"@types/webpack": "^5.28.5",
"@vue/babel-plugin-jsx": "^1.4.0",
"babel-loader": "^10.0.0",
"commitlint": "^19.8.0",
"copy-webpack-plugin": "^13.0.0",
"css-loader": "^7.1.2",
"decompress": "^4.2.1",
"eslint": "^9.22.0",
"filemanager-webpack-plugin": "^8.0.0",
"generate-json-webpack-plugin": "^2.0.0",
"html-webpack-plugin": "^5.6.3",
"husky": "^9.1.7",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest-junit": "^16.0.0",
Expand Down
4 changes: 4 additions & 0 deletions webpack/webpack.prod.firefox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const outputPath = path.resolve(__dirname, '..', 'dist_prod_firefox')
const marketPkgPath = path.resolve(__dirname, '..', 'market_packages')

const normalZipFilePath = path.resolve(marketPkgPath, `${name}-${version}.firefox.zip`)
const targetZipFilePath = path.resolve(marketPkgPath, 'target.firefox.zip')
const sourceCodePath = path.resolve(__dirname, '..', 'market_packages', `${name}-${version}-src.zip`)
const readmeForFirefox = path.join(__dirname, '..', 'doc', 'for-fire-fox.md')
// Temporary directory for source code to archive on Firefox
Expand All @@ -28,6 +29,9 @@ const filemanagerWebpackPlugin = new FileManagerWebpackPlugin({
archive: [{
source: outputPath,
destination: normalZipFilePath,
}, {
source: outputPath,
destination: targetZipFilePath,
}]
},
// Archive source code for FireFox
Expand Down
4 changes: 4 additions & 0 deletions webpack/webpack.prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const outputPath = path.resolve(__dirname, '..', 'dist_prod')
const marketPkgPath = path.resolve(__dirname, '..', 'market_packages')

const normalZipFilePath = path.resolve(marketPkgPath, `${name}-${version}.mv3.zip`)
const targetZipFilePath = path.resolve(marketPkgPath, `target.zip`)

const filemanagerWebpackPlugin = new FileManagerWebpackPlugin({
events: {
Expand All @@ -22,6 +23,9 @@ const filemanagerWebpackPlugin = new FileManagerWebpackPlugin({
archive: [{
source: outputPath,
destination: normalZipFilePath,
}, {
source: outputPath,
destination: targetZipFilePath,
}]
},
]
Expand Down