Skip to content

Commit e4dd128

Browse files
sheepzhMarenzdependabot[bot]
authored
v3.4.0
* Fix second firefox addon link in README.md (#441) * ci: upgrade the version (#443) * v3.3.5 * Bump @types/chrome from 0.0.312 to 0.0.313 (#442) Bumps [@types/chrome](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/chrome) from 0.0.312 to 0.0.313. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/chrome) --- updated-dependencies: - dependency-name: "@types/chrome" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * v3.4.0 * feat: lock limit rule (#338, #407) * i18n(zh_TW): optimize the texts by deepseek * test: fix e2e cases * test: fix e2e cases * feat: support caching filter value for the report page (#449) (#451) * refactor: refactor with provider (#453) * test: use localhost for example pages * ci: fix end-to-end tests * feat: simplify URL configuration for time limit rules (#424) (#455) * ci: removed old translations when sync * v3.4.0 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Mathias L. Baumann <Marenz@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent d30f308 commit e4dd128

File tree

152 files changed

+3383
-3634
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+3383
-3634
lines changed

.commitlintrc.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export default {
4040
"revert",
4141
"style",
4242
"test",
43+
"i18n",
4344
],
4445
] satisfies [RuleConfigSeverity, RuleConfigCondition, string[]],
4546
},

.github/workflows/end-to-end-tests.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,20 @@ jobs:
99
uses: actions/setup-node@v1
1010
with:
1111
node-version: "v20.11.0"
12-
- run: npm install
12+
- name: Install dependencies
13+
run: npm install
14+
- name: Install http-server
15+
run: npm install -g http-server pm2
1316
- name: Build e2e outputs
1417
run: npm run dev:e2e
1518
- name: Build production outputs
1619
run: npm run build
1720

21+
- name: Start up mock server
22+
run: |
23+
pm2 start 'http-server ./test-e2e/example -p 12345'
24+
pm2 start 'http-server ./test-e2e/example -p 12346'
25+
1826
- name: Run tests
1927
env:
2028
USE_HEADLESS_PUPPETEER: true

