1
0
mirror of https://gitcode.com/github-mirrors/react-native-update-cli.git synced 2025-09-16 09:41:38 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

init i18n

This commit is contained in:
sunnylqm
2025-02-15 00:38:55 +08:00
parent 814a9d10fb
commit 0f44de772f
8 changed files with 33 additions and 5 deletions

9
bun.lock Executable file → Normal file
View File

@@ -1,5 +1,5 @@
{ {
"lockfileVersion": 0, "lockfileVersion": 1,
"workspaces": { "workspaces": {
"": { "": {
"dependencies": { "dependencies": {
@@ -15,6 +15,7 @@
"form-data": "^4.0.1", "form-data": "^4.0.1",
"fs-extra": "8", "fs-extra": "8",
"gradle-to-js": "^2.0.1", "gradle-to-js": "^2.0.1",
"i18next": "^24.2.2",
"isomorphic-unzip": "^1.1.5", "isomorphic-unzip": "^1.1.5",
"node-fetch": "^2.6.1", "node-fetch": "^2.6.1",
"plist": "^3.1.0", "plist": "^3.1.0",
@@ -38,6 +39,8 @@
}, },
}, },
"packages": { "packages": {
"@babel/runtime": ["@babel/runtime@7.26.9", "", { "dependencies": { "regenerator-runtime": "^0.14.0" } }, "sha512-aA63XwOkcl4xxQa3HjPMqOP6LiK0ZDv3mUPYEFXkpHbaFjtGggE1A61FjFzJnB+p7/oy2gA8E+rcBNl/zC1tMg=="],
"@badisi/latest-version": ["@badisi/latest-version@7.0.10", "", { "dependencies": { "@colors/colors": "^1.6.0", "global-dirs": "3.0.1", "ora": "^8.1.0", "registry-auth-token": "^5.0.2", "semver": "^7.6.3" }, "bin": { "latest-version": "bin/latest-version", "lv": "bin/latest-version" } }, "sha512-1lX9wvXiJC552C+rrwwjEbpvvuDwYTU3OLFwFA1pTVYTnJGUkbBkfqz1MuTIPP1fL2LCvjd21ri/u39sSIcMTg=="], "@badisi/latest-version": ["@badisi/latest-version@7.0.10", "", { "dependencies": { "@colors/colors": "^1.6.0", "global-dirs": "3.0.1", "ora": "^8.1.0", "registry-auth-token": "^5.0.2", "semver": "^7.6.3" }, "bin": { "latest-version": "bin/latest-version", "lv": "bin/latest-version" } }, "sha512-1lX9wvXiJC552C+rrwwjEbpvvuDwYTU3OLFwFA1pTVYTnJGUkbBkfqz1MuTIPP1fL2LCvjd21ri/u39sSIcMTg=="],
"@biomejs/biome": ["@biomejs/biome@1.9.4", "", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "1.9.4", "@biomejs/cli-darwin-x64": "1.9.4", "@biomejs/cli-linux-arm64": "1.9.4", "@biomejs/cli-linux-arm64-musl": "1.9.4", "@biomejs/cli-linux-x64": "1.9.4", "@biomejs/cli-linux-x64-musl": "1.9.4", "@biomejs/cli-win32-arm64": "1.9.4", "@biomejs/cli-win32-x64": "1.9.4" }, "bin": { "biome": "bin/biome" } }, "sha512-1rkd7G70+o9KkTn5KLmDYXihGoTaIGO9PIIN2ZB7UJxFrWw04CZHPYiMRjYsaDvVV7hP1dYNRLxSANLaBFGpog=="], "@biomejs/biome": ["@biomejs/biome@1.9.4", "", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "1.9.4", "@biomejs/cli-darwin-x64": "1.9.4", "@biomejs/cli-linux-arm64": "1.9.4", "@biomejs/cli-linux-arm64-musl": "1.9.4", "@biomejs/cli-linux-x64": "1.9.4", "@biomejs/cli-linux-x64-musl": "1.9.4", "@biomejs/cli-win32-arm64": "1.9.4", "@biomejs/cli-win32-x64": "1.9.4" }, "bin": { "biome": "bin/biome" } }, "sha512-1rkd7G70+o9KkTn5KLmDYXihGoTaIGO9PIIN2ZB7UJxFrWw04CZHPYiMRjYsaDvVV7hP1dYNRLxSANLaBFGpog=="],
@@ -414,6 +417,8 @@
"human-signals": ["human-signals@2.1.0", "", {}, "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw=="], "human-signals": ["human-signals@2.1.0", "", {}, "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw=="],
"i18next": ["i18next@24.2.2", "", { "dependencies": { "@babel/runtime": "^7.23.2" }, "peerDependencies": { "typescript": "^5" }, "optionalPeers": ["typescript"] }, "sha512-NE6i86lBCKRYZa5TaUDkU5S4HFgLIEJRLr3Whf2psgaxBleQ2LC1YW1Vc+SCgkAW7VEzndT6al6+CzegSUHcTQ=="],
"ieee754": ["ieee754@1.2.1", "", {}, "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="], "ieee754": ["ieee754@1.2.1", "", {}, "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="],
"import-lazy": ["import-lazy@2.1.0", "", {}, "sha512-m7ZEHgtw69qOGw+jwxXkHlrlIPdTGkyh66zXZ1ajZbxkDBNjSY/LGbmjc7h0s2ELsUDTAhFr55TrPSSqJGPG0A=="], "import-lazy": ["import-lazy@2.1.0", "", {}, "sha512-m7ZEHgtw69qOGw+jwxXkHlrlIPdTGkyh66zXZ1ajZbxkDBNjSY/LGbmjc7h0s2ELsUDTAhFr55TrPSSqJGPG0A=="],
@@ -604,6 +609,8 @@
"read": ["read@4.0.0", "", { "dependencies": { "mute-stream": "^2.0.0" } }, "sha512-nbYGT3cec3J5NPUeJia7l72I3oIzMIB6yeNyDqi8CVHr3WftwjrCUqR0j13daoHEMVaZ/rxCpmHKrbods3hI2g=="], "read": ["read@4.0.0", "", { "dependencies": { "mute-stream": "^2.0.0" } }, "sha512-nbYGT3cec3J5NPUeJia7l72I3oIzMIB6yeNyDqi8CVHr3WftwjrCUqR0j13daoHEMVaZ/rxCpmHKrbods3hI2g=="],
"regenerator-runtime": ["regenerator-runtime@0.14.1", "", {}, "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw=="],
"regexp.prototype.flags": ["regexp.prototype.flags@1.5.3", "", { "dependencies": { "call-bind": "^1.0.7", "define-properties": "^1.2.1", "es-errors": "^1.3.0", "set-function-name": "^2.0.2" } }, "sha512-vqlC04+RQoFalODCbCumG2xIOvapzVMHwsyIGM/SIE8fRhFFsXeH8/QQ+s0T0kDAhKc4k30s73/0ydkHQz6HlQ=="], "regexp.prototype.flags": ["regexp.prototype.flags@1.5.3", "", { "dependencies": { "call-bind": "^1.0.7", "define-properties": "^1.2.1", "es-errors": "^1.3.0", "set-function-name": "^2.0.2" } }, "sha512-vqlC04+RQoFalODCbCumG2xIOvapzVMHwsyIGM/SIE8fRhFFsXeH8/QQ+s0T0kDAhKc4k30s73/0ydkHQz6HlQ=="],
"registry-auth-token": ["registry-auth-token@5.0.2", "", { "dependencies": { "@pnpm/npm-conf": "^2.1.0" } }, "sha512-o/3ikDxtXaA59BmZuZrJZDJv8NMDGSj+6j6XaeBmHw8eY1i1qd9+6H+LjVvQXx3HN6aRCGa1cUdJ9RaJZUugnQ=="], "registry-auth-token": ["registry-auth-token@5.0.2", "", { "dependencies": { "@pnpm/npm-conf": "^2.1.0" } }, "sha512-o/3ikDxtXaA59BmZuZrJZDJv8NMDGSj+6j6XaeBmHw8eY1i1qd9+6H+LjVvQXx3HN6aRCGa1cUdJ9RaJZUugnQ=="],

View File

@@ -4,7 +4,8 @@
"description": "Command tools for javaScript updater with `pushy` service for react native apps.", "description": "Command tools for javaScript updater with `pushy` service for react native apps.",
"main": "index.js", "main": "index.js",
"bin": { "bin": {
"pushy": "lib/index.js" "pushy": "lib/index.js",
"cresc": "lib/index.js"
}, },
"files": [ "files": [
"lib", "lib",
@@ -46,6 +47,7 @@
"form-data": "^4.0.1", "form-data": "^4.0.1",
"fs-extra": "8", "fs-extra": "8",
"gradle-to-js": "^2.0.1", "gradle-to-js": "^2.0.1",
"i18next": "^24.2.2",
"isomorphic-unzip": "^1.1.5", "isomorphic-unzip": "^1.1.5",
"node-fetch": "^2.6.1", "node-fetch": "^2.6.1",
"plist": "^3.1.0", "plist": "^3.1.0",

View File

@@ -121,7 +121,7 @@ export async function uploadFile(fn: string, key?: string) {
timeout: 1000, timeout: 1000,
}); });
// console.log({pingResult}); // console.log({pingResult});
if (isNaN(pingResult.avg) || pingResult.avg > 150) { if (Number.isNaN(pingResult.avg) || pingResult.avg > 150) {
realUrl = backupUrl; realUrl = backupUrl;
} }
} }

