react-native-update-cli 2.18.0 → 2.19.0
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/lib/api.d.ts +1 -1
- package/lib/api.js +140 -134
- package/lib/app.d.ts +2 -2
- package/lib/app.js +60 -107
- package/lib/bin.js +38 -35
- package/lib/bundle-pack.js +57 -77
- package/lib/bundle-runner.js +249 -312
- package/lib/bundle.js +71 -89
- package/lib/diff.js +188 -235
- package/lib/exports.js +14 -37
- package/lib/index.js +16 -17
- package/lib/install.js +24 -37
- package/lib/locales/en.js +3 -11
- package/lib/locales/zh.js +3 -11
- package/lib/package.js +164 -218
- package/lib/provider.js +85 -107
- package/lib/types.js +1 -3
- package/lib/user.d.ts +1 -1
- package/lib/user.js +26 -39
- package/lib/utils/add-gitignore.js +16 -29
- package/lib/utils/app-info-parser/aab.js +133 -157
- package/lib/utils/app-info-parser/apk.js +42 -39
- package/lib/utils/app-info-parser/app.js +5 -11
- package/lib/utils/app-info-parser/index.js +21 -31
- package/lib/utils/app-info-parser/ipa.js +35 -35
- package/lib/utils/app-info-parser/resource-finder.js +84 -71
- package/lib/utils/app-info-parser/utils.js +52 -77
- package/lib/utils/app-info-parser/xml-parser/binary.js +82 -90
- package/lib/utils/app-info-parser/xml-parser/manifest.js +88 -98
- package/lib/utils/app-info-parser/zip.js +43 -51
- package/lib/utils/check-lockfile.js +28 -37
- package/lib/utils/check-plugin.js +16 -32
- package/lib/utils/command-result.js +7 -20
- package/lib/utils/constants.js +23 -63
- package/lib/utils/dep-versions.js +21 -27
- package/lib/utils/git.js +20 -64
- package/lib/utils/hbcTransform.js +133 -246
- package/lib/utils/http-helper.js +33 -44
- package/lib/utils/i18n.js +17 -26
- package/lib/utils/index.js +137 -179
- package/lib/utils/latest-version/index.js +128 -137
- package/lib/utils/options.js +13 -34
- package/lib/utils/plugin-config.js +43 -56
- package/lib/utils/runtime.js +50 -108
- package/lib/utils/zip-entries.js +70 -97
- package/lib/utils/zip-options.js +80 -181
- package/lib/versions.js +231 -265
- package/package.json +19 -21
- package/src/api.ts +44 -3
- package/src/package.ts +1 -1
- package/src/user.ts +1 -1
- package/src/versions.ts +1 -1
package/lib/bundle.js
CHANGED
|
@@ -1,109 +1,91 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
const _app = require("./app");
|
|
21
|
-
const _bundlepack = require("./bundle-pack");
|
|
22
|
-
const _bundlerunner = require("./bundle-runner");
|
|
23
|
-
const _utils = require("./utils");
|
|
24
|
-
const _addgitignore = require("./utils/add-gitignore");
|
|
25
|
-
const _checklockfile = require("./utils/check-lockfile");
|
|
26
|
-
const _constants = require("./utils/constants");
|
|
27
|
-
const _depversions = require("./utils/dep-versions");
|
|
28
|
-
const _i18n = require("./utils/i18n");
|
|
29
|
-
const _options = require("./utils/options");
|
|
30
|
-
const _versions = require("./versions");
|
|
31
|
-
function _interop_require_default(obj) {
|
|
32
|
-
return obj && obj.__esModule ? obj : {
|
|
33
|
-
default: obj
|
|
34
|
-
};
|
|
35
|
-
}
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.bundleCommands = void 0;
|
|
7
|
+
exports.normalizeBundleOptions = normalizeBundleOptions;
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const app_1 = require("./app");
|
|
10
|
+
const bundle_pack_1 = require("./bundle-pack");
|
|
11
|
+
const bundle_runner_1 = require("./bundle-runner");
|
|
12
|
+
const utils_1 = require("./utils");
|
|
13
|
+
const add_gitignore_1 = require("./utils/add-gitignore");
|
|
14
|
+
const check_lockfile_1 = require("./utils/check-lockfile");
|
|
15
|
+
const constants_1 = require("./utils/constants");
|
|
16
|
+
const dep_versions_1 = require("./utils/dep-versions");
|
|
17
|
+
const i18n_1 = require("./utils/i18n");
|
|
18
|
+
const options_1 = require("./utils/options");
|
|
19
|
+
const versions_1 = require("./versions");
|
|
36
20
|
function getAliasedOptionalStringOption(options, key, alias) {
|
|
37
|
-
|
|
38
|
-
|
|
21
|
+
return ((0, options_1.getOptionalStringOption)(options, key) ??
|
|
22
|
+
(0, options_1.getOptionalStringOption)(options, alias));
|
|
39
23
|
}
|
|
40
24
|
function normalizeBundleOptions(translatedOptions, platform) {
|
|
41
25
|
return {
|
|
42
26
|
// harmony bundles always use this fixed name (runReactNativeBundleCommand
|
|
43
27
|
// forces it), so sourcemap paths and Sentry uploads must match
|
|
44
|
-
bundleName: platform === 'harmony'
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
28
|
+
bundleName: platform === 'harmony'
|
|
29
|
+
? 'bundle.harmony.js'
|
|
30
|
+
: (0, options_1.getStringOption)(translatedOptions, 'bundleName', 'index.bundlejs'),
|
|
31
|
+
entryFile: (0, options_1.getStringOption)(translatedOptions, 'entryFile', 'index.js'),
|
|
32
|
+
intermediaDir: (0, options_1.getStringOption)(translatedOptions, 'intermediaDir', `${constants_1.tempDir}/intermedia/${platform}`),
|
|
33
|
+
output: (0, options_1.getStringOption)(translatedOptions, 'output', `${constants_1.tempDir}/output/${platform}.\${time}.ppk`),
|
|
34
|
+
dev: (0, options_1.getBooleanOption)(translatedOptions, 'dev', false) ? 'true' : 'false',
|
|
35
|
+
sourcemap: (0, options_1.getBooleanOption)(translatedOptions, 'sourcemap', false),
|
|
36
|
+
taro: (0, options_1.getBooleanOption)(translatedOptions, 'taro', false),
|
|
37
|
+
expo: (0, options_1.getBooleanOption)(translatedOptions, 'expo', false),
|
|
38
|
+
rncli: (0, options_1.getBooleanOption)(translatedOptions, 'rncli', false),
|
|
39
|
+
hermes: (0, options_1.getBooleanOption)(translatedOptions, 'hermes', false),
|
|
40
|
+
name: (0, options_1.getOptionalStringOption)(translatedOptions, 'name'),
|
|
41
|
+
description: (0, options_1.getOptionalStringOption)(translatedOptions, 'description'),
|
|
42
|
+
metaInfo: (0, options_1.getOptionalStringOption)(translatedOptions, 'metaInfo'),
|
|
43
|
+
packageId: (0, options_1.getOptionalStringOption)(translatedOptions, 'packageId'),
|
|
44
|
+
packageVersion: (0, options_1.getOptionalStringOption)(translatedOptions, 'packageVersion'),
|
|
45
|
+
minPackageVersion: (0, options_1.getOptionalStringOption)(translatedOptions, 'minPackageVersion'),
|
|
46
|
+
maxPackageVersion: (0, options_1.getOptionalStringOption)(translatedOptions, 'maxPackageVersion'),
|
|
47
|
+
packageVersionRange: (0, options_1.getOptionalStringOption)(translatedOptions, 'packageVersionRange'),
|
|
48
|
+
rollout: (0, options_1.getOptionalStringOption)(translatedOptions, 'rollout'),
|
|
49
|
+
dryRun: (0, options_1.getBooleanOption)(translatedOptions, 'dryRun', false),
|
|
64
50
|
sentryRelease: getAliasedOptionalStringOption(translatedOptions, 'sentry-release', 'sentryRelease'),
|
|
65
|
-
sentryDist: getAliasedOptionalStringOption(translatedOptions, 'sentry-dist', 'sentryDist')
|
|
51
|
+
sentryDist: getAliasedOptionalStringOption(translatedOptions, 'sentry-dist', 'sentryDist'),
|
|
66
52
|
};
|
|
67
53
|
}
|
|
68
54
|
async function uploadSentryArtifactsIfNeeded(shouldUpload, bundleName, intermediaDir, sourcemapOutput, platform, sentryOptions) {
|
|
69
55
|
if (!shouldUpload) {
|
|
70
56
|
return;
|
|
71
57
|
}
|
|
72
|
-
await (0,
|
|
73
|
-
await (0,
|
|
58
|
+
await (0, bundle_runner_1.copyDebugidForSentry)(bundleName, intermediaDir, sourcemapOutput);
|
|
59
|
+
await (0, bundle_runner_1.uploadSourcemapForSentry)(bundleName, intermediaDir, sourcemapOutput, platform, sentryOptions);
|
|
74
60
|
}
|
|
75
61
|
async function publishBundleVersion(outputPath, platform, payload) {
|
|
76
|
-
return
|
|
77
|
-
args: [
|
|
78
|
-
outputPath
|
|
79
|
-
],
|
|
62
|
+
return versions_1.versionCommands.publish({
|
|
63
|
+
args: [outputPath],
|
|
80
64
|
options: {
|
|
81
65
|
platform,
|
|
82
|
-
...payload
|
|
83
|
-
}
|
|
66
|
+
...payload,
|
|
67
|
+
},
|
|
84
68
|
});
|
|
85
69
|
}
|
|
86
|
-
|
|
87
|
-
bundle: async ({ options })=>{
|
|
88
|
-
const platform = await (0,
|
|
89
|
-
const translatedOptions = (0,
|
|
70
|
+
exports.bundleCommands = {
|
|
71
|
+
bundle: async ({ options, }) => {
|
|
72
|
+
const platform = await (0, app_1.getPlatform)(typeof options.platform === 'string' ? options.platform : undefined);
|
|
73
|
+
const translatedOptions = (0, utils_1.translateOptions)({
|
|
90
74
|
...options,
|
|
91
|
-
tempDir:
|
|
92
|
-
platform
|
|
75
|
+
tempDir: constants_1.tempDir,
|
|
76
|
+
platform,
|
|
93
77
|
});
|
|
94
78
|
const normalized = normalizeBundleOptions(translatedOptions, platform);
|
|
95
|
-
(0,
|
|
96
|
-
(0,
|
|
97
|
-
const bundleParams = await (0,
|
|
98
|
-
const sourcemapOutput =
|
|
79
|
+
(0, check_lockfile_1.checkLockFiles)();
|
|
80
|
+
(0, add_gitignore_1.addGitIgnore)();
|
|
81
|
+
const bundleParams = await (0, utils_1.checkPlugins)();
|
|
82
|
+
const sourcemapOutput = path_1.default.join(normalized.intermediaDir, `${normalized.bundleName}.map`);
|
|
99
83
|
const realOutput = normalized.output.replace(/\$\{time\}/g, `${Date.now()}`);
|
|
100
84
|
if (!platform) {
|
|
101
|
-
throw new Error((0,
|
|
85
|
+
throw new Error((0, i18n_1.t)('platformRequired'));
|
|
102
86
|
}
|
|
103
|
-
console.log((0,
|
|
104
|
-
|
|
105
|
-
}));
|
|
106
|
-
await (0, _bundlerunner.runReactNativeBundleCommand)({
|
|
87
|
+
console.log((0, i18n_1.t)('bundlingWithRN', { version: dep_versions_1.depVersions['react-native'] }));
|
|
88
|
+
await (0, bundle_runner_1.runReactNativeBundleCommand)({
|
|
107
89
|
bundleName: normalized.bundleName,
|
|
108
90
|
dev: normalized.dev,
|
|
109
91
|
entryFile: normalized.entryFile,
|
|
@@ -114,11 +96,11 @@ const bundleCommands = {
|
|
|
114
96
|
cli: {
|
|
115
97
|
taro: normalized.taro,
|
|
116
98
|
expo: normalized.expo,
|
|
117
|
-
rncli: normalized.rncli
|
|
99
|
+
rncli: normalized.rncli,
|
|
118
100
|
},
|
|
119
|
-
isSentry: bundleParams.sentry
|
|
101
|
+
isSentry: bundleParams.sentry,
|
|
120
102
|
});
|
|
121
|
-
await (0,
|
|
103
|
+
await (0, bundle_pack_1.packBundle)(path_1.default.resolve(normalized.intermediaDir), realOutput, normalized.bundleName);
|
|
122
104
|
if (normalized.name) {
|
|
123
105
|
await publishBundleVersion(realOutput, platform, {
|
|
124
106
|
name: normalized.name,
|
|
@@ -130,23 +112,23 @@ const bundleCommands = {
|
|
|
130
112
|
maxPackageVersion: normalized.maxPackageVersion,
|
|
131
113
|
packageVersionRange: normalized.packageVersionRange,
|
|
132
114
|
rollout: normalized.rollout,
|
|
133
|
-
dryRun: normalized.dryRun
|
|
115
|
+
dryRun: normalized.dryRun,
|
|
134
116
|
});
|
|
135
117
|
await uploadSentryArtifactsIfNeeded(bundleParams.sentry, normalized.bundleName, normalized.intermediaDir, sourcemapOutput, platform, {
|
|
136
118
|
sentryRelease: normalized.sentryRelease,
|
|
137
|
-
sentryDist: normalized.sentryDist
|
|
119
|
+
sentryDist: normalized.sentryDist,
|
|
138
120
|
});
|
|
139
121
|
return;
|
|
140
122
|
}
|
|
141
|
-
if (!(0,
|
|
142
|
-
const v = await (0,
|
|
123
|
+
if (!(0, options_1.getBooleanOption)(options, 'no-interactive', false)) {
|
|
124
|
+
const v = await (0, utils_1.question)((0, i18n_1.t)('uploadBundlePrompt'));
|
|
143
125
|
if (v.toLowerCase() === 'y') {
|
|
144
126
|
await publishBundleVersion(realOutput, platform, {});
|
|
145
127
|
await uploadSentryArtifactsIfNeeded(bundleParams.sentry, normalized.bundleName, normalized.intermediaDir, sourcemapOutput, platform, {
|
|
146
128
|
sentryRelease: normalized.sentryRelease,
|
|
147
|
-
sentryDist: normalized.sentryDist
|
|
129
|
+
sentryDist: normalized.sentryDist,
|
|
148
130
|
});
|
|
149
131
|
}
|
|
150
132
|
}
|
|
151
|
-
}
|
|
133
|
+
},
|
|
152
134
|
};
|