react-native-update-cli 2.10.1 → 2.11.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/README.md +47 -497
- package/README.zh-CN.md +52 -500
- package/cli.json +2 -16
- package/lib/api.js +1 -1
- package/lib/app.d.ts +1 -1
- package/lib/app.js +42 -45
- package/lib/bin.d.ts +2 -0
- package/lib/bin.js +70 -0
- package/lib/bundle-runner.d.ts +1 -0
- package/lib/bundle-runner.js +46 -10
- package/lib/exports.d.ts +2 -9
- package/lib/exports.js +0 -31
- package/lib/index.d.ts +1 -5
- package/lib/index.js +12 -128
- package/lib/locales/en.d.ts +1 -0
- package/lib/locales/en.js +1 -0
- package/lib/locales/zh.d.ts +1 -0
- package/lib/locales/zh.js +1 -0
- package/lib/package.d.ts +1 -2
- package/lib/package.js +50 -10
- package/lib/provider.d.ts +1 -4
- package/lib/provider.js +6 -25
- package/lib/types.d.ts +0 -37
- package/lib/user.d.ts +1 -1
- package/lib/user.js +1 -1
- package/lib/utils/app-info-parser/aab.js +46 -5
- package/lib/utils/app-info-parser/resource-finder.js +5 -5
- package/lib/utils/app-info-parser/utils.js +3 -2
- package/lib/utils/check-lockfile.js +1 -1
- package/lib/utils/dep-versions.js +2 -2
- package/lib/utils/http-helper.js +2 -2
- package/lib/utils/index.d.ts +0 -1
- package/lib/utils/index.js +0 -13
- package/lib/utils/plugin-config.js +42 -6
- package/lib/versions.d.ts +1 -0
- package/lib/versions.js +19 -16
- package/package.json +8 -10
- package/src/api.ts +1 -1
- package/src/app.ts +40 -40
- package/src/bin.ts +86 -0
- package/src/bundle-runner.ts +70 -12
- package/src/exports.ts +1 -12
- package/src/index.ts +1 -159
- package/src/locales/en.ts +1 -0
- package/src/locales/zh.ts +1 -0
- package/src/package.ts +6 -10
- package/src/provider.ts +10 -29
- package/src/types.ts +0 -54
- package/src/user.ts +1 -1
- package/src/utils/app-info-parser/aab.ts +2 -2
- package/src/utils/app-info-parser/resource-finder.ts +5 -5
- package/src/utils/app-info-parser/utils.ts +2 -2
- package/src/utils/check-lockfile.ts +1 -1
- package/src/utils/dep-versions.ts +2 -2
- package/src/utils/http-helper.ts +2 -2
- package/src/utils/index.ts +1 -12
- package/src/utils/plugin-config.ts +1 -1
- package/src/versions.ts +25 -17
- package/lib/module-manager.d.ts +0 -20
- package/lib/module-manager.js +0 -118
- package/lib/modules/app-module.d.ts +0 -2
- package/lib/modules/app-module.js +0 -263
- package/lib/modules/bundle-module.d.ts +0 -2
- package/lib/modules/bundle-module.js +0 -187
- package/lib/modules/index.d.ts +0 -6
- package/lib/modules/index.js +0 -42
- package/lib/modules/package-module.d.ts +0 -2
- package/lib/modules/package-module.js +0 -16
- package/lib/modules/user-module.d.ts +0 -2
- package/lib/modules/user-module.js +0 -413
- package/lib/modules/version-module.d.ts +0 -2
- package/lib/modules/version-module.js +0 -16
- package/lib/workflow-runner.d.ts +0 -2
- package/lib/workflow-runner.js +0 -25
- package/src/module-manager.ts +0 -145
- package/src/modules/app-module.ts +0 -277
- package/src/modules/bundle-module.ts +0 -212
- package/src/modules/index.ts +0 -19
- package/src/modules/package-module.ts +0 -10
- package/src/modules/user-module.ts +0 -465
- package/src/modules/version-module.ts +0 -8
- package/src/workflow-runner.ts +0 -24
package/lib/provider.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { BundleOptions, CLIProvider,
|
|
1
|
+
import type { BundleOptions, CLIProvider, CommandResult, Platform, PublishOptions, Session, UploadOptions, Version } from './types';
|
|
2
2
|
export declare class CLIProviderImpl implements CLIProvider {
|
|
3
|
-
private workflows;
|
|
4
3
|
private session?;
|
|
5
4
|
private sessionInitPromise?;
|
|
6
5
|
private createContext;
|
|
@@ -20,7 +19,5 @@ export declare class CLIProviderImpl implements CLIProvider {
|
|
|
20
19
|
updateVersion(appId: string, versionId: string, updates: Partial<Version>): Promise<CommandResult>;
|
|
21
20
|
getPlatform(platform?: Platform): Promise<Platform>;
|
|
22
21
|
loadSession(): Promise<Session>;
|
|
23
|
-
registerWorkflow(workflow: CustomWorkflow): void;
|
|
24
|
-
executeWorkflow(workflowName: string, context: CommandContext): Promise<CommandResult>;
|
|
25
22
|
listPackages(appId?: string): Promise<CommandResult>;
|
|
26
23
|
}
|
package/lib/provider.js
CHANGED
|
@@ -11,7 +11,6 @@ Object.defineProperty(exports, "CLIProviderImpl", {
|
|
|
11
11
|
const _api = require("./api");
|
|
12
12
|
const _app = require("./app");
|
|
13
13
|
const _commandresult = require("./utils/command-result");
|
|
14
|
-
const _workflowrunner = require("./workflow-runner");
|
|
15
14
|
function _getRequireWildcardCache(nodeInterop) {
|
|
16
15
|
if (typeof WeakMap !== "function") return null;
|
|
17
16
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -53,6 +52,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
53
52
|
}
|
|
54
53
|
return newObj;
|
|
55
54
|
}
|
|
55
|
+
const DEFAULT_BUNDLE_OUTPUT = '$' + '{tempDir}/output/$' + '{platform}.$' + '{time}.ppk';
|
|
56
56
|
class CLIProviderImpl {
|
|
57
57
|
createContext(options, args = []) {
|
|
58
58
|
return {
|
|
@@ -99,7 +99,7 @@ class CLIProviderImpl {
|
|
|
99
99
|
platform: options.platform,
|
|
100
100
|
bundleName: options.bundleName || 'index.bundlejs',
|
|
101
101
|
entryFile: options.entryFile || 'index.js',
|
|
102
|
-
output: options.output ||
|
|
102
|
+
output: options.output || DEFAULT_BUNDLE_OUTPUT,
|
|
103
103
|
sourcemap: options.sourcemap || false,
|
|
104
104
|
taro: options.taro || false,
|
|
105
105
|
expo: options.expo || false,
|
|
@@ -163,8 +163,8 @@ class CLIProviderImpl {
|
|
|
163
163
|
async listApps(platform) {
|
|
164
164
|
return this.runMessageCommand(async ()=>{
|
|
165
165
|
const resolvedPlatform = await this.getPlatform(platform);
|
|
166
|
-
const {
|
|
167
|
-
await
|
|
166
|
+
const { getAppCommands } = await Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("./app")));
|
|
167
|
+
await getAppCommands().apps({
|
|
168
168
|
options: {
|
|
169
169
|
platform: resolvedPlatform
|
|
170
170
|
}
|
|
@@ -173,8 +173,8 @@ class CLIProviderImpl {
|
|
|
173
173
|
}
|
|
174
174
|
async createApp(name, platform) {
|
|
175
175
|
return this.runMessageCommand(async ()=>{
|
|
176
|
-
const {
|
|
177
|
-
await
|
|
176
|
+
const { getAppCommands } = await Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("./app")));
|
|
177
|
+
await getAppCommands().createApp({
|
|
178
178
|
options: {
|
|
179
179
|
name,
|
|
180
180
|
platform,
|
|
@@ -214,29 +214,10 @@ class CLIProviderImpl {
|
|
|
214
214
|
}
|
|
215
215
|
return this.session;
|
|
216
216
|
}
|
|
217
|
-
registerWorkflow(workflow) {
|
|
218
|
-
this.workflows.set(workflow.name, workflow);
|
|
219
|
-
}
|
|
220
|
-
async executeWorkflow(workflowName, context) {
|
|
221
|
-
return this.runDataCommand(async ()=>{
|
|
222
|
-
const workflow = this.workflows.get(workflowName);
|
|
223
|
-
if (!workflow) {
|
|
224
|
-
throw new Error(`Workflow '${workflowName}' not found`);
|
|
225
|
-
}
|
|
226
|
-
const result = await (0, _workflowrunner.runWorkflow)(workflowName, workflow, context);
|
|
227
|
-
return {
|
|
228
|
-
message: `Workflow '${workflowName}' completed successfully`,
|
|
229
|
-
result
|
|
230
|
-
};
|
|
231
|
-
}, `Workflow '${workflowName}' failed`);
|
|
232
|
-
}
|
|
233
217
|
async listPackages(appId) {
|
|
234
218
|
return this.runDataCommand(async ()=>{
|
|
235
219
|
const { listPackage } = await Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("./package")));
|
|
236
220
|
return listPackage(appId || '');
|
|
237
221
|
}, 'Unknown error listing packages');
|
|
238
222
|
}
|
|
239
|
-
constructor(){
|
|
240
|
-
this.workflows = new Map();
|
|
241
|
-
}
|
|
242
223
|
}
|
package/lib/types.d.ts
CHANGED
|
@@ -36,16 +36,6 @@ export interface CommandResult {
|
|
|
36
36
|
data?: unknown;
|
|
37
37
|
error?: string;
|
|
38
38
|
}
|
|
39
|
-
export interface CommandDefinition {
|
|
40
|
-
name: string;
|
|
41
|
-
description?: string;
|
|
42
|
-
handler: (context: CommandContext) => Promise<CommandResult>;
|
|
43
|
-
options?: Record<string, {
|
|
44
|
-
hasValue?: boolean;
|
|
45
|
-
default?: unknown;
|
|
46
|
-
description?: string;
|
|
47
|
-
}>;
|
|
48
|
-
}
|
|
49
39
|
export interface BundleOptions {
|
|
50
40
|
dev?: boolean;
|
|
51
41
|
platform?: Platform;
|
|
@@ -76,23 +66,6 @@ export interface UploadOptions {
|
|
|
76
66
|
appId?: string;
|
|
77
67
|
version?: string;
|
|
78
68
|
}
|
|
79
|
-
export interface WorkflowStep {
|
|
80
|
-
name: string;
|
|
81
|
-
description?: string;
|
|
82
|
-
execute: (context: CommandContext, previousResult?: unknown) => Promise<unknown>;
|
|
83
|
-
condition?: (context: CommandContext) => boolean;
|
|
84
|
-
}
|
|
85
|
-
export interface CustomWorkflow {
|
|
86
|
-
name: string;
|
|
87
|
-
description?: string;
|
|
88
|
-
steps: WorkflowStep[];
|
|
89
|
-
validate?: (context: CommandContext) => boolean;
|
|
90
|
-
options?: Record<string, {
|
|
91
|
-
hasValue?: boolean;
|
|
92
|
-
default?: unknown;
|
|
93
|
-
description?: string;
|
|
94
|
-
}>;
|
|
95
|
-
}
|
|
96
69
|
export interface CLIProvider {
|
|
97
70
|
bundle: (options: BundleOptions) => Promise<CommandResult>;
|
|
98
71
|
publish: (options: PublishOptions) => Promise<CommandResult>;
|
|
@@ -107,14 +80,4 @@ export interface CLIProvider {
|
|
|
107
80
|
updateVersion: (appId: string, versionId: string, updates: Partial<Version>) => Promise<CommandResult>;
|
|
108
81
|
getPlatform: (platform?: Platform) => Promise<Platform>;
|
|
109
82
|
loadSession: () => Promise<Session>;
|
|
110
|
-
registerWorkflow: (workflow: CustomWorkflow) => void;
|
|
111
|
-
executeWorkflow: (workflowName: string, context: CommandContext) => Promise<CommandResult>;
|
|
112
|
-
}
|
|
113
|
-
export interface CLIModule {
|
|
114
|
-
name: string;
|
|
115
|
-
version: string;
|
|
116
|
-
commands?: CommandDefinition[];
|
|
117
|
-
workflows?: CustomWorkflow[];
|
|
118
|
-
init?: (provider: CLIProvider) => void;
|
|
119
|
-
cleanup?: () => void;
|
|
120
83
|
}
|
package/lib/user.d.ts
CHANGED
package/lib/user.js
CHANGED
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "AabParser", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _child_process = require("child_process");
|
|
12
|
-
const _fsextra = /*#__PURE__*/
|
|
12
|
+
const _fsextra = /*#__PURE__*/ _interop_require_wildcard(require("fs-extra"));
|
|
13
13
|
const _os = /*#__PURE__*/ _interop_require_default(require("os"));
|
|
14
14
|
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
15
15
|
const _yauzl = require("yauzl");
|
|
@@ -23,6 +23,47 @@ function _interop_require_default(obj) {
|
|
|
23
23
|
default: obj
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
27
|
+
if (typeof WeakMap !== "function") return null;
|
|
28
|
+
var cacheBabelInterop = new WeakMap();
|
|
29
|
+
var cacheNodeInterop = new WeakMap();
|
|
30
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
31
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
32
|
+
})(nodeInterop);
|
|
33
|
+
}
|
|
34
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
35
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
36
|
+
return obj;
|
|
37
|
+
}
|
|
38
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
39
|
+
return {
|
|
40
|
+
default: obj
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
44
|
+
if (cache && cache.has(obj)) {
|
|
45
|
+
return cache.get(obj);
|
|
46
|
+
}
|
|
47
|
+
var newObj = {
|
|
48
|
+
__proto__: null
|
|
49
|
+
};
|
|
50
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
51
|
+
for(var key in obj){
|
|
52
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
53
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
54
|
+
if (desc && (desc.get || desc.set)) {
|
|
55
|
+
Object.defineProperty(newObj, key, desc);
|
|
56
|
+
} else {
|
|
57
|
+
newObj[key] = obj[key];
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
newObj.default = obj;
|
|
62
|
+
if (cache) {
|
|
63
|
+
cache.set(obj, newObj);
|
|
64
|
+
}
|
|
65
|
+
return newObj;
|
|
66
|
+
}
|
|
26
67
|
class AabParser extends _zip.Zip {
|
|
27
68
|
async extractApk(outputPath, { includeAllSplits, splits }) {
|
|
28
69
|
const normalizedSplits = Array.isArray(splits) ? splits.map((item)=>item.trim()).filter(Boolean) : [];
|
|
@@ -88,7 +129,7 @@ class AabParser extends _zip.Zip {
|
|
|
88
129
|
'--overwrite',
|
|
89
130
|
...modulesArgs
|
|
90
131
|
]);
|
|
91
|
-
} catch (
|
|
132
|
+
} catch (_e) {
|
|
92
133
|
// Fallback to npx node-bundletool if bundletool is not in PATH
|
|
93
134
|
// We use -y to avoid interactive prompt for installation
|
|
94
135
|
if (await needsNpxDownload()) {
|
|
@@ -130,7 +171,7 @@ class AabParser extends _zip.Zip {
|
|
|
130
171
|
reject(err || new Error((0, _i18n.t)('aabReadUniversalApkFailed')));
|
|
131
172
|
return;
|
|
132
173
|
}
|
|
133
|
-
const writeStream = _fsextra.
|
|
174
|
+
const writeStream = _fsextra.createWriteStream(outputPath);
|
|
134
175
|
readStream.pipe(writeStream);
|
|
135
176
|
writeStream.on('close', ()=>{
|
|
136
177
|
zipfile.close();
|
|
@@ -150,8 +191,8 @@ class AabParser extends _zip.Zip {
|
|
|
150
191
|
});
|
|
151
192
|
} finally{
|
|
152
193
|
// Cleanup
|
|
153
|
-
if (await _fsextra.
|
|
154
|
-
await _fsextra.
|
|
194
|
+
if (await _fsextra.pathExists(tempApksPath)) {
|
|
195
|
+
await _fsextra.remove(tempApksPath);
|
|
155
196
|
}
|
|
156
197
|
}
|
|
157
198
|
}
|
|
@@ -59,14 +59,14 @@ class ResourceFinder {
|
|
|
59
59
|
while(true){
|
|
60
60
|
let pos = 0;
|
|
61
61
|
let t = 0;
|
|
62
|
-
let
|
|
62
|
+
let _hs = 0;
|
|
63
63
|
let s = 0;
|
|
64
64
|
try {
|
|
65
65
|
pos = bb.offset;
|
|
66
66
|
t = bb.readShort();
|
|
67
|
-
|
|
67
|
+
_hs = bb.readShort();
|
|
68
68
|
s = bb.readInt();
|
|
69
|
-
} catch (
|
|
69
|
+
} catch (_e) {
|
|
70
70
|
break;
|
|
71
71
|
}
|
|
72
72
|
if (t === RES_STRING_POOL_TYPE) {
|
|
@@ -181,7 +181,7 @@ class ResourceFinder {
|
|
|
181
181
|
if (!bb.remaining()) {
|
|
182
182
|
break;
|
|
183
183
|
}
|
|
184
|
-
} catch (
|
|
184
|
+
} catch (_e) {
|
|
185
185
|
break;
|
|
186
186
|
}
|
|
187
187
|
}
|
|
@@ -225,7 +225,7 @@ class ResourceFinder {
|
|
|
225
225
|
entrySize = bb.readShort();
|
|
226
226
|
entryFlag = bb.readShort();
|
|
227
227
|
entryKey = bb.readInt();
|
|
228
|
-
} catch (
|
|
228
|
+
} catch (_e) {
|
|
229
229
|
break;
|
|
230
230
|
}
|
|
231
231
|
void entrySize;
|
|
@@ -92,7 +92,8 @@ const isBrowser = ()=>typeof window !== 'undefined' && typeof window.document !=
|
|
|
92
92
|
* find .apk file's icon path from json info
|
|
93
93
|
* @param info // json info parsed from .apk file
|
|
94
94
|
*/ const findApkIconPath = (info)=>{
|
|
95
|
-
|
|
95
|
+
var _info_application_icon;
|
|
96
|
+
if (!((_info_application_icon = info.application.icon) == null ? void 0 : _info_application_icon.splice)) {
|
|
96
97
|
return '';
|
|
97
98
|
}
|
|
98
99
|
const rulesMap = {
|
|
@@ -152,7 +153,7 @@ const isBrowser = ()=>typeof window !== 'undefined' && typeof window.document !=
|
|
|
152
153
|
* @param {String} str
|
|
153
154
|
*/ const decodeNullUnicode = (value)=>{
|
|
154
155
|
if (typeof value === 'string') {
|
|
155
|
-
// biome-ignore lint/suspicious/noControlCharactersInRegex:
|
|
156
|
+
// biome-ignore lint/suspicious/noControlCharactersInRegex: strips null unicode padding from decoded strings
|
|
156
157
|
return value.replace(/\u0000/g, '');
|
|
157
158
|
}
|
|
158
159
|
return value;
|
|
@@ -11,7 +11,7 @@ Object.defineProperty(exports, "depVersions", {
|
|
|
11
11
|
let currentPackage = null;
|
|
12
12
|
try {
|
|
13
13
|
currentPackage = require(`${process.cwd()}/package.json`);
|
|
14
|
-
} catch (
|
|
14
|
+
} catch (_e) {
|
|
15
15
|
// console.warn('No package.json file were found');
|
|
16
16
|
}
|
|
17
17
|
const _depVersions = {};
|
|
@@ -33,7 +33,7 @@ if (currentPackage) {
|
|
|
33
33
|
});
|
|
34
34
|
const version = require(packageJsonPath).version;
|
|
35
35
|
_depVersions[dep] = version;
|
|
36
|
-
} catch (
|
|
36
|
+
} catch (_e) {}
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
const depVersions = Object.keys(_depVersions).sort() // Sort the keys alphabetically
|
package/lib/utils/http-helper.js
CHANGED
|
@@ -47,7 +47,7 @@ const ping = async (url)=>{
|
|
|
47
47
|
return Promise.race([
|
|
48
48
|
(0, _nodefetch.default)(url, {
|
|
49
49
|
method: 'HEAD'
|
|
50
|
-
}).then(({ status
|
|
50
|
+
}).then(({ status })=>{
|
|
51
51
|
pingFinished = true;
|
|
52
52
|
if (status === 200) {
|
|
53
53
|
// console.log('ping success', url);
|
|
@@ -55,7 +55,7 @@ const ping = async (url)=>{
|
|
|
55
55
|
}
|
|
56
56
|
// console.log('ping failed', url, status, statusText);
|
|
57
57
|
throw new Error('ping failed');
|
|
58
|
-
}).catch((
|
|
58
|
+
}).catch((_e)=>{
|
|
59
59
|
pingFinished = true;
|
|
60
60
|
// console.log('ping error', url, e);
|
|
61
61
|
throw new Error('ping error');
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -17,6 +17,5 @@ export declare function getAabInfo(fn: string): Promise<{
|
|
|
17
17
|
versionName: string;
|
|
18
18
|
buildTime: number;
|
|
19
19
|
}>;
|
|
20
|
-
export declare function saveToLocal(originPath: string, destName: string): void;
|
|
21
20
|
export declare function printVersionCommand(): Promise<void>;
|
|
22
21
|
export { checkPlugins };
|
package/lib/utils/index.js
CHANGED
|
@@ -30,17 +30,12 @@ _export(exports, {
|
|
|
30
30
|
get question () {
|
|
31
31
|
return question;
|
|
32
32
|
},
|
|
33
|
-
get saveToLocal () {
|
|
34
|
-
return saveToLocal;
|
|
35
|
-
},
|
|
36
33
|
get translateOptions () {
|
|
37
34
|
return translateOptions;
|
|
38
35
|
}
|
|
39
36
|
});
|
|
40
37
|
const _chalk = /*#__PURE__*/ _interop_require_default(require("chalk"));
|
|
41
38
|
const _compareversions = require("compare-versions");
|
|
42
|
-
const _fsextra = /*#__PURE__*/ _interop_require_default(require("fs-extra"));
|
|
43
|
-
const _os = /*#__PURE__*/ _interop_require_default(require("os"));
|
|
44
39
|
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
45
40
|
const _read = require("read");
|
|
46
41
|
const _yauzl = require("yauzl");
|
|
@@ -336,14 +331,6 @@ async function resolveResource(fn, resourceId, root) {
|
|
|
336
331
|
}
|
|
337
332
|
return null;
|
|
338
333
|
}
|
|
339
|
-
const localDir = _path.default.resolve(_os.default.homedir(), _constants.tempDir);
|
|
340
|
-
_fsextra.default.ensureDirSync(localDir);
|
|
341
|
-
function saveToLocal(originPath, destName) {
|
|
342
|
-
// TODO
|
|
343
|
-
// const destPath = path.join(localDir, destName);
|
|
344
|
-
// fs.ensureDirSync(path.dirname(destPath));
|
|
345
|
-
// fs.copyFileSync(originPath, destPath);
|
|
346
|
-
}
|
|
347
334
|
async function getLatestVersion(pkgNames) {
|
|
348
335
|
return (0, _latestversion.default)(pkgNames, {
|
|
349
336
|
// useCache: true,
|
|
@@ -8,11 +8,47 @@ Object.defineProperty(exports, "plugins", {
|
|
|
8
8
|
return plugins;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _fsextra = /*#__PURE__*/
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const _fsextra = /*#__PURE__*/ _interop_require_wildcard(require("fs-extra"));
|
|
12
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
13
|
+
if (typeof WeakMap !== "function") return null;
|
|
14
|
+
var cacheBabelInterop = new WeakMap();
|
|
15
|
+
var cacheNodeInterop = new WeakMap();
|
|
16
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
17
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
18
|
+
})(nodeInterop);
|
|
19
|
+
}
|
|
20
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
21
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
22
|
+
return obj;
|
|
23
|
+
}
|
|
24
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
25
|
+
return {
|
|
26
|
+
default: obj
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
30
|
+
if (cache && cache.has(obj)) {
|
|
31
|
+
return cache.get(obj);
|
|
32
|
+
}
|
|
33
|
+
var newObj = {
|
|
34
|
+
__proto__: null
|
|
15
35
|
};
|
|
36
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
37
|
+
for(var key in obj){
|
|
38
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
39
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
40
|
+
if (desc && (desc.get || desc.set)) {
|
|
41
|
+
Object.defineProperty(newObj, key, desc);
|
|
42
|
+
} else {
|
|
43
|
+
newObj[key] = obj[key];
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
newObj.default = obj;
|
|
48
|
+
if (cache) {
|
|
49
|
+
cache.set(obj, newObj);
|
|
50
|
+
}
|
|
51
|
+
return newObj;
|
|
16
52
|
}
|
|
17
53
|
const plugins = [
|
|
18
54
|
{
|
|
@@ -23,11 +59,11 @@ const plugins = [
|
|
|
23
59
|
},
|
|
24
60
|
detect: async ()=>{
|
|
25
61
|
try {
|
|
26
|
-
await _fsextra.
|
|
62
|
+
await _fsextra.access('ios/sentry.properties');
|
|
27
63
|
return true;
|
|
28
64
|
} catch (unused) {
|
|
29
65
|
try {
|
|
30
|
-
await _fsextra.
|
|
66
|
+
await _fsextra.access('android/sentry.properties');
|
|
31
67
|
return true;
|
|
32
68
|
} catch (unused) {
|
|
33
69
|
return false;
|
package/lib/versions.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ interface VersionCommandOptions {
|
|
|
14
14
|
rollout?: string;
|
|
15
15
|
dryRun?: boolean;
|
|
16
16
|
versionDeps?: Record<string, string>;
|
|
17
|
+
warnDepsChanges?: boolean;
|
|
17
18
|
}
|
|
18
19
|
export declare const bindVersionToPackages: ({ appId, versionId, pkgs, rollout, dryRun, }: {
|
|
19
20
|
appId: string;
|
package/lib/versions.js
CHANGED
|
@@ -149,6 +149,7 @@ function printDepsChangesForPackage({ pkg, versionDeps }) {
|
|
|
149
149
|
renderVersionChange(change)
|
|
150
150
|
]);
|
|
151
151
|
console.log('');
|
|
152
|
+
console.log(_chalk.default.bgYellow.black.bold(` ${(0, _i18n.t)('depsChangeWarningTitle')} `));
|
|
152
153
|
console.log(_chalk.default.yellow((0, _i18n.t)('depsChangeTargetPackage', {
|
|
153
154
|
packageName: pkg.name,
|
|
154
155
|
packageId: pkg.id
|
|
@@ -177,7 +178,7 @@ async function findVersionDeps(appId, versionId) {
|
|
|
177
178
|
return undefined;
|
|
178
179
|
}
|
|
179
180
|
async function printDepsChangesForPublish({ appId, versionId, pkgs, providedVersionDeps }) {
|
|
180
|
-
if (!versionId || pkgs.length
|
|
181
|
+
if (!versionId || pkgs.length !== 1) {
|
|
181
182
|
return;
|
|
182
183
|
}
|
|
183
184
|
let versionDeps = normalizeDeps(providedVersionDeps);
|
|
@@ -207,7 +208,7 @@ async function printDepsChangesForPublish({ appId, versionId, pkgs, providedVers
|
|
|
207
208
|
}
|
|
208
209
|
}
|
|
209
210
|
async function showVersion(appId, offset) {
|
|
210
|
-
const { data
|
|
211
|
+
const { data } = await (0, _api.get)(`/app/${appId}/version/list`);
|
|
211
212
|
console.log((0, _i18n.t)('offset', {
|
|
212
213
|
offset
|
|
213
214
|
}));
|
|
@@ -305,10 +306,10 @@ const bindVersionToPackages = async ({ appId, versionId, pkgs, rollout, dryRun }
|
|
|
305
306
|
}));
|
|
306
307
|
};
|
|
307
308
|
const versionCommands = {
|
|
308
|
-
publish: async
|
|
309
|
+
publish: async ({ args, options })=>{
|
|
309
310
|
const fn = args[0];
|
|
310
311
|
const { name, description, metaInfo } = options;
|
|
311
|
-
if (!fn
|
|
312
|
+
if (!(fn == null ? void 0 : fn.endsWith('.ppk'))) {
|
|
312
313
|
throw new Error((0, _i18n.t)('publishUsage'));
|
|
313
314
|
}
|
|
314
315
|
const platform = await (0, _app.getPlatform)(options.platform);
|
|
@@ -323,14 +324,12 @@ const versionCommands = {
|
|
|
323
324
|
deps: _depversions.depVersions,
|
|
324
325
|
commit: await (0, _git.getCommitInfo)()
|
|
325
326
|
});
|
|
326
|
-
// TODO local diff
|
|
327
|
-
(0, _utils.saveToLocal)(fn, `${appId}/ppk/${id}.ppk`);
|
|
328
327
|
console.log((0, _i18n.t)('packageUploadSuccess', {
|
|
329
328
|
id
|
|
330
329
|
}));
|
|
331
330
|
const { packageId, packageVersion, packageVersionRange, minPackageVersion, maxPackageVersion, rollout, dryRun } = options;
|
|
332
331
|
if (packageId || packageVersion || packageVersionRange || minPackageVersion || maxPackageVersion) {
|
|
333
|
-
await
|
|
332
|
+
await versionCommands.update({
|
|
334
333
|
options: {
|
|
335
334
|
versionId: id,
|
|
336
335
|
platform,
|
|
@@ -341,17 +340,19 @@ const versionCommands = {
|
|
|
341
340
|
maxPackageVersion,
|
|
342
341
|
rollout,
|
|
343
342
|
dryRun,
|
|
344
|
-
versionDeps: _depversions.depVersions
|
|
343
|
+
versionDeps: _depversions.depVersions,
|
|
344
|
+
warnDepsChanges: true
|
|
345
345
|
}
|
|
346
346
|
});
|
|
347
347
|
} else {
|
|
348
348
|
const q = await (0, _utils.question)((0, _i18n.t)('updateNativePackageQuestion'));
|
|
349
349
|
if (q.toLowerCase() === 'y') {
|
|
350
|
-
await
|
|
350
|
+
await versionCommands.update({
|
|
351
351
|
options: {
|
|
352
352
|
versionId: id,
|
|
353
353
|
platform,
|
|
354
|
-
versionDeps: _depversions.depVersions
|
|
354
|
+
versionDeps: _depversions.depVersions,
|
|
355
|
+
warnDepsChanges: true
|
|
355
356
|
}
|
|
356
357
|
});
|
|
357
358
|
}
|
|
@@ -443,12 +444,14 @@ const versionCommands = {
|
|
|
443
444
|
}));
|
|
444
445
|
}
|
|
445
446
|
}
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
447
|
+
if (options.warnDepsChanges) {
|
|
448
|
+
await printDepsChangesForPublish({
|
|
449
|
+
appId: String(appId),
|
|
450
|
+
versionId: String(versionId),
|
|
451
|
+
pkgs: pkgsToBind,
|
|
452
|
+
providedVersionDeps: options.versionDeps
|
|
453
|
+
});
|
|
454
|
+
}
|
|
452
455
|
await bindVersionToPackages({
|
|
453
456
|
appId: String(appId),
|
|
454
457
|
versionId: String(versionId),
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-update-cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.0",
|
|
4
4
|
"description": "command line tool for react-native-update (remote updates for react native)",
|
|
5
5
|
"main": "lib/exports.js",
|
|
6
6
|
"types": "lib/exports.d.ts",
|
|
7
7
|
"bin": {
|
|
8
|
-
"pushy": "lib/
|
|
9
|
-
"cresc": "lib/
|
|
8
|
+
"pushy": "lib/bin.js",
|
|
9
|
+
"cresc": "lib/bin.js"
|
|
10
10
|
},
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
@@ -14,11 +14,6 @@
|
|
|
14
14
|
"require": "./lib/exports.js",
|
|
15
15
|
"default": "./lib/exports.js"
|
|
16
16
|
},
|
|
17
|
-
"./cli": {
|
|
18
|
-
"types": "./lib/index.d.ts",
|
|
19
|
-
"require": "./lib/index.js",
|
|
20
|
-
"default": "./lib/index.js"
|
|
21
|
-
},
|
|
22
17
|
"./diff": {
|
|
23
18
|
"types": "./lib/diff.d.ts",
|
|
24
19
|
"require": "./lib/diff.js",
|
|
@@ -37,8 +32,8 @@
|
|
|
37
32
|
"cli.json"
|
|
38
33
|
],
|
|
39
34
|
"scripts": {
|
|
40
|
-
"build": "rm -rf lib && swc src -d lib --strip-leading-paths && bun run typecheck:build",
|
|
41
|
-
"prepublishOnly": "bun run build
|
|
35
|
+
"build": "rm -rf lib && swc src -d lib --strip-leading-paths && bun run typecheck:build && chmod +x lib/bin.js",
|
|
36
|
+
"prepublishOnly": "bun run build",
|
|
42
37
|
"typecheck": "tsc --noEmit",
|
|
43
38
|
"typecheck:build": "tsc -p tsconfig.build.json",
|
|
44
39
|
"lint": "bun run typecheck && biome check .",
|
|
@@ -93,6 +88,9 @@
|
|
|
93
88
|
"yauzl": "^3.3.0",
|
|
94
89
|
"yazl": "3.3.1"
|
|
95
90
|
},
|
|
91
|
+
"overrides": {
|
|
92
|
+
"@xmldom/xmldom": "0.8.13"
|
|
93
|
+
},
|
|
96
94
|
"engines": {
|
|
97
95
|
"node": ">= 16.6.0"
|
|
98
96
|
},
|
package/src/api.ts
CHANGED
|
@@ -98,7 +98,7 @@ async function query(url: string, options: fetch.RequestInit) {
|
|
|
98
98
|
let json: any;
|
|
99
99
|
try {
|
|
100
100
|
json = JSON.parse(text);
|
|
101
|
-
} catch (
|
|
101
|
+
} catch (_e) {
|
|
102
102
|
if (resp.status === 200 && text) {
|
|
103
103
|
console.warn(
|
|
104
104
|
`Warning: API returned 200 with non-JSON body (${text.length} bytes)`,
|