View File

@@ -2,8 +2,24 @@
import { loadSession } from './api'; import { loadSession } from './api';
import updateNotifier from 'update-notifier'; import updateNotifier from 'update-notifier';
import { printVersionCommand } from './utils/index.js'; import { printVersionCommand } from './utils';
import pkg from '../package.json'; import pkg from '../package.json';
import path from 'node:path';
import i18next from 'i18next';
const scriptName: 'cresc' | 'pushy' = path.basename(process.argv[1]) as
| 'cresc'
| 'pushy';
global.IS_CRESC = scriptName === 'cresc';
i18next.init({
lng: global.IS_CRESC ? 'en' : 'zh',
debug: process.env.NODE_ENV !== 'production',
resources: {
en: require('./locales/en.json'),
zh: require('./locales/zh.json'),
},
});
updateNotifier({ pkg }).notify({ updateNotifier({ pkg }).notify({
isGlobal: true, isGlobal: true,

1
src/locale/en.json Normal file
View File

@@ -0,0 +1 @@
{}

1
src/locale/zh.json Normal file
View File

@@ -0,0 +1 @@
{}

View File

@@ -1,6 +1,7 @@
declare global { declare global {
var NO_INTERACTIVE: boolean; var NO_INTERACTIVE: boolean;
var USE_ACC_OSS: boolean; var USE_ACC_OSS: boolean;
var IS_CRESC: boolean;
} }
export interface Session { export interface Session {

View File

@@ -55,7 +55,7 @@ export function getRNVersion() {
}; };
} }
export async function getApkInfo(fn) { export async function getApkInfo(fn: string) {
const appInfoParser = new AppInfoParser(fn); const appInfoParser = new AppInfoParser(fn);
const bundleFile = await appInfoParser.parser.getEntry( const bundleFile = await appInfoParser.parser.getEntry(
/assets\/index.android.bundle/, /assets\/index.android.bundle/,