react-native-update-cli 1.40.0-beta.1 → 1.40.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.json +3 -0
- package/lib/api.js +1 -1
- package/lib/bundle.js +8 -4
- package/lib/index.js +16 -2
- package/lib/locales/en.js +11 -0
- package/lib/locales/zh.js +11 -0
- package/lib/utils/app-info-parser/zip.js +1 -1
- package/package.json +4 -2
- package/src/api.ts +1 -1
- package/src/bundle.ts +9 -2
- package/src/index.ts +19 -1
- package/src/locales/en.ts +1 -0
- package/src/locales/zh.ts +1 -0
- package/src/types.ts +1 -0
- package/src/utils/app-info-parser/zip.js +1 -1
- package/src/utils/index.ts +1 -1
- package/src/.DS_Store +0 -0
- package/src/utils/.DS_Store +0 -0
package/cli.json
CHANGED
package/lib/api.js
CHANGED
|
@@ -148,7 +148,7 @@ async function uploadFile(fn, key) {
|
|
|
148
148
|
timeout: 1000
|
|
149
149
|
});
|
|
150
150
|
// console.log({pingResult});
|
|
151
|
-
if (isNaN(pingResult.avg) || pingResult.avg > 150) {
|
|
151
|
+
if (Number.isNaN(pingResult.avg) || pingResult.avg > 150) {
|
|
152
152
|
realUrl = backupUrl;
|
|
153
153
|
}
|
|
154
154
|
}
|
package/lib/bundle.js
CHANGED
|
@@ -85,7 +85,7 @@ try {
|
|
|
85
85
|
try {
|
|
86
86
|
hdiff = require('node-hdiffpatch').diff;
|
|
87
87
|
} catch (e) {}
|
|
88
|
-
async function runReactNativeBundleCommand({ bundleName, dev, entryFile, outputFolder, platform, sourcemapOutput, config, cli }) {
|
|
88
|
+
async function runReactNativeBundleCommand({ bundleName, dev, entryFile, outputFolder, platform, sourcemapOutput, config, disableHermes, cli }) {
|
|
89
89
|
let gradleConfig = {};
|
|
90
90
|
if (platform === 'android') {
|
|
91
91
|
gradleConfig = await checkGradleConfig();
|
|
@@ -112,7 +112,7 @@ async function runReactNativeBundleCommand({ bundleName, dev, entryFile, outputF
|
|
|
112
112
|
paths: [
|
|
113
113
|
process.cwd()
|
|
114
114
|
]
|
|
115
|
-
}))).version;
|
|
115
|
+
})).toString()).version;
|
|
116
116
|
// expo cli 0.10.17 (expo 49) 开始支持 bundle:embed
|
|
117
117
|
if ((0, _satisfies.default)(expoCliVersion, '>= 0.10.17')) {
|
|
118
118
|
usingExpo = true;
|
|
@@ -231,7 +231,10 @@ async function runReactNativeBundleCommand({ bundleName, dev, entryFile, outputF
|
|
|
231
231
|
reject(new Error(`"react-native bundle" command exited with code ${exitCode}.`));
|
|
232
232
|
} else {
|
|
233
233
|
let hermesEnabled = false;
|
|
234
|
-
if (
|
|
234
|
+
if (disableHermes) {
|
|
235
|
+
hermesEnabled = false;
|
|
236
|
+
console.log('Hermes disabled');
|
|
237
|
+
} else if (platform === 'android') {
|
|
235
238
|
const gradlePropeties = await new Promise((resolve)=>{
|
|
236
239
|
properties.parse('./android/gradle.properties', {
|
|
237
240
|
path: true
|
|
@@ -751,7 +754,7 @@ function diffArgsCheck(args, options, diffFn) {
|
|
|
751
754
|
const commands = {
|
|
752
755
|
bundle: async function({ options }) {
|
|
753
756
|
const platform = (0, _app.checkPlatform)(options.platform || await (0, _utils.question)('平台(ios/android/harmony):'));
|
|
754
|
-
const { bundleName, entryFile, intermediaDir, output, dev, sourcemap, taro, expo, rncli } = (0, _utils.translateOptions)({
|
|
757
|
+
const { bundleName, entryFile, intermediaDir, output, dev, sourcemap, taro, expo, rncli, disableHermes } = (0, _utils.translateOptions)({
|
|
755
758
|
...options,
|
|
756
759
|
platform
|
|
757
760
|
});
|
|
@@ -772,6 +775,7 @@ const commands = {
|
|
|
772
775
|
outputFolder: intermediaDir,
|
|
773
776
|
platform,
|
|
774
777
|
sourcemapOutput: sourcemap || sourcemapPlugin ? sourcemapOutput : '',
|
|
778
|
+
disableHermes,
|
|
775
779
|
cli: {
|
|
776
780
|
taro,
|
|
777
781
|
expo,
|
package/lib/index.js
CHANGED
|
@@ -5,13 +5,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
const _api = require("./api");
|
|
7
7
|
const _updatenotifier = /*#__PURE__*/ _interop_require_default(require("update-notifier"));
|
|
8
|
-
const
|
|
8
|
+
const _utils = require("./utils");
|
|
9
9
|
const _packagejson = /*#__PURE__*/ _interop_require_default(require("../package.json"));
|
|
10
|
+
const _nodepath = /*#__PURE__*/ _interop_require_default(require("node:path"));
|
|
11
|
+
const _i18next = /*#__PURE__*/ _interop_require_default(require("i18next"));
|
|
12
|
+
const _en = /*#__PURE__*/ _interop_require_default(require("./locales/en"));
|
|
13
|
+
const _zh = /*#__PURE__*/ _interop_require_default(require("./locales/zh"));
|
|
10
14
|
function _interop_require_default(obj) {
|
|
11
15
|
return obj && obj.__esModule ? obj : {
|
|
12
16
|
default: obj
|
|
13
17
|
};
|
|
14
18
|
}
|
|
19
|
+
const scriptName = _nodepath.default.basename(process.argv[1]);
|
|
20
|
+
global.IS_CRESC = scriptName === 'cresc';
|
|
21
|
+
_i18next.default.init({
|
|
22
|
+
lng: global.IS_CRESC ? 'en' : 'zh',
|
|
23
|
+
// debug: process.env.NODE_ENV !== 'production',
|
|
24
|
+
resources: {
|
|
25
|
+
en: _en.default,
|
|
26
|
+
zh: _zh.default
|
|
27
|
+
}
|
|
28
|
+
});
|
|
15
29
|
(0, _updatenotifier.default)({
|
|
16
30
|
pkg: _packagejson.default
|
|
17
31
|
}).notify({
|
|
@@ -34,7 +48,7 @@ const commands = {
|
|
|
34
48
|
help: printUsage
|
|
35
49
|
};
|
|
36
50
|
async function run() {
|
|
37
|
-
await (0,
|
|
51
|
+
await (0, _utils.printVersionCommand)();
|
|
38
52
|
if (process.argv.indexOf('-v') >= 0 || process.argv[2] === 'version') {
|
|
39
53
|
process.exit();
|
|
40
54
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-update-cli",
|
|
3
|
-
"version": "1.40.
|
|
3
|
+
"version": "1.40.1",
|
|
4
4
|
"description": "Command tools for javaScript updater with `pushy` service for react native apps.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
7
|
-
"pushy": "lib/index.js"
|
|
7
|
+
"pushy": "lib/index.js",
|
|
8
|
+
"cresc": "lib/index.js"
|
|
8
9
|
},
|
|
9
10
|
"files": [
|
|
10
11
|
"lib",
|
|
@@ -46,6 +47,7 @@
|
|
|
46
47
|
"form-data": "^4.0.1",
|
|
47
48
|
"fs-extra": "8",
|
|
48
49
|
"gradle-to-js": "^2.0.1",
|
|
50
|
+
"i18next": "^24.2.2",
|
|
49
51
|
"isomorphic-unzip": "^1.1.5",
|
|
50
52
|
"node-fetch": "^2.6.1",
|
|
51
53
|
"plist": "^3.1.0",
|
package/src/api.ts
CHANGED
|
@@ -121,7 +121,7 @@ export async function uploadFile(fn: string, key?: string) {
|
|
|
121
121
|
timeout: 1000,
|
|
122
122
|
});
|
|
123
123
|
// console.log({pingResult});
|
|
124
|
-
if (isNaN(pingResult.avg) || pingResult.avg > 150) {
|
|
124
|
+
if (Number.isNaN(pingResult.avg) || pingResult.avg > 150) {
|
|
125
125
|
realUrl = backupUrl;
|
|
126
126
|
}
|
|
127
127
|
}
|
package/src/bundle.ts
CHANGED
|
@@ -30,6 +30,7 @@ async function runReactNativeBundleCommand({
|
|
|
30
30
|
platform,
|
|
31
31
|
sourcemapOutput,
|
|
32
32
|
config,
|
|
33
|
+
disableHermes,
|
|
33
34
|
cli,
|
|
34
35
|
}: {
|
|
35
36
|
bundleName: string;
|
|
@@ -39,6 +40,7 @@ async function runReactNativeBundleCommand({
|
|
|
39
40
|
platform: string;
|
|
40
41
|
sourcemapOutput: string;
|
|
41
42
|
config?: string;
|
|
43
|
+
disableHermes?: boolean;
|
|
42
44
|
cli: {
|
|
43
45
|
taro?: boolean;
|
|
44
46
|
expo?: boolean;
|
|
@@ -84,7 +86,7 @@ async function runReactNativeBundleCommand({
|
|
|
84
86
|
require.resolve('@expo/cli/package.json', {
|
|
85
87
|
paths: [process.cwd()],
|
|
86
88
|
}),
|
|
87
|
-
),
|
|
89
|
+
).toString(),
|
|
88
90
|
).version;
|
|
89
91
|
// expo cli 0.10.17 (expo 49) 开始支持 bundle:embed
|
|
90
92
|
if (semverSatisfies(expoCliVersion, '>= 0.10.17')) {
|
|
@@ -221,7 +223,10 @@ async function runReactNativeBundleCommand({
|
|
|
221
223
|
} else {
|
|
222
224
|
let hermesEnabled: boolean | undefined = false;
|
|
223
225
|
|
|
224
|
-
if (
|
|
226
|
+
if (disableHermes) {
|
|
227
|
+
hermesEnabled = false;
|
|
228
|
+
console.log('Hermes disabled');
|
|
229
|
+
} else if (platform === 'android') {
|
|
225
230
|
const gradlePropeties = await new Promise<{
|
|
226
231
|
hermesEnabled?: boolean;
|
|
227
232
|
}>((resolve) => {
|
|
@@ -904,6 +909,7 @@ export const commands = {
|
|
|
904
909
|
taro,
|
|
905
910
|
expo,
|
|
906
911
|
rncli,
|
|
912
|
+
disableHermes,
|
|
907
913
|
} = translateOptions({
|
|
908
914
|
...options,
|
|
909
915
|
platform,
|
|
@@ -932,6 +938,7 @@ export const commands = {
|
|
|
932
938
|
outputFolder: intermediaDir,
|
|
933
939
|
platform,
|
|
934
940
|
sourcemapOutput: sourcemap || sourcemapPlugin ? sourcemapOutput : '',
|
|
941
|
+
disableHermes,
|
|
935
942
|
cli: {
|
|
936
943
|
taro,
|
|
937
944
|
expo,
|
package/src/index.ts
CHANGED
|
@@ -2,8 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
import { loadSession } from './api';
|
|
4
4
|
import updateNotifier from 'update-notifier';
|
|
5
|
-
import { printVersionCommand } from './utils
|
|
5
|
+
import { printVersionCommand } from './utils';
|
|
6
6
|
import pkg from '../package.json';
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
import i18next from 'i18next';
|
|
9
|
+
import en from './locales/en';
|
|
10
|
+
import zh from './locales/zh';
|
|
11
|
+
|
|
12
|
+
const scriptName: 'cresc' | 'pushy' = path.basename(process.argv[1]) as
|
|
13
|
+
| 'cresc'
|
|
14
|
+
| 'pushy';
|
|
15
|
+
global.IS_CRESC = scriptName === 'cresc';
|
|
16
|
+
|
|
17
|
+
i18next.init({
|
|
18
|
+
lng: global.IS_CRESC ? 'en' : 'zh',
|
|
19
|
+
// debug: process.env.NODE_ENV !== 'production',
|
|
20
|
+
resources: {
|
|
21
|
+
en,
|
|
22
|
+
zh,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
7
25
|
|
|
8
26
|
updateNotifier({ pkg }).notify({
|
|
9
27
|
isGlobal: true,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default {};
|
package/src/types.ts
CHANGED
|
@@ -42,7 +42,7 @@ class Zip {
|
|
|
42
42
|
regex = decodeNullUnicode(regex);
|
|
43
43
|
return new Promise((resolve, reject) => {
|
|
44
44
|
this.unzip.getBuffer([regex], { type }, (err, buffers) => {
|
|
45
|
-
console.log(buffers);
|
|
45
|
+
// console.log(buffers);
|
|
46
46
|
err ? reject(err) : resolve(buffers[regex]);
|
|
47
47
|
});
|
|
48
48
|
});
|
package/src/utils/index.ts
CHANGED
|
@@ -55,7 +55,7 @@ export function getRNVersion() {
|
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
export async function getApkInfo(fn) {
|
|
58
|
+
export async function getApkInfo(fn: string) {
|
|
59
59
|
const appInfoParser = new AppInfoParser(fn);
|
|
60
60
|
const bundleFile = await appInfoParser.parser.getEntry(
|
|
61
61
|
/assets\/index.android.bundle/,
|
package/src/.DS_Store
DELETED
|
Binary file
|
package/src/utils/.DS_Store
DELETED
|
Binary file
|