chore: enable i18n-unused GH action in `website` (#10296)

* regen yarn.lock?

* chore: enable i18n-unused GH action in `website`

* Generated yarn.lock with submodules

* Added yarn.lock auth

---------

Co-authored-by: Alex van Andel <me@alexvanandel.com>
pull/10359/head
Richard Poelderl 2023-07-25 19:30:18 +02:00 committed by GitHub
parent db80afce40
commit 829a103f6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 103 additions and 29 deletions

35
i18n-unused.config.js Normal file
View File

@ -0,0 +1,35 @@
const path = require("path");
/**
* # Regex for translation keys
* This regex matches the following function calls:
* 1. `t("<some_key>")`,
* 2. `t("<some_key>", {key: "<some_string>"})`, or
* 3. `<Trans i18nKey="home_hero_subtitle" t={t}>`
*
* It also ensure that we don't match any other similar function calls (e.g. `format("dddd")`).
*
* ## Explanation of the regex
* - (?<!\w): negative lookbehind to ensure that there is no word character before "t" or "i18nKey"
* - (?: ... ): non-capturing group
* - t: for the use of `t("..")` OR `t("..", {key: ".."})`
* - \(("[^"]*"): captures a string enclosed in double quotes followed by an opening parenthesis
* - (?:,\s*\{[^}]*\})?: optional non-capturing group so that we match the optional interpolation object
* - i18nKey=".+"[^\w]: for the usage of `<Trans i18nKey="home_hero_subtitle" t={t}>`
*
* */
const translationKeyRegex = /(?<!\w)(?:t\(("[^"]*")(?:,\s*\{[^}]*\})?\)|i18nKey=".+"[^\w])/gi;
/** @type {import("i18n-unused/src/types/index.ts").RunOptions} */
const config = {
// localesPath: localePath, // uncomment to run on all locales (to calculate kb savings)
localesPath: path.join("./apps/website", "/public/static/locales", "/en"),
srcPath: "./apps/website",
srcExtensions: ["ts", "tsx"],
translationContextSeparator: ":",
translationKeyMatcher: translationKeyRegex,
missedTranslationParser: translationKeyRegex,
ignorePaths: ["node_modules", ".next"],
};
module.exports = config;

View File

@ -82,6 +82,7 @@
"c8": "^7.13.0",
"dotenv-checker": "^1.1.5",
"husky": "^8.0.0",
"i18n-unused": "^0.13.0",
"jest-diff": "^29.5.0",
"jsdom": "^22.0.0",
"lint-staged": "^12.5.0",

View File

@ -4954,6 +4954,7 @@ __metadata:
globby: ^13.1.3
gray-matter: ^4.0.3
gsap: ^3.11.0
i18n-unused: ^0.13.0
iframe-resizer-react: ^1.1.0
keen-slider: ^6.8.0
lucide-react: ^0.171.0
@ -7784,14 +7785,14 @@ __metadata:
languageName: node
linkType: hard
"@prisma/debug@npm:4.15.0":
version: 4.15.0
resolution: "@prisma/debug@npm:4.15.0"
"@prisma/debug@npm:5.0.0":
version: 5.0.0
resolution: "@prisma/debug@npm:5.0.0"
dependencies:
"@types/debug": 4.1.8
debug: 4.3.4
strip-ansi: 6.0.1
checksum: d911fbe540e2f6ecb3912fb871bedef63a6ded94e5f012b5afb580baf44c44dfddff095b22dbf9482bc62411217588892d723a42f0e8c497c20b9354e45ec081
checksum: 17d720717fab190a94762b90f93cfde799f419bfd2fee05c145566d6fa31d59d86dede80417234094afc5fff6d684ce350c17d40c302b26610ee60fe56c704e9
languageName: node
linkType: hard
@ -7809,18 +7810,6 @@ __metadata:
languageName: node
linkType: hard
"@prisma/generator-helper@npm:^4.0.0":
version: 4.15.0
resolution: "@prisma/generator-helper@npm:4.15.0"
dependencies:
"@prisma/debug": 4.15.0
"@types/cross-spawn": 6.0.2
cross-spawn: 7.0.3
kleur: 4.1.5
checksum: a8692468b05a34b397bf7acc6fa71047ef7faaaa2208a14daac05efb80692a8592ec48c748bbe44e656095dc4fdaf2c77cd3b5bab2e29bce856ff6b0dac275ea
languageName: node
linkType: hard
"@prisma/generator-helper@npm:^4.13.0":
version: 4.13.0
resolution: "@prisma/generator-helper@npm:4.13.0"
@ -7833,6 +7822,18 @@ __metadata:
languageName: node
linkType: hard
"@prisma/generator-helper@npm:^5.0.0":
version: 5.0.0
resolution: "@prisma/generator-helper@npm:5.0.0"
dependencies:
"@prisma/debug": 5.0.0
"@types/cross-spawn": 6.0.2
cross-spawn: 7.0.3
kleur: 4.1.5
checksum: 3506c9f23d2a7afcf4b99ad264f15efc7873f5e2ff9a7246a770c9ea7e7df627226a2e736890556c495cae3b0d1feaa3fd087417974500feaea14fb6da9dd0b0
languageName: node
linkType: hard
"@prisma/generator-helper@npm:~3.8.1":
version: 3.8.1
resolution: "@prisma/generator-helper@npm:3.8.1"
@ -15698,6 +15699,7 @@ __metadata:
dotenv-checker: ^1.1.5
eslint: ^8.34.0
husky: ^8.0.0
i18n-unused: ^0.13.0
jest-diff: ^29.5.0
jsdom: ^22.0.0
lint-staged: ^12.5.0
@ -16647,7 +16649,7 @@ __metadata:
languageName: node
linkType: hard
"commander@npm:^8.3.0":
"commander@npm:^8.0.0, commander@npm:^8.3.0":
version: 8.3.0
resolution: "commander@npm:8.3.0"
checksum: 0f82321821fc27b83bd409510bb9deeebcfa799ff0bf5d102128b500b7af22872c0c92cb6a0ebc5a4cf19c6b550fba9cedfa7329d18c6442a625f851377bacf0
@ -19426,6 +19428,13 @@ __metadata:
languageName: node
linkType: hard
"esm@npm:^3.2.25":
version: 3.2.25
resolution: "esm@npm:3.2.25"
checksum: 978aabe2de83541c105605a6d60a26ed8e627ef6bb0a7605fe15a95bbdea6b8348bd045255cb22219c054dd09a81a94823df00843d9e97f42419c92015ce3a64
languageName: node
linkType: hard
"espree@npm:9.2.0":
version: 9.2.0
resolution: "espree@npm:9.2.0"
@ -22398,6 +22407,19 @@ __metadata:
languageName: node
linkType: hard
"i18n-unused@npm:^0.13.0":
version: 0.13.0
resolution: "i18n-unused@npm:0.13.0"
dependencies:
commander: ^8.0.0
esm: ^3.2.25
ts-import: ^2.0.39
bin:
i18n-unused: bin/i18n-unused.cjs
checksum: 000ad439edda9abf27ef3041ea96135f1b8a23632764ad6dad781fdf3e7483235e4fc863480707624f3ad2c48b555d5195b367fb3bbd54ac2e41c9ebcb88f8b5
languageName: node
linkType: hard
"i18next-fs-backend@npm:^2.1.1":
version: 2.1.3
resolution: "i18next-fs-backend@npm:2.1.3"
@ -22559,10 +22581,10 @@ __metadata:
languageName: node
linkType: hard
"immer@npm:^9.0.15":
version: 9.0.21
resolution: "immer@npm:9.0.21"
checksum: 70e3c274165995352f6936695f0ef4723c52c92c92dd0e9afdfe008175af39fa28e76aafb3a2ca9d57d1fb8f796efc4dd1e1cc36f18d33fa5b74f3dfb0375432
"immer@npm:^10.0.2":
version: 10.0.2
resolution: "immer@npm:10.0.2"
checksum: 525a3b14210d02ae420c3b9f6ca14f7e9bcf625611d1356e773e7739f14c7c8de50dac442e6c7de3a6e24a782f7b792b6b8666bc0b3f00269d21a95f8f68ca84
languageName: node
linkType: hard
@ -27911,6 +27933,13 @@ __metadata:
languageName: node
linkType: hard
"options-defaults@npm:^2.0.39":
version: 2.0.40
resolution: "options-defaults@npm:2.0.40"
checksum: 2bb3697a1aabecee4b76ee68857bd857957f664b78b419306a05e9c36182305092b0fca39035f287c75d24568326e06a0234d168290a9e9c88f1f2ce6e6dd977
languageName: node
linkType: hard
"ora@npm:^5.4.1":
version: 5.4.1
resolution: "ora@npm:5.4.1"
@ -29411,20 +29440,20 @@ __metadata:
linkType: hard
"prisma-field-encryption@npm:^1.4.0":
version: 1.4.1
resolution: "prisma-field-encryption@npm:1.4.1"
version: 1.5.0
resolution: "prisma-field-encryption@npm:1.5.0"
dependencies:
"@47ng/cloak": ^1.1.0
"@prisma/generator-helper": ^4.0.0
"@prisma/generator-helper": ^5.0.0
debug: ^4.3.4
immer: ^9.0.15
immer: ^10.0.2
object-path: ^0.11.8
zod: ^3.17.3
zod: ^3.21.4
peerDependencies:
"@prisma/client": ^3.8.0 || ^4
"@prisma/client": ">= 4.7"
bin:
prisma-field-encryption: dist/generator/main.js
checksum: cf059abc1c39ae9252494aaf6ce2bfa0f415583b8cd11b9d84eeadfbb504e00f61570b0e3158ba4b7d52daf91353ffe92766a717c03b9965c421cc08ed49c303
checksum: 530bd970c5015c8c587bdca24136262d746093dd3d0793c892f4a1c377633182ae95e0ef5659465f914e4cc9bd7b24bf45551aa9c624a05942570f5b650fc065
languageName: node
linkType: hard
@ -34628,6 +34657,15 @@ __metadata:
languageName: node
linkType: hard
"ts-import@npm:^2.0.39":
version: 2.0.40
resolution: "ts-import@npm:2.0.40"
dependencies:
options-defaults: ^2.0.39
checksum: 9d05df5825a88fcc57b069fab6ee52d405350a60d214c0df2d6288a69b6160ee80ac10f5bceab055698935987441f7f13fefb887654b32f157d3ef19ce4856b4
languageName: node
linkType: hard
"ts-interface-checker@npm:^0.1.9":
version: 0.1.13
resolution: "ts-interface-checker@npm:0.1.13"
@ -37775,7 +37813,7 @@ __metadata:
languageName: node
linkType: hard
"zod@npm:3.21.4, zod@npm:^3.17.3":
"zod@npm:3.21.4, zod@npm:^3.21.4":
version: 3.21.4
resolution: "zod@npm:3.21.4"
checksum: f185ba87342ff16f7a06686767c2b2a7af41110c7edf7c1974095d8db7a73792696bcb4a00853de0d2edeb34a5b2ea6a55871bc864227dace682a0a28de33e1f