rn-update-cli 1.0.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/LICENSE +21 -0
- package/README.md +167 -0
- package/README.zh-CN.md +167 -0
- package/cli.json +525 -0
- package/lib/api.d.ts +56 -0
- package/lib/api.js +671 -0
- package/lib/app.d.ts +107 -0
- package/lib/app.js +329 -0
- package/lib/auto-update.d.ts +35 -0
- package/lib/auto-update.js +507 -0
- package/lib/bin.d.ts +2 -0
- package/lib/bin.js +133 -0
- package/lib/bundle-pack.d.ts +6 -0
- package/lib/bundle-pack.js +91 -0
- package/lib/bundle-runner.d.ts +168 -0
- package/lib/bundle-runner.js +1305 -0
- package/lib/bundle.d.ts +45 -0
- package/lib/bundle.js +226 -0
- package/lib/cache.d.ts +10 -0
- package/lib/cache.js +25 -0
- package/lib/commands.d.ts +11 -0
- package/lib/commands.js +72 -0
- package/lib/diff.d.ts +18 -0
- package/lib/diff.js +690 -0
- package/lib/exports.d.ts +11 -0
- package/lib/exports.js +20 -0
- package/lib/install.d.ts +9 -0
- package/lib/install.js +51 -0
- package/lib/locales/en.d.ts +187 -0
- package/lib/locales/en.js +194 -0
- package/lib/locales/zh.d.ts +187 -0
- package/lib/locales/zh.js +194 -0
- package/lib/native-package.d.ts +21 -0
- package/lib/native-package.js +298 -0
- package/lib/package.d.ts +68 -0
- package/lib/package.js +487 -0
- package/lib/provider.d.ts +24 -0
- package/lib/provider.js +244 -0
- package/lib/standalone-publish.d.ts +17 -0
- package/lib/standalone-publish.js +433 -0
- package/lib/symbolicate.d.ts +35 -0
- package/lib/symbolicate.js +130 -0
- package/lib/types.d.ts +152 -0
- package/lib/types.js +2 -0
- package/lib/user.d.ts +8 -0
- package/lib/user.js +50 -0
- package/lib/utils/add-gitignore.d.ts +6 -0
- package/lib/utils/add-gitignore.js +44 -0
- package/lib/utils/app-info-parser/aab.d.ts +27 -0
- package/lib/utils/app-info-parser/aab.js +256 -0
- package/lib/utils/app-info-parser/apk.d.ts +19 -0
- package/lib/utils/app-info-parser/apk.js +95 -0
- package/lib/utils/app-info-parser/app.d.ts +9 -0
- package/lib/utils/app-info-parser/app.js +15 -0
- package/lib/utils/app-info-parser/index.d.ts +21 -0
- package/lib/utils/app-info-parser/index.js +51 -0
- package/lib/utils/app-info-parser/ipa.d.ts +19 -0
- package/lib/utils/app-info-parser/ipa.js +101 -0
- package/lib/utils/app-info-parser/resource-finder.d.ts +49 -0
- package/lib/utils/app-info-parser/resource-finder.js +429 -0
- package/lib/utils/app-info-parser/utils.d.ts +36 -0
- package/lib/utils/app-info-parser/utils.js +140 -0
- package/lib/utils/app-info-parser/xml-parser/binary.d.ts +61 -0
- package/lib/utils/app-info-parser/xml-parser/binary.js +577 -0
- package/lib/utils/app-info-parser/xml-parser/manifest.d.ts +15 -0
- package/lib/utils/app-info-parser/xml-parser/manifest.js +207 -0
- package/lib/utils/app-info-parser/zip.d.ts +29 -0
- package/lib/utils/app-info-parser/zip.js +97 -0
- package/lib/utils/check-lockfile.d.ts +6 -0
- package/lib/utils/check-lockfile.js +93 -0
- package/lib/utils/check-plugin.d.ts +12 -0
- package/lib/utils/check-plugin.js +36 -0
- package/lib/utils/command-result.d.ts +8 -0
- package/lib/utils/command-result.js +27 -0
- package/lib/utils/constants.d.ts +10 -0
- package/lib/utils/constants.js +39 -0
- package/lib/utils/dep-versions.d.ts +20 -0
- package/lib/utils/dep-versions.js +129 -0
- package/lib/utils/git.d.ts +14 -0
- package/lib/utils/git.js +64 -0
- package/lib/utils/hbcTransform.d.ts +111 -0
- package/lib/utils/hbcTransform.js +561 -0
- package/lib/utils/hermes-base.d.ts +227 -0
- package/lib/utils/hermes-base.js +1287 -0
- package/lib/utils/hermes-literals.d.ts +64 -0
- package/lib/utils/hermes-literals.js +260 -0
- package/lib/utils/http-helper.d.ts +10 -0
- package/lib/utils/http-helper.js +150 -0
- package/lib/utils/i18n.d.ts +22 -0
- package/lib/utils/i18n.js +46 -0
- package/lib/utils/index.d.ts +67 -0
- package/lib/utils/index.js +545 -0
- package/lib/utils/latest-version/index.d.ts +154 -0
- package/lib/utils/latest-version/index.js +331 -0
- package/lib/utils/options.d.ts +10 -0
- package/lib/utils/options.js +68 -0
- package/lib/utils/plugin-config.d.ts +14 -0
- package/lib/utils/plugin-config.js +66 -0
- package/lib/utils/runtime.d.ts +54 -0
- package/lib/utils/runtime.js +263 -0
- package/lib/utils/slim-sourcemap.d.ts +28 -0
- package/lib/utils/slim-sourcemap.js +106 -0
- package/lib/utils/zip-entries.d.ts +10 -0
- package/lib/utils/zip-entries.js +211 -0
- package/lib/utils/zip-options.d.ts +17 -0
- package/lib/utils/zip-options.js +190 -0
- package/lib/utils/zip-range.d.ts +148 -0
- package/lib/utils/zip-range.js +581 -0
- package/lib/utils/zip-raw-writer.d.ts +52 -0
- package/lib/utils/zip-raw-writer.js +209 -0
- package/lib/version-operations.d.ts +21 -0
- package/lib/version-operations.js +320 -0
- package/lib/versions.d.ts +66 -0
- package/lib/versions.js +402 -0
- package/package.json +113 -0
- package/proto/Configuration.proto +183 -0
- package/proto/Resources.proto +569 -0
package/lib/provider.js
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.CLIProviderImpl = void 0;
|
|
37
|
+
/**
|
|
38
|
+
* [INPUT]: 依赖 CLI 命令编排器、会话初始化与公共 PublishOptions
|
|
39
|
+
* [OUTPUT]: 对外提供 CLIProviderImpl 的 bundle/publish/upload 等程序化命令入口,并完整传递独立投放参数
|
|
40
|
+
* [POS]: CLI 公共 SDK 边界;把调用方参数转换为命令上下文,不直接承担 HTTP 或发布事务
|
|
41
|
+
*/
|
|
42
|
+
const api_1 = require("./api");
|
|
43
|
+
const app_1 = require("./app");
|
|
44
|
+
const command_result_1 = require("./utils/command-result");
|
|
45
|
+
const i18n_1 = require("./utils/i18n");
|
|
46
|
+
const DEFAULT_BUNDLE_OUTPUT = '$' + '{tempDir}/output/$' + '{platform}.$' + '{time}.ppk';
|
|
47
|
+
class CLIProviderImpl {
|
|
48
|
+
session;
|
|
49
|
+
sessionInitPromise;
|
|
50
|
+
createContext(options, args = []) {
|
|
51
|
+
return { args, options };
|
|
52
|
+
}
|
|
53
|
+
async ensureInitialized() {
|
|
54
|
+
if (this.session) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (!this.sessionInitPromise) {
|
|
58
|
+
this.sessionInitPromise = (async () => {
|
|
59
|
+
await (0, api_1.loadSession)();
|
|
60
|
+
this.session = (0, api_1.getSession)();
|
|
61
|
+
})().finally(() => {
|
|
62
|
+
this.sessionInitPromise = undefined;
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
await this.sessionInitPromise;
|
|
66
|
+
}
|
|
67
|
+
runMessageCommand(task, fallbackError, successMessage, requireSession = true) {
|
|
68
|
+
return (0, command_result_1.runAsCommandResult)(async () => {
|
|
69
|
+
if (requireSession) {
|
|
70
|
+
await this.ensureInitialized();
|
|
71
|
+
}
|
|
72
|
+
await task();
|
|
73
|
+
}, fallbackError, () => ({ message: successMessage }));
|
|
74
|
+
}
|
|
75
|
+
runDataCommand(task, fallbackError, requireSession = true) {
|
|
76
|
+
return (0, command_result_1.runAsCommandResult)(async () => {
|
|
77
|
+
if (requireSession) {
|
|
78
|
+
await this.ensureInitialized();
|
|
79
|
+
}
|
|
80
|
+
return task();
|
|
81
|
+
}, fallbackError);
|
|
82
|
+
}
|
|
83
|
+
async bundle(options) {
|
|
84
|
+
return this.runMessageCommand(async () => {
|
|
85
|
+
const context = this.createContext({
|
|
86
|
+
dev: options.dev || false,
|
|
87
|
+
platform: options.platform,
|
|
88
|
+
bundleName: options.bundleName || 'index.bundlejs',
|
|
89
|
+
entryFile: options.entryFile || 'index.js',
|
|
90
|
+
output: options.output || DEFAULT_BUNDLE_OUTPUT,
|
|
91
|
+
'no-interactive': true,
|
|
92
|
+
// on by default like the CLI: archived with the version for symbolicate
|
|
93
|
+
sourcemap: options.sourcemap ?? true,
|
|
94
|
+
taro: options.taro || false,
|
|
95
|
+
expo: options.expo || false,
|
|
96
|
+
rncli: options.rncli || false,
|
|
97
|
+
hermes: options.hermes || false,
|
|
98
|
+
hermesBase: options.hermesBase || 'auto',
|
|
99
|
+
verifyHermesBase: options.verifyHermesBase ?? true,
|
|
100
|
+
resetCache: options.resetCache ?? true,
|
|
101
|
+
sentryRelease: options.sentryRelease,
|
|
102
|
+
sentryDist: options.sentryDist,
|
|
103
|
+
appId: options.appId,
|
|
104
|
+
config: options.config,
|
|
105
|
+
});
|
|
106
|
+
const { bundleCommands } = await Promise.resolve().then(() => __importStar(require('./bundle')));
|
|
107
|
+
await bundleCommands.bundle(context);
|
|
108
|
+
}, 'Unknown error during bundling', 'Bundle created successfully', false);
|
|
109
|
+
}
|
|
110
|
+
async publish(options) {
|
|
111
|
+
return this.runMessageCommand(async () => {
|
|
112
|
+
const context = this.createContext({
|
|
113
|
+
name: options.name,
|
|
114
|
+
description: options.description,
|
|
115
|
+
metaInfo: options.metaInfo,
|
|
116
|
+
packageId: options.packageId,
|
|
117
|
+
packageVersion: options.packageVersion,
|
|
118
|
+
diffFromHash: options.diffFromHash,
|
|
119
|
+
channel: options.channel,
|
|
120
|
+
targets: options.targets,
|
|
121
|
+
deploymentIds: options.deploymentIds,
|
|
122
|
+
releaseIds: options.releaseIds,
|
|
123
|
+
minPackageVersion: options.minPackageVersion,
|
|
124
|
+
maxPackageVersion: options.maxPackageVersion,
|
|
125
|
+
packageVersionRange: options.packageVersionRange,
|
|
126
|
+
platform: options.platform,
|
|
127
|
+
appId: options.appId,
|
|
128
|
+
config: options.config,
|
|
129
|
+
'no-interactive': true,
|
|
130
|
+
rollout: options.rollout === undefined
|
|
131
|
+
? undefined
|
|
132
|
+
: String(options.rollout),
|
|
133
|
+
dryRun: options.dryRun || false,
|
|
134
|
+
sourcemap: options.sourcemap,
|
|
135
|
+
}, options.filePath ? [options.filePath] : []);
|
|
136
|
+
const { versionCommands } = await Promise.resolve().then(() => __importStar(require('./versions')));
|
|
137
|
+
await versionCommands.publish(context);
|
|
138
|
+
}, 'Unknown error during publishing', 'Version published successfully');
|
|
139
|
+
}
|
|
140
|
+
async symbolicate(options) {
|
|
141
|
+
return this.runMessageCommand(async () => {
|
|
142
|
+
const context = this.createContext({
|
|
143
|
+
hash: options.hash,
|
|
144
|
+
versionId: options.versionId,
|
|
145
|
+
platform: options.platform,
|
|
146
|
+
appId: options.appId,
|
|
147
|
+
config: options.config,
|
|
148
|
+
output: options.output,
|
|
149
|
+
}, options.stackFile ? [options.stackFile] : []);
|
|
150
|
+
const { symbolicateCommands } = await Promise.resolve().then(() => __importStar(require('./symbolicate')));
|
|
151
|
+
await symbolicateCommands.symbolicate(context);
|
|
152
|
+
}, 'Unknown error during symbolication', 'Stack symbolicated');
|
|
153
|
+
}
|
|
154
|
+
async upload(options) {
|
|
155
|
+
return this.runMessageCommand(async () => {
|
|
156
|
+
const filePath = options.filePath;
|
|
157
|
+
const fileType = filePath.split('.').pop()?.toLowerCase();
|
|
158
|
+
const context = this.createContext({
|
|
159
|
+
platform: options.platform,
|
|
160
|
+
appId: options.appId,
|
|
161
|
+
appKey: options.appKey,
|
|
162
|
+
version: options.version,
|
|
163
|
+
config: options.config,
|
|
164
|
+
}, [filePath]);
|
|
165
|
+
const { packageCommands } = await Promise.resolve().then(() => __importStar(require('./package')));
|
|
166
|
+
const uploadHandlerMap = {
|
|
167
|
+
ipa: packageCommands.uploadIpa,
|
|
168
|
+
apk: packageCommands.uploadApk,
|
|
169
|
+
aab: packageCommands.uploadAab,
|
|
170
|
+
app: packageCommands.uploadApp,
|
|
171
|
+
};
|
|
172
|
+
const uploadHandler = fileType && fileType in uploadHandlerMap
|
|
173
|
+
? uploadHandlerMap[fileType]
|
|
174
|
+
: undefined;
|
|
175
|
+
if (!uploadHandler) {
|
|
176
|
+
throw new Error((0, i18n_1.t)('unsupportedFileType', { fileType }));
|
|
177
|
+
}
|
|
178
|
+
await uploadHandler(context);
|
|
179
|
+
}, 'Unknown error during upload', 'File uploaded successfully');
|
|
180
|
+
}
|
|
181
|
+
async getSelectedApp(platform, config) {
|
|
182
|
+
const resolvedPlatform = await this.getPlatform(platform);
|
|
183
|
+
return (0, app_1.getSelectedApp)(resolvedPlatform, config);
|
|
184
|
+
}
|
|
185
|
+
async listApps(platform) {
|
|
186
|
+
return this.runDataCommand(async () => {
|
|
187
|
+
const { getAppCommands } = await Promise.resolve().then(() => __importStar(require('./app')));
|
|
188
|
+
return getAppCommands().apps({
|
|
189
|
+
options: { platform: platform ?? '' },
|
|
190
|
+
});
|
|
191
|
+
}, 'Unknown error listing apps');
|
|
192
|
+
}
|
|
193
|
+
async createApp(name, platform) {
|
|
194
|
+
return this.runMessageCommand(async () => {
|
|
195
|
+
const { getAppCommands } = await Promise.resolve().then(() => __importStar(require('./app')));
|
|
196
|
+
await getAppCommands().createApp({
|
|
197
|
+
options: {
|
|
198
|
+
name,
|
|
199
|
+
platform,
|
|
200
|
+
downloadUrl: '',
|
|
201
|
+
},
|
|
202
|
+
});
|
|
203
|
+
}, 'Unknown error creating app', 'App created successfully');
|
|
204
|
+
}
|
|
205
|
+
async listVersions(appId) {
|
|
206
|
+
return this.runDataCommand(async () => {
|
|
207
|
+
const { fetchVersions } = await Promise.resolve().then(() => __importStar(require('./versions')));
|
|
208
|
+
return fetchVersions(appId);
|
|
209
|
+
}, 'Unknown error listing versions');
|
|
210
|
+
}
|
|
211
|
+
async updateVersion(appId, versionId, updates) {
|
|
212
|
+
return this.runMessageCommand(async () => {
|
|
213
|
+
const context = this.createContext({
|
|
214
|
+
appId,
|
|
215
|
+
versionId,
|
|
216
|
+
...updates,
|
|
217
|
+
'no-interactive': true,
|
|
218
|
+
rollout: updates.rollout === undefined ? undefined : String(updates.rollout),
|
|
219
|
+
});
|
|
220
|
+
const { versionCommands } = await Promise.resolve().then(() => __importStar(require('./versions')));
|
|
221
|
+
await versionCommands.update(context);
|
|
222
|
+
}, 'Unknown error updating version', 'Version updated successfully');
|
|
223
|
+
}
|
|
224
|
+
async getPlatform(platform) {
|
|
225
|
+
return (0, app_1.getPlatform)(platform);
|
|
226
|
+
}
|
|
227
|
+
async loadSession() {
|
|
228
|
+
await this.ensureInitialized();
|
|
229
|
+
if (!this.session) {
|
|
230
|
+
throw new Error((0, i18n_1.t)('failedToLoadSession'));
|
|
231
|
+
}
|
|
232
|
+
return this.session;
|
|
233
|
+
}
|
|
234
|
+
async listPackages(appId) {
|
|
235
|
+
return this.runDataCommand(async () => {
|
|
236
|
+
if (!appId) {
|
|
237
|
+
throw new Error((0, i18n_1.t)('appIdRequired'));
|
|
238
|
+
}
|
|
239
|
+
const { listPackage } = await Promise.resolve().then(() => __importStar(require('./package')));
|
|
240
|
+
return listPackage(appId);
|
|
241
|
+
}, 'Unknown error listing packages');
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
exports.CLIProviderImpl = CLIProviderImpl;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { VersionCommandOptions } from './versions';
|
|
2
|
+
export declare function publishStandalone(fn: string, appId: string, options: VersionCommandOptions): Promise<string>;
|
|
3
|
+
/** Retry publishing deployments returned by a failed standalone publish.
|
|
4
|
+
*
|
|
5
|
+
* Retry uses exact deployment ids and revisions; no artifact upload or new
|
|
6
|
+
* package is created.
|
|
7
|
+
*/
|
|
8
|
+
export declare function retryStandalonePublish(appId: string, releaseIdsInput: string, dryRun?: boolean): Promise<string>;
|
|
9
|
+
/**
|
|
10
|
+
* Upload and register one native-package patch for one exact build.
|
|
11
|
+
*
|
|
12
|
+
* The server deliberately does not expose a group-wide pdiff field for this
|
|
13
|
+
* command: a patch is only valid against the nativeVersionId it was built
|
|
14
|
+
* from. A dry-run resolves local arguments but never uploads or mutates a
|
|
15
|
+
* release mapping.
|
|
16
|
+
*/
|
|
17
|
+
export declare function registerStandalonePdiff(filePath: string, options: VersionCommandOptions): Promise<string>;
|