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
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"webtime",
"wfhg",
"zcvf",
"Zhang",
"zrender"
],
"cSpell.ignorePaths": [
Expand Down
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,18 @@ All notable changes to Time Tracker will be documented in this file.

It is worth mentioning that the release time of each change refers to the time when the installation package is submitted to the webstore. It is about one week for Edge to moderate packages, while only 1-2 days for Chrome and Firefox.

## [3.3.4] - 2025-03-26

- Fixed some bugs

## [3.3.3] - 2025-03-22

- Fixed can't modify the name of site

## [3.3.2] - 2025-03-20

- Fixed Reddit not blocked correctly


## [3.3.1] - 2025-03-16

- Modified the English name of the extension
Expand Down
13 changes: 9 additions & 4 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,20 @@ const sourcePattern = /^(.*)\/\*$/
const moduleNameMapper: { [key: string]: string } = {}

Object.entries(paths).forEach(([alias, sourceArr]) => {
if (!aliasPattern.test(alias)) {
const aliasMatch = alias.match(aliasPattern)
if (!aliasMatch) {
return
}
if (sourceArr.length !== 1 || !sourcePattern.test(sourceArr[0])) {
if (sourceArr.length !== 1) {
return
}
const prefix = alias.match(aliasPattern)[1]
const sourceMath = sourceArr[0]?.match(sourcePattern)
if (!sourceMath) {
return
}
const prefix = aliasMatch[1]
const pattern = `^${prefix}/(.*)$`
const source = sourceArr[0].match(sourcePattern)[1]
const source = sourceMath[1]
const sourcePath = `<rootDir>/${source}/$1`
moduleNameMapper[pattern] = sourcePath
})
Expand Down
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "timer",
"version": "3.3.2",
"version": "3.3.4",
"description": "Time tracker",
"homepage": "https://www.wfhg.cc",
"scripts": {
Expand All @@ -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 All @@ -33,7 +34,7 @@
"@rsdoctor/webpack-plugin": "^1.0.0",
"@swc/core": "^1.11.11",
"@swc/jest": "^0.2.37",
"@types/chrome": "0.0.310",
"@types/chrome": "0.0.312",
"@types/decompress": "^4.2.7",
"@types/echarts": "^5.0.0",
"@types/generate-json-webpack-plugin": "^0.3.7",
Expand All @@ -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 All @@ -75,7 +78,7 @@
"@vueuse/core": "^13.0.0",
"countup.js": "^2.8.0",
"echarts": "^5.6.0",
"element-plus": "2.9.6",
"element-plus": "2.9.7",
"js-base64": "^3.7.7",
"punycode": "^2.3.1",
"stream-browserify": "^3.0.0",
Expand Down
Loading