Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into feat/moonbean-ne…
Browse files Browse the repository at this point in the history
…twork
  • Loading branch information
developerfred committed May 27, 2022
2 parents 14b576e + 0bf326e commit eb3883e
Show file tree
Hide file tree
Showing 453 changed files with 4,166 additions and 5,593 deletions.
13 changes: 0 additions & 13 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,6 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-node@v2
- run: npx anti-trojan-source --files='packages/**/src/**/*.{ts,tsx,js}'
locale-kit:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: pnpm/[email protected]
- uses: actions/setup-node@v2
with:
node-version: "17"
cache: "pnpm"
- run: pnpm install
- run: npx gulp locale-kit
type-check-and-jest:
runs-on: ubuntu-20.04
steps:
Expand Down
82 changes: 58 additions & 24 deletions .i18n-codegen.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,29 @@
{
"input": "./packages/mask/shared-ui/locales/en-US.json",
"output": "./packages/mask/shared-ui/locales/i18n_generated",
"parser": "i18next",
"parser": { "type": "i18next", "contextSeparator": "$", "pluralSeparator": "_" },
"generator": {
"type": "i18next/react-hooks",
"hooks": "useMaskI18N",
"namespace": "mask",
"trans": "MaskTrans",
"sourceMap": "inline"
"trans": "MaskTrans"
}
},
{
"input": "./packages/mask/src/social-network-adaptor/twitter.com/locales/en-US.json",
"output": "./packages/mask/src/social-network-adaptor/twitter.com/locales/i18n_generated",
"parser": "i18next",
"parser": { "type": "i18next", "contextSeparator": "$", "pluralSeparator": "_" },
"generator": {
"type": "i18next/react-hooks",
"hooks": "useDO_NOT_USE",
"namespace": "DO_NOT_USE",
"trans": "DO_NOT_USE_TRANSLATOR",
"sourceMap": false
"trans": "DO_NOT_USE_TRANSLATOR"
}
},
{
"input": "./packages/shared/src/locales/en-US.json",
"output": "./packages/shared/src/locales/i18n_generated",
"parser": "i18next",
"parser": { "type": "i18next", "contextSeparator": "$", "pluralSeparator": "_" },
"generator": {
"type": "i18next/react-hooks",
"hooks": "useSharedI18N",
Expand All @@ -41,7 +39,7 @@
{
"input": "./packages/shared-base-ui/src/locales/en-US.json",
"output": "./packages/shared-base-ui/src/locales/i18n_generated",
"parser": "i18next",
"parser": { "type": "i18next", "contextSeparator": "$", "pluralSeparator": "_" },
"generator": {
"type": "i18next/react-hooks",
"hooks": "useSharedBaseI18N",
Expand All @@ -53,7 +51,7 @@
{
"input": "./packages/dashboard/src/locales/en-US.json",
"output": "./packages/dashboard/src/locales/i18n_generated",
"parser": "i18next",
"parser": { "type": "i18next", "contextSeparator": "$", "pluralSeparator": "_" },
"generator": {
"type": "i18next/react-hooks",
"hooks": "useDashboardI18N",
Expand All @@ -65,7 +63,7 @@
{
"input": "./packages/plugins/example/src/locales/en-US.json",
"output": "./packages/plugins/example/src/locales/i18n_generated",
"parser": "i18next",
"parser": { "type": "i18next", "contextSeparator": "$", "pluralSeparator": "_" },
"generator": {
"type": "i18next/react-hooks",
"hooks": "useI18N",
Expand All @@ -77,7 +75,7 @@
{
"input": "./packages/plugins/Debugger/src/locales/en-US.json",
"output": "./packages/plugins/Debugger/src/locales/i18n_generated",
"parser": "i18next",
"parser": { "type": "i18next", "contextSeparator": "$", "pluralSeparator": "_" },
"generator": {
"type": "i18next/react-hooks",
"hooks": "useI18N",
Expand All @@ -89,7 +87,7 @@
{
"input": "./packages/plugins/Wallet/src/locales/en-US.json",
"output": "./packages/plugins/Wallet/src/locales/i18n_generated",
"parser": "i18next",
"parser": { "type": "i18next", "contextSeparator": "$", "pluralSeparator": "_" },
"generator": {
"type": "i18next/react-hooks",
"hooks": "useI18N",
Expand All @@ -101,7 +99,7 @@
{
"input": "./packages/plugins/Flow/src/locales/en-US.json",
"output": "./packages/plugins/Flow/src/locales/i18n_generated",
"parser": "i18next",
"parser": { "type": "i18next", "contextSeparator": "$", "pluralSeparator": "_" },
"generator": {
"type": "i18next/react-hooks",
"hooks": "useI18N",
Expand All @@ -113,7 +111,7 @@
{
"input": "./packages/plugins/FileService/src/locales/en-US.json",
"output": "./packages/plugins/FileService/src/locales/i18n_generated",
"parser": "i18next",
"parser": { "type": "i18next", "contextSeparator": "$", "pluralSeparator": "_" },
"generator": {
"type": "i18next/react-hooks",
"hooks": "useI18N",
Expand All @@ -125,7 +123,7 @@
{
"input": "./packages/plugins/CyberConnect/src/locales/en-US.json",
"output": "./packages/plugins/CyberConnect/src/locales/i18n_generated",
"parser": "i18next",
"parser": { "type": "i18next", "contextSeparator": "$", "pluralSeparator": "_" },
"generator": {
"type": "i18next/react-hooks",
"hooks": "useI18N",
Expand All @@ -137,7 +135,7 @@
{
"input": "./packages/plugins/RSS3/src/locales/en-US.json",
"output": "./packages/plugins/RSS3/src/locales/i18n_generated",
"parser": "i18next",
"parser": { "type": "i18next", "contextSeparator": "$", "pluralSeparator": "_" },
"generator": {
"type": "i18next/react-hooks",
"hooks": "useI18N",
Expand All @@ -149,7 +147,7 @@
{
"input": "./packages/plugins/DAO/src/locales/en-US.json",
"output": "./packages/plugins/DAO/src/locales/i18n_generated",
"parser": "i18next",
"parser": { "type": "i18next", "contextSeparator": "$", "pluralSeparator": "_" },
"generator": {
"type": "i18next/react-hooks",
"hooks": "useI18N",
Expand All @@ -161,7 +159,7 @@
{
"input": "./packages/plugins/Solana/src/locales/en-US.json",
"output": "./packages/plugins/Solana/src/locales/i18n_generated",
"parser": "i18next",
"parser": { "type": "i18next", "contextSeparator": "$", "pluralSeparator": "_" },
"generator": {
"type": "i18next/react-hooks",
"hooks": "useI18N",
Expand All @@ -173,7 +171,7 @@
{
"input": "./packages/mask/src/plugins/NextID/locales/en-US.json",
"output": "./packages/mask/src/plugins/NextID/locales/i18n_generated",
"parser": "i18next",
"parser": { "type": "i18next", "contextSeparator": "$", "pluralSeparator": "_" },
"generator": {
"type": "i18next/react-hooks",
"hooks": "useI18N",
Expand All @@ -185,7 +183,7 @@
{
"input": "./packages/plugins/template/src/locales/en-US.json",
"output": "./packages/plugins/template/src/locales/i18n_generated",
"parser": "i18next",
"parser": { "type": "i18next", "contextSeparator": "$", "pluralSeparator": "_" },
"generator": {
"type": "i18next/react-hooks",
"hooks": "useI18N",
Expand All @@ -197,7 +195,7 @@
{
"input": "./packages/plugins/GoPlusSecurity/src/locales/en-US.json",
"output": "./packages/plugins/GoPlusSecurity/src/locales/i18n_generated",
"parser": "i18next",
"parser": { "type": "i18next", "contextSeparator": "$", "pluralSeparator": "_" },
"generator": {
"type": "i18next/react-hooks",
"hooks": "useI18N",
Expand All @@ -209,7 +207,7 @@
{
"input": "./packages/plugins/CrossChainBridge/src/locales/en-US.json",
"output": "./packages/plugins/CrossChainBridge/src/locales/i18n_generated",
"parser": "i18next",
"parser": { "type": "i18next", "contextSeparator": "$", "pluralSeparator": "_" },
"generator": {
"type": "i18next/react-hooks",
"hooks": "useI18N",
Expand All @@ -218,10 +216,22 @@
"sourceMap": "inline"
}
},
{
"input": "./packages/mask/src/plugins/RedPacket/locales/en-US.json",
"output": "./packages/mask/src/plugins/RedPacket/locales/i18n_generated",
"parser": { "type": "i18next", "contextSeparator": "$", "pluralSeparator": "_" },
"generator": {
"type": "i18next/react-hooks",
"hooks": "useI18N",
"namespace": "com.maskbook.red_packet",
"trans": "Translate",
"sourceMap": "inline"
}
},
{
"input": "./packages/mask/src/plugins/Tips/locales/en-US.json",
"output": "./packages/mask/src/plugins/Tips/locales/i18n_generated",
"parser": "i18next",
"parser": { "type": "i18next", "contextSeparator": "$", "pluralSeparator": "_" },
"generator": {
"type": "i18next/react-hooks",
"hooks": "useI18N",
Expand All @@ -233,14 +243,38 @@
{
"input": "./packages/mask/src/plugins/Avatar/locales/en-US.json",
"output": "./packages/mask/src/plugins/Avatar/locales/i18n_generated",
"parser": "i18next",
"parser": { "type": "i18next", "contextSeparator": "$", "pluralSeparator": "_" },
"generator": {
"type": "i18next/react-hooks",
"hooks": "useI18N",
"namespace": "com.maskbook.avatar",
"trans": "Translate",
"sourceMap": "inline"
}
},
{
"input": "./packages/mask/src/plugins/Trader/locales/en-US.json",
"output": "./packages/mask/src/plugins/Trader/locales/i18n_generated",
"parser": { "type": "i18next", "contextSeparator": "$", "pluralSeparator": "_" },
"generator": {
"type": "i18next/react-hooks",
"hooks": "useI18N",
"namespace": "com.maskbook.trader",
"trans": "Translate",
"sourceMap": "inline"
}
},
{
"input": "./packages/mask/src/plugins/Gitcoin/locales/en-US.json",
"output": "./packages/mask/src/plugins/Gitcoin/locales/i18n_generated",
"parser": { "type": "i18next", "contextSeparator": "$", "pluralSeparator": "_" },
"generator": {
"type": "i18next/react-hooks",
"hooks": "useI18N",
"namespace": "com.maskbook.gitcoin",
"trans": "Translate",
"sourceMap": "inline"
}
}
]
}
1 change: 0 additions & 1 deletion .lintstagedrc.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export default {
'*': 'prettier --write --ignore-unknown',
'packages/**/*.{ts,tsx,js,jsx}': 'eslint -c packages/.eslintrc.json --fix',
'packages/mask/**/*': () => 'gulp locale-kit --sync-keys --remove-unused-keys',
'packages/web3-constants/**/*': () => 'pnpm --filter ./packages/web3-constants start',
'cspell.json': () => 'gulp reorder-spellcheck',
}
3 changes: 1 addition & 2 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@
"filelist",
"fileservice",
"flashloan",
"formating",
"fullfilled",
"furucombo",
"futuna",
"gasnow",
Expand Down Expand Up @@ -300,6 +298,7 @@
"redpackets",
"renfil",
"shapeclip",
"ssrb",
"steth",
"swaptoken",
"testweb",
Expand Down
1 change: 0 additions & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const config: InitialOptionsTsJest = {
extensionsToTreatAsEsm: ['.ts', '.tsx'],
moduleNameMapper: {
'@masknet/shared-base': '<rootDir>/packages/shared-base/src/index.ts',
'@masknet/public-api': '<rootDir>/packages/public-api/src/index.ts',
'jest-websocket-mock': '<rootDir>/packages/web3-shared/base/node_modules/jest-websocket-mock',
'reconnecting-websocket': '<rootDir>/packages/web3-shared/base/node_modules/reconnecting-websocket',
'date-fns/(.*)': '<rootDir>/packages/web3-shared/base/node_modules/date-fns/$1',
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"yarn": ">=999.0.0",
"npm": ">=999.0.0"
},
"version": "2.7.0",
"version": "2.8.0",
"private": true,
"license": "AGPL-3.0-or-later",
"scripts": {
Expand All @@ -23,6 +23,7 @@
"postinstall": "patch-package && gulp fix-lockfile",
"prepare": "husky install",
"test": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js",
"test:debug": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --runInBand",
"test:update": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js -u",
"spellcheck": "cspell lint --no-must-find-files"
},
Expand Down Expand Up @@ -61,7 +62,7 @@
"@dimensiondev/eslint-plugin": "0.0.2-20220516081411-2649814",
"@dimensiondev/patch-package": "^6.5.0",
"@jest/globals": "^28.1.0",
"@magic-works/i18n-codegen": "^0.1.0",
"@magic-works/i18n-codegen": "^0.2.0",
"@masknet/cli": "workspace:*",
"@masknet/serializer": "workspace:*",
"@nice-labs/git-rev": "^3.5.0",
Expand Down
1 change: 0 additions & 1 deletion packages/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
"@dimensiondev/type/no-instanceof-wrapper": "error",
"@dimensiondev/type/no-wrapper-type-reference": "error",
"@dimensiondev/unicode/specific-set": "error",
"@typescript-eslint/array-type": ["error", { "default": "array-simple" }],
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/no-base-to-string": "off",
"@typescript-eslint/no-implied-eval": "error",
Expand Down
2 changes: 1 addition & 1 deletion packages/backup-format/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "@masknet/backup-format",
"private": true,
"type": "module",
"exports": {
".": {
"webpack": "./src/index.ts",
"default": "./dist/index.js"
}
},
"types": "./dist/index.d.ts",
"type": "module",
"dependencies": {
"@masknet/shared-base": "workspace:*",
"@msgpack/msgpack": "^2.7.2",
Expand Down
6 changes: 3 additions & 3 deletions packages/backup-format/src/normalize/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import { generateBackupVersion2, isBackupVersion2, normalizeBackupVersion2 } fro
import type { NormalizedBackup } from './type'

export * from './type'
function __normalizeBackup(data: unknown): NormalizedBackup.Data {
async function __normalizeBackup(data: unknown): Promise<NormalizedBackup.Data> {
if (isBackupVersion2(data)) return normalizeBackupVersion2(data)
if (isBackupVersion1(data)) return normalizeBackupVersion1(data)
if (isBackupVersion0(data)) return normalizeBackupVersion0(data)
throw new TypeError(BackupErrors.UnknownFormat)
}

export function normalizeBackup(data: unknown): NormalizedBackup.Data {
const normalized = __normalizeBackup(data)
export async function normalizeBackup(data: unknown): Promise<NormalizedBackup.Data> {
const normalized = await __normalizeBackup(data)

// fix invalid URL
normalized.settings.grantedHostPermissions = normalized.settings.grantedHostPermissions.filter((url) =>
Expand Down
2 changes: 1 addition & 1 deletion packages/backup-format/src/utils/hex2buffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function hex2buffer(hexString: string, padded?: boolean) {
}

/** @internal */
function concat(...buf: Array<Uint8Array | number[]>) {
function concat(...buf: (Uint8Array | number[])[]) {
const res = new Uint8Array(sum(buf.map((item) => item.length)))
let offset = 0
buf.forEach((item) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/backup-format/src/version-0/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function isBackupVersion0(obj: unknown): obj is BackupJSONFileVersion0 {
return false
}
}
export function normalizeBackupVersion0(file: BackupJSONFileVersion0): NormalizedBackup.Data {
export async function normalizeBackupVersion0(file: BackupJSONFileVersion0): Promise<NormalizedBackup.Data> {
const backup = createEmptyNormalizedBackup()
backup.meta.version = 0
backup.meta.maskVersion = Some('<=1.3.2')
Expand All @@ -36,7 +36,7 @@ export function normalizeBackupVersion0(file: BackupJSONFileVersion0): Normalize
if (!isEC_Public_JsonWebKey(publicKey)) return backup

const persona: NormalizedBackup.PersonaBackup = {
identifier: ECKeyIdentifierFromJsonWebKey(publicKey),
identifier: await ECKeyIdentifierFromJsonWebKey(publicKey),
publicKey,
linkedProfiles: new Map(),
localKey: isAESJsonWebKey(local) ? Some(local) : None,
Expand Down
Loading

0 comments on commit eb3883e

Please sign in to comment.