.github/workflows/publish-firefox.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on:
33
push:
44
branches:
55
- "release"
6+
workflow_dispatch:
67
jobs:
78
publish:
89
runs-on: ubuntu-latest
@@ -19,9 +20,10 @@ jobs:
1920
- name: Build
2021
run: npm run build:firefox
2122
- name: Upload to Firefox addon store
22-
uses: wdzeng/firefox-addon@v1
23+
uses: wdzeng/firefox-addon@v1.2.0-alpha.0
2324
with:
2425
addon-guid: "{a8cf72f7-09b7-4cd4-9aaa-7a023bf09916}"
2526
xpi-path: market_packages/target.firefox.zip
27+
compatibility: firefox, android
2628
jwt-issuer: ${{ secrets.FIREFOX_JWD_ISSUER }}
2729
jwt-secret: ${{ secrets.FIREFOX_JWD_SECRET }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ package-lock.json
2929
aaa
3030

3131
user-chart.svg
32+
test.log

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"COPYFILE",
2020
"countup",
2121
"daterange",
22+
"delayable",
2223
"domcontentloaded",
2324
"dont",
2425
"echarts",
@@ -29,6 +30,7 @@
2930
"Kanban",
3031
"MKCOL",
3132
"newtab",
33+
"nohup",
3234
"okey",
3335
"Openeds",
3436
"Popconfirm",
@@ -38,6 +40,7 @@
3840
"rtlcss",
3941
"selectchanged",
4042
"sheepzh",
43+
"subpages",
4144
"Treemap",
4245
"Vnode",
4346
"vueuse",

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to Time Tracker will be documented in this file.
44

55
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.
66

7+
## [3.4.0] - 2025-04-20
8+
9+
- Supported to lock the limit rule
10+
- Optimized the translations of Traditional Chinese
11+
- Simplified URL configuration for time limit rules
12+
713
## [3.3.4] - 2025-03-26
814

915
- Fixed some bugs

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ In addition to Simplified Chinese, the other localized languages of this softwar
7171

7272
#### 4. Rate 5 stars
7373

74-
[Firefox](https://addons.mozilla.org/zh-CN/firefox/addon/web%E6%99%82%E9%96%93%E7%B5%B1%E8%A8%88/) / [Chrome](https://chrome.google.com/webstore/detail/%E7%BD%91%E8%B4%B9%E5%BE%88%E8%B4%B5-%E4%B8%8A%E7%BD%91%E6%97%B6%E9%97%B4%E7%BB%9F%E8%AE%A1/dkdhhcbjijekmneelocdllcldcpmekmm) / [Edge](https://microsoftedge.microsoft.com/addons/detail/timer-the-web-time-is-e/fepjgblalcnepokjblgbgmapmlkgfahc)
74+
[Firefox](https://addons.mozilla.org/firefox/addon/besttimetracker) / [Chrome](https://chrome.google.com/webstore/detail/%E7%BD%91%E8%B4%B9%E5%BE%88%E8%B4%B5-%E4%B8%8A%E7%BD%91%E6%97%B6%E9%97%B4%E7%BB%9F%E8%AE%A1/dkdhhcbjijekmneelocdllcldcpmekmm) / [Edge](https://microsoftedge.microsoft.com/addons/detail/timer-the-web-time-is-e/fepjgblalcnepokjblgbgmapmlkgfahc)
7575

7676
It's simple and much helpful!
7777

package.json

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "timer",
3-
"version": "3.3.4",
3+
"version": "3.4.0",
44
"description": "Time tracker",
55
"homepage": "https://www.wfhg.cc",
66
"scripts": {
@@ -30,16 +30,15 @@
3030
"devDependencies": {
3131
"@babel/plugin-transform-modules-commonjs": "^7.26.3",
3232
"@babel/preset-env": "^7.26.9",
33-
"@crowdin/crowdin-api-client": "^1.41.2",
34-
"@rsdoctor/webpack-plugin": "^1.0.0",
35-
"@swc/core": "^1.11.11",
33+
"@crowdin/crowdin-api-client": "^1.42.0",
34+
"@rsdoctor/webpack-plugin": "^1.0.2",
35+
"@swc/core": "^1.11.21",
3636
"@swc/jest": "^0.2.37",
37-
"@types/chrome": "0.0.312",
37+
"@types/chrome": "0.0.315",
3838
"@types/decompress": "^4.2.7",
39-
"@types/echarts": "^5.0.0",
4039
"@types/generate-json-webpack-plugin": "^0.3.7",
4140
"@types/jest": "^29.5.14",
42-
"@types/node": "^22.13.10",
41+
"@types/node": "^22.14.1",
4342
"@types/punycode": "^2.1.4",
4443
"@types/webpack": "^5.28.5",
4544
"@vue/babel-plugin-jsx": "^1.4.0",
@@ -48,7 +47,7 @@
4847
"copy-webpack-plugin": "^13.0.0",
4948
"css-loader": "^7.1.2",
5049
"decompress": "^4.2.1",
51-
"eslint": "^9.22.0",
50+
"eslint": "^9.25.0",
5251
"filemanager-webpack-plugin": "^8.0.0",
5352
"generate-json-webpack-plugin": "^2.0.0",
5453
"html-webpack-plugin": "^5.6.3",
@@ -59,26 +58,26 @@
5958
"mini-css-extract-plugin": "^2.9.2",
6059
"postcss": "^8.5.3",
6160
"postcss-loader": "^8.1.1",
62-
"postcss-rtlcss": "^5.6.0",
63-
"puppeteer": "^24.4.0",
64-
"sass": "^1.86.0",
61+
"postcss-rtlcss": "^5.7.0",
62+
"puppeteer": "^24.6.1",
63+
"sass": "^1.86.3",
6564
"sass-loader": "^16.0.5",
6665
"style-loader": "^4.0.0",
6766
"ts-loader": "^9.5.2",
6867
"ts-node": "^10.9.2",
6968
"tsconfig-paths": "^4.2.0",
70-
"typescript": "5.8.2",
69+
"typescript": "5.8.3",
7170
"url-loader": "^4.1.1",
7271
"web-ext": "^8.5.0",
73-
"webpack": "^5.98.0",
72+
"webpack": "^5.99.6",
7473
"webpack-cli": "^6.0.1"
7574
},
7675
"dependencies": {
7776
"@element-plus/icons-vue": "^2.3.1",
78-
"@vueuse/core": "^13.0.0",
77+
"@vueuse/core": "^13.1.0",
7978
"countup.js": "^2.8.0",
8079
"echarts": "^5.6.0",
81-
"element-plus": "2.9.7",
80+
"element-plus": "2.9.8",
8281
"js-base64": "^3.7.7",
8382
"punycode": "^2.3.1",
8483
"stream-browserify": "^3.0.0",

script/crowdin/client.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,12 +253,15 @@ export class CrowdinClient {
253253
console.log("=========end to delete strings========")
254254
}
255255

256-
async existTranslationByStringAndLang(transKey: TranslationKey): Promise<boolean> {
256+
async listTranslationByStringAndLang(transKey: TranslationKey): Promise<StringTranslationsModel.StringTranslation[]> {
257257
const { stringId, lang } = transKey
258-
const trans = await new PaginationIterator(
258+
return await new PaginationIterator(
259259
p => this.crowdin.stringTranslationsApi.listStringTranslations(PROJECT_ID, stringId, lang, { ...p })
260-
).findFirst(_ => true)
261-
return !!trans
260+
).findAll()
261+
}
262+
263+
async deleteTranslation(translationId: number): Promise<void> {
264+
await this.crowdin.stringTranslationsApi.deleteTranslation(PROJECT_ID, translationId)
262265
}
263266

264267
async createTranslation(transKey: TranslationKey, text: string) {

script/crowdin/sync-translation.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import {
99
checkMainBranch, crowdinLangOf, isIgnored, readAllMessages, transMsg,
1010
} from "./common"
1111

12+
const CROWDIN_USER_ID_OF_OWNER = 15266594
13+
1214
async function processDirMessage(client: CrowdinClient, file: SourceFilesModel.File, message: ItemSet, lang: CrowdinLanguage): Promise<void> {
1315
console.log(`Start to process dir message: fileName=${file.name}, lang=${lang}`)
1416
const strings = await client.listStringsByFile(file.id)
@@ -24,13 +26,18 @@ async function processDirMessage(client: CrowdinClient, file: SourceFilesModel.F
2426
console.log(`Translation same as origin text of ${string.identifier} in ${file.path}`)
2527
continue
2628
}
27-
const exist = await client.existTranslationByStringAndLang({ stringId: string.id, lang })
28-
if (exist) {
29-
// Already exist, not sync
30-
continue
29+
const existList = await client.listTranslationByStringAndLang({ stringId: string.id, lang })
30+
// Deleted old translations different from current
31+
const oldByOwner = existList?.filter(t => t?.user?.id === CROWDIN_USER_ID_OF_OWNER && t.text !== text)
32+
for (const toDelete of oldByOwner || []) {
33+
await client.deleteTranslation(toDelete.id)
34+
console.log(`Deleted translation by owner: stringId=${string.id}, lang=${lang}, text=${toDelete.text}`)
35+
}
36+
if (!existList?.find(t => t.text === text)) {
37+
// Create new translation
38+
await client.createTranslation({ stringId: string.id, lang }, text)
39+
console.log(`Created trans: stringId=${string.id}, lang=${lang}, text=${text}`)
3140
}
32-
await client.createTranslation({ stringId: string.id, lang }, text)
33-
console.log(`Created trans: stringId=${string.id}, lang=${lang}, text=${text}`)
3441
}
3542
}
3643

0 commit comments

Comments
 (0)