mirror of
https://gitcode.com/github-mirrors/react-native-update-cli.git
synced 2025-11-08 10:15:47 +08:00
init i18n
This commit is contained in:
@@ -121,7 +121,7 @@ export async function uploadFile(fn: string, key?: string) {
|
||||
timeout: 1000,
|
||||
});
|
||||
// console.log({pingResult});
|
||||
if (isNaN(pingResult.avg) || pingResult.avg > 150) {
|
||||
if (Number.isNaN(pingResult.avg) || pingResult.avg > 150) {
|
||||
realUrl = backupUrl;
|
||||
}
|
||||
}
|
||||
|
||||
18
src/index.ts
18
src/index.ts
@@ -2,8 +2,24 @@
|
||||
|
||||
import { loadSession } from './api';
|
||||
import updateNotifier from 'update-notifier';
|
||||
import { printVersionCommand } from './utils/index.js';
|
||||
import { printVersionCommand } from './utils';
|
||||
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({
|
||||
isGlobal: true,
|
||||
|
||||
1
src/locale/en.json
Normal file
1
src/locale/en.json
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
src/locale/zh.json
Normal file
1
src/locale/zh.json
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
@@ -1,6 +1,7 @@
|
||||
declare global {
|
||||
var NO_INTERACTIVE: boolean;
|
||||
var USE_ACC_OSS: boolean;
|
||||
var IS_CRESC: boolean;
|
||||
}
|
||||
|
||||
export interface Session {
|
||||
|
||||
@@ -55,7 +55,7 @@ export function getRNVersion() {
|
||||
};
|
||||
}
|
||||
|
||||
export async function getApkInfo(fn) {
|
||||
export async function getApkInfo(fn: string) {
|
||||
const appInfoParser = new AppInfoParser(fn);
|
||||
const bundleFile = await appInfoParser.parser.getEntry(
|
||||
/assets\/index.android.bundle/,
|
||||
|
||||
Reference in New Issue
Block a user