react-native-update-cli 2.8.5 → 2.9.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/lib/api.d.ts +18 -0
- package/lib/app.d.ts +38 -0
- package/lib/app.js +5 -4
- package/lib/bundle-pack.d.ts +1 -0
- package/lib/bundle-pack.js +104 -0
- package/lib/bundle-runner.d.ts +20 -0
- package/lib/bundle-runner.js +404 -0
- package/lib/bundle.d.ts +6 -0
- package/lib/bundle.js +73 -471
- package/lib/diff.d.ts +13 -0
- package/lib/diff.js +144 -123
- package/lib/exports.d.ts +12 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.js +5 -13
- package/lib/install.d.ts +4 -0
- package/lib/locales/en.d.ts +137 -0
- package/lib/locales/zh.d.ts +136 -0
- package/lib/module-manager.d.ts +20 -0
- package/lib/module-manager.js +3 -9
- package/lib/modules/app-module.d.ts +2 -0
- package/lib/modules/app-module.js +84 -44
- package/lib/modules/bundle-module.d.ts +2 -0
- package/lib/modules/bundle-module.js +7 -8
- package/lib/modules/index.d.ts +6 -0
- package/lib/modules/package-module.d.ts +2 -0
- package/lib/modules/user-module.d.ts +2 -0
- package/lib/modules/user-module.js +55 -44
- package/lib/modules/version-module.d.ts +2 -0
- package/lib/package.d.ts +59 -0
- package/lib/package.js +110 -139
- package/lib/provider.d.ts +26 -0
- package/lib/provider.js +115 -217
- package/lib/types.d.ts +120 -0
- package/lib/user.d.ts +8 -0
- package/lib/utils/add-gitignore.d.ts +1 -0
- package/lib/utils/app-info-parser/aab.d.ts +22 -0
- package/lib/utils/app-info-parser/aab.js +0 -4
- package/lib/utils/app-info-parser/apk.d.ts +14 -0
- package/lib/utils/app-info-parser/apk.js +6 -4
- package/lib/utils/app-info-parser/app.d.ts +4 -0
- package/lib/utils/app-info-parser/app.js +3 -0
- package/lib/utils/app-info-parser/index.d.ts +16 -0
- package/lib/utils/app-info-parser/index.js +2 -0
- package/lib/utils/app-info-parser/ipa.d.ts +14 -0
- package/lib/utils/app-info-parser/ipa.js +1 -1
- package/lib/utils/app-info-parser/resource-finder.d.ts +49 -0
- package/lib/utils/app-info-parser/utils.d.ts +31 -0
- package/lib/utils/app-info-parser/utils.js +1 -0
- package/lib/utils/app-info-parser/xml-parser/binary.d.ts +56 -0
- package/lib/utils/app-info-parser/xml-parser/manifest.d.ts +10 -0
- package/lib/utils/app-info-parser/zip.d.ts +18 -0
- package/lib/utils/app-info-parser/zip.js +7 -9
- package/lib/utils/check-lockfile.d.ts +1 -0
- package/lib/utils/check-plugin.d.ts +7 -0
- package/lib/utils/command-result.d.ts +3 -0
- package/lib/utils/command-result.js +35 -0
- package/lib/utils/constants.d.ts +9 -0
- package/lib/utils/dep-versions.d.ts +1 -0
- package/lib/utils/git.d.ts +8 -0
- package/lib/utils/http-helper.d.ts +4 -0
- package/lib/utils/i18n.d.ts +12 -0
- package/lib/utils/index.d.ts +22 -0
- package/lib/utils/index.js +52 -22
- package/lib/utils/latest-version/cli.d.ts +1 -0
- package/lib/utils/latest-version/cli.js +24 -60
- package/lib/utils/latest-version/index.d.ts +146 -0
- package/lib/utils/latest-version/index.js +22 -22
- package/lib/utils/options.d.ts +4 -0
- package/lib/utils/options.js +63 -0
- package/lib/utils/plugin-config.d.ts +9 -0
- package/lib/utils/zip-entries.d.ts +3 -0
- package/lib/versions.d.ts +43 -0
- package/lib/workflow-runner.d.ts +2 -0
- package/lib/workflow-runner.js +25 -0
- package/package.json +20 -5
- package/src/api.ts +1 -1
- package/src/app.ts +20 -11
- package/src/bundle-pack.ts +51 -0
- package/src/bundle-runner.ts +463 -0
- package/src/bundle.ts +184 -571
- package/src/diff.ts +208 -174
- package/src/index.ts +15 -17
- package/src/module-manager.ts +15 -15
- package/src/modules/app-module.ts +120 -48
- package/src/modules/bundle-module.ts +21 -11
- package/src/modules/package-module.ts +0 -1
- package/src/modules/user-module.ts +117 -58
- package/src/package.ts +163 -138
- package/src/provider.ts +164 -240
- package/src/types.ts +13 -8
- package/src/utils/app-info-parser/aab.ts +0 -7
- package/src/utils/app-info-parser/apk.ts +9 -6
- package/src/utils/app-info-parser/app.ts +5 -1
- package/src/utils/app-info-parser/index.ts +11 -6
- package/src/utils/app-info-parser/ipa.ts +1 -1
- package/src/utils/app-info-parser/utils.ts +3 -0
- package/src/utils/app-info-parser/xml-parser/manifest.ts +3 -1
- package/src/utils/app-info-parser/zip.ts +12 -14
- package/src/utils/command-result.ts +24 -0
- package/src/utils/index.ts +138 -39
- package/src/utils/latest-version/cli.ts +22 -20
- package/src/utils/latest-version/index.ts +20 -20
- package/src/utils/options.ts +56 -0
- package/src/utils/zip-entries.ts +1 -1
- package/src/workflow-runner.ts +24 -0
- package/index.js +0 -1
|
@@ -13,47 +13,6 @@ function _interop_require_default(obj) {
|
|
|
13
13
|
default: obj
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
-
function _getRequireWildcardCache(nodeInterop) {
|
|
17
|
-
if (typeof WeakMap !== "function") return null;
|
|
18
|
-
var cacheBabelInterop = new WeakMap();
|
|
19
|
-
var cacheNodeInterop = new WeakMap();
|
|
20
|
-
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
21
|
-
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
22
|
-
})(nodeInterop);
|
|
23
|
-
}
|
|
24
|
-
function _interop_require_wildcard(obj, nodeInterop) {
|
|
25
|
-
if (!nodeInterop && obj && obj.__esModule) {
|
|
26
|
-
return obj;
|
|
27
|
-
}
|
|
28
|
-
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
29
|
-
return {
|
|
30
|
-
default: obj
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
var cache = _getRequireWildcardCache(nodeInterop);
|
|
34
|
-
if (cache && cache.has(obj)) {
|
|
35
|
-
return cache.get(obj);
|
|
36
|
-
}
|
|
37
|
-
var newObj = {
|
|
38
|
-
__proto__: null
|
|
39
|
-
};
|
|
40
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
41
|
-
for(var key in obj){
|
|
42
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
43
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
44
|
-
if (desc && (desc.get || desc.set)) {
|
|
45
|
-
Object.defineProperty(newObj, key, desc);
|
|
46
|
-
} else {
|
|
47
|
-
newObj[key] = obj[key];
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
newObj.default = obj;
|
|
52
|
-
if (cache) {
|
|
53
|
-
cache.set(obj, newObj);
|
|
54
|
-
}
|
|
55
|
-
return newObj;
|
|
56
|
-
}
|
|
57
16
|
const colorizeDiff = (from, to)=>{
|
|
58
17
|
const toParts = to.split('.');
|
|
59
18
|
const diffIndex = from.split('.').findIndex((part, i)=>part !== toParts[i]);
|
|
@@ -105,11 +64,11 @@ const columnHeaderRenderer = (column)=>{
|
|
|
105
64
|
const drawBox = (lines, color = _safe.yellow, horizontalPadding = 3)=>{
|
|
106
65
|
const maxLineWidth = lines.reduce((max, row)=>Math.max(max, (0, _safe.strip)(row).length), 0);
|
|
107
66
|
console.log(color(`┌${'─'.repeat(maxLineWidth + horizontalPadding * 2)}┐`));
|
|
108
|
-
|
|
67
|
+
for (const row of lines){
|
|
109
68
|
const padding = ' '.repeat(horizontalPadding);
|
|
110
69
|
const fullRow = `${row}${' '.repeat(maxLineWidth - (0, _safe.strip)(row).length)}`;
|
|
111
70
|
console.log(`${color('│')}${padding}${(0, _safe.reset)(fullRow)}${padding}${color('│')}`);
|
|
112
|
-
}
|
|
71
|
+
}
|
|
113
72
|
console.log(color(`└${'─'.repeat(maxLineWidth + horizontalPadding * 2)}┘`));
|
|
114
73
|
};
|
|
115
74
|
const getTableColumns = (rows)=>{
|
|
@@ -171,11 +130,11 @@ const getTableColumns = (rows)=>{
|
|
|
171
130
|
items: []
|
|
172
131
|
}
|
|
173
132
|
];
|
|
174
|
-
|
|
175
|
-
|
|
133
|
+
for (const row of rows){
|
|
134
|
+
for (const column of columns){
|
|
176
135
|
column.maxLength = Math.max(column.label.length, column.maxLength, row[column.attrName].length || 0);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
179
138
|
return columns;
|
|
180
139
|
};
|
|
181
140
|
const getTableRows = (updates)=>{
|
|
@@ -184,7 +143,8 @@ const getTableRows = (updates)=>{
|
|
|
184
143
|
const getGroup = (a, b)=>{
|
|
185
144
|
if (b && (0, _major.default)(b) === 0) {
|
|
186
145
|
return 'majorVersionZero';
|
|
187
|
-
}
|
|
146
|
+
}
|
|
147
|
+
if (a && b) {
|
|
188
148
|
var _semverDiff;
|
|
189
149
|
const releaseType = (_semverDiff = (0, _diff.default)(a, b)) != null ? _semverDiff : '';
|
|
190
150
|
if ([
|
|
@@ -193,12 +153,14 @@ const getTableRows = (updates)=>{
|
|
|
193
153
|
'prerelease'
|
|
194
154
|
].includes(releaseType)) {
|
|
195
155
|
return 'major';
|
|
196
|
-
}
|
|
156
|
+
}
|
|
157
|
+
if ([
|
|
197
158
|
'minor',
|
|
198
159
|
'preminor'
|
|
199
160
|
].includes(releaseType)) {
|
|
200
161
|
return 'minor';
|
|
201
|
-
}
|
|
162
|
+
}
|
|
163
|
+
if ([
|
|
202
164
|
'patch',
|
|
203
165
|
'prepatch'
|
|
204
166
|
].includes(releaseType)) {
|
|
@@ -208,7 +170,7 @@ const getTableRows = (updates)=>{
|
|
|
208
170
|
return 'unknown';
|
|
209
171
|
};
|
|
210
172
|
const add = (group, location, installed, wanted)=>all.push({
|
|
211
|
-
name:
|
|
173
|
+
name: ` ${name}`,
|
|
212
174
|
location,
|
|
213
175
|
installed: installed != null ? installed : 'unknown',
|
|
214
176
|
latest: latest != null ? latest : 'unknown',
|
|
@@ -279,21 +241,23 @@ const displayTable = (latestVersionPackages)=>{
|
|
|
279
241
|
const checkVersions = async (packages, skipMissing, options = {
|
|
280
242
|
useCache: true
|
|
281
243
|
})=>{
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
244
|
+
console.log((0, _safe.cyan)('Checking versions...'));
|
|
245
|
+
let latestVersionPackages;
|
|
246
|
+
if (typeof packages === 'string') {
|
|
247
|
+
latestVersionPackages = [
|
|
248
|
+
await (0, _.default)(packages, options)
|
|
249
|
+
];
|
|
250
|
+
} else if (Array.isArray(packages)) {
|
|
251
|
+
latestVersionPackages = await (0, _.default)(packages, options);
|
|
252
|
+
} else {
|
|
253
|
+
latestVersionPackages = await (0, _.default)(packages, options);
|
|
254
|
+
}
|
|
290
255
|
if (skipMissing) {
|
|
291
256
|
latestVersionPackages = latestVersionPackages.filter((pkg)=>{
|
|
292
257
|
var _pkg_local, _ref;
|
|
293
258
|
return (_ref = (_pkg_local = pkg.local) != null ? _pkg_local : pkg.globalNpm) != null ? _ref : pkg.globalYarn;
|
|
294
259
|
});
|
|
295
260
|
}
|
|
296
|
-
spinner.stop();
|
|
297
261
|
displayTable(latestVersionPackages);
|
|
298
262
|
};
|
|
299
263
|
void (async ()=>{
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import type { Agent } from 'http';
|
|
2
|
+
interface RegistryVersions {
|
|
3
|
+
/**
|
|
4
|
+
* The latest version of the package found on the registry (if found).
|
|
5
|
+
*/
|
|
6
|
+
latest?: string;
|
|
7
|
+
/**
|
|
8
|
+
* The next version of the package found on the registry (if found).
|
|
9
|
+
*/
|
|
10
|
+
next?: string;
|
|
11
|
+
/**
|
|
12
|
+
* The latest version of the package found on the registry and satisfied by the wanted tag or version range.
|
|
13
|
+
*/
|
|
14
|
+
wanted?: string;
|
|
15
|
+
}
|
|
16
|
+
interface InstalledVersions {
|
|
17
|
+
/**
|
|
18
|
+
* The current local installed version of the package (if installed).
|
|
19
|
+
*/
|
|
20
|
+
local?: string;
|
|
21
|
+
/**
|
|
22
|
+
* The current npm global installed version of the package (if installed).
|
|
23
|
+
*/
|
|
24
|
+
globalNpm?: string;
|
|
25
|
+
/**
|
|
26
|
+
* The current yarn global installed version of the package (if installed).
|
|
27
|
+
*/
|
|
28
|
+
globalYarn?: string;
|
|
29
|
+
}
|
|
30
|
+
interface LatestVersionPackage extends InstalledVersions, RegistryVersions {
|
|
31
|
+
/**
|
|
32
|
+
* The name of the package.
|
|
33
|
+
*/
|
|
34
|
+
name: string;
|
|
35
|
+
/**
|
|
36
|
+
* The tag or version range that was provided (if provided).
|
|
37
|
+
* @default "latest"
|
|
38
|
+
*/
|
|
39
|
+
wantedTagOrRange?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Whether the local or global installed versions (if any) could be upgraded or not, based on the wanted version.
|
|
42
|
+
*/
|
|
43
|
+
updatesAvailable: {
|
|
44
|
+
local: string | false;
|
|
45
|
+
globalNpm: string | false;
|
|
46
|
+
globalYarn: string | false;
|
|
47
|
+
} | false;
|
|
48
|
+
/**
|
|
49
|
+
* Any error that might have occurred during the process.
|
|
50
|
+
*/
|
|
51
|
+
error?: Error;
|
|
52
|
+
}
|
|
53
|
+
interface RequestOptions {
|
|
54
|
+
readonly ca?: string | Buffer | Array<string | Buffer>;
|
|
55
|
+
readonly rejectUnauthorized?: boolean;
|
|
56
|
+
readonly agent?: Agent | boolean;
|
|
57
|
+
readonly timeout?: number;
|
|
58
|
+
}
|
|
59
|
+
interface LatestVersionOptions {
|
|
60
|
+
/**
|
|
61
|
+
* Awaiting the api to return might take time, depending on the network, and might impact your package loading performance.
|
|
62
|
+
* You can use the cache mechanism to improve load performance and reduce unnecessary network requests.
|
|
63
|
+
* If `useCache` is not supplied, the api will always check for updates and wait for every requests to return before returning itself.
|
|
64
|
+
* If `useCache` is used, the api will always returned immediately, with either (for each provided packages):
|
|
65
|
+
* 1) a latest/next version available if a cache was found
|
|
66
|
+
* 2) no latest/next version available if no cache was found - in such case updates will be fetched in the background and a cache will
|
|
67
|
+
* be created for each provided packages and made available for the next call to the api.
|
|
68
|
+
* @default false
|
|
69
|
+
*/
|
|
70
|
+
readonly useCache?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* How long the cache for the provided packages should be used before being refreshed (in milliseconds).
|
|
73
|
+
* If `useCache` is not supplied, this option has no effect.
|
|
74
|
+
* If `0` is used, this will force the cache to refresh immediately:
|
|
75
|
+
* 1) The api will returned immediately (without any latest nor next version available for the provided packages)
|
|
76
|
+
* 2) New updates will be fetched in the background
|
|
77
|
+
* 3) The cache for each provided packages will be refreshed and made available for the next call to the api
|
|
78
|
+
* @default ONE_DAY
|
|
79
|
+
*/
|
|
80
|
+
readonly cacheMaxAge?: number;
|
|
81
|
+
/**
|
|
82
|
+
* A JavaScript package registry url that implements the CommonJS Package Registry specification.
|
|
83
|
+
* @default "Looks at any registry urls in the .npmrc file or fallback to the default npm registry instead"
|
|
84
|
+
* @example <caption>.npmrc</caption>
|
|
85
|
+
* registry = 'https://custom-registry.com/'
|
|
86
|
+
* @pkgscope:registry = 'https://custom-registry.com/'
|
|
87
|
+
*/
|
|
88
|
+
readonly registryUrl?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Set of options to be passed down to Node.js http/https request.
|
|
91
|
+
* @example <caption>Behind a proxy with self-signed certificate</caption>
|
|
92
|
+
* { ca: [ fs.readFileSync('proxy-cert.pem') ] }
|
|
93
|
+
* @example <caption>Bypassing certificate validation</caption>
|
|
94
|
+
* { rejectUnauthorized: false }
|
|
95
|
+
*/
|
|
96
|
+
readonly requestOptions?: RequestOptions;
|
|
97
|
+
}
|
|
98
|
+
interface LatestVersion {
|
|
99
|
+
/**
|
|
100
|
+
* Get latest versions of packages from of a package json like object.
|
|
101
|
+
* @param {PackageJson} item - A package json like object (with dependencies, devDependencies and peerDependencies attributes).
|
|
102
|
+
* @example { dependencies: { 'npm': 'latest' }, devDependencies: { 'npm': '1.3.2' }, peerDependencies: { '@scope/name': '^5.0.2' } }
|
|
103
|
+
* @param {LatestVersionOptions} [options] - An object optionally specifying the use of the cache, the max age of the cache, the registry url and the http or https options.
|
|
104
|
+
* If `useCache` is not supplied, the default of `false` is used.
|
|
105
|
+
* If `cacheMaxAge` is not supplied, the default of `one day` is used.
|
|
106
|
+
* If `registryUrl` is not supplied, the default from `.npmrc` is used or a fallback to the `npm registry url` instead.
|
|
107
|
+
* @returns {Promise<LatestVersionPackage[]>}
|
|
108
|
+
*/
|
|
109
|
+
(item: PackageJson, options?: LatestVersionOptions): Promise<LatestVersionPackage[]>;
|
|
110
|
+
/**
|
|
111
|
+
* Get latest version of a single package.
|
|
112
|
+
* @param {Package} item - A single package object (represented by a string that should match the following format: `${'@' | ''}${string}@${string}`)
|
|
113
|
+
* @example 'npm', 'npm@1.3.2', '@scope/name@^5.0.2'
|
|
114
|
+
* @param {LatestVersionOptions} [options] - An object optionally specifying the use of the cache, the max age of the cache, the registry url and the http or https options.
|
|
115
|
+
* If `useCache` is not supplied, the default of `false` is used.
|
|
116
|
+
* If `cacheMaxAge` is not supplied, the default of `one day` is used.
|
|
117
|
+
* If `registryUrl` is not supplied, the default from `.npmrc` is used or a fallback to the npm registry url instead.
|
|
118
|
+
* @returns {Promise<LatestVersionPackage>}
|
|
119
|
+
*/
|
|
120
|
+
(item: Package, options?: LatestVersionOptions): Promise<LatestVersionPackage>;
|
|
121
|
+
/**
|
|
122
|
+
* Get latest versions of a collection of packages.
|
|
123
|
+
* @param {Package[]} items - A collection of package object (represented by a string that should match the following format: `${'@' | ''}${string}@${string}`)
|
|
124
|
+
* @example ['npm', 'npm@1.3.2', '@scope/name@^5.0.2']
|
|
125
|
+
* @param {LatestVersionOptions} [options] - An object optionally specifying the use of the cache, the max age of the cache, the registry url and the http or https options.
|
|
126
|
+
* If `useCache` is not supplied, the default of `false` is used.
|
|
127
|
+
* If `cacheMaxAge` is not supplied, the default of `one day` is used.
|
|
128
|
+
* If `registryUrl` is not supplied, the default from `.npmrc` is used or a fallback to the npm registry url instead.
|
|
129
|
+
* @returns {Promise<LatestVersionPackage[]>}
|
|
130
|
+
*/
|
|
131
|
+
(items: Package[], options?: LatestVersionOptions): Promise<LatestVersionPackage[]>;
|
|
132
|
+
}
|
|
133
|
+
type PackageRange = `${'@' | ''}${string}@${string}`;
|
|
134
|
+
type Package = PackageRange | string;
|
|
135
|
+
type PackageJsonDependencies = Record<string, string>;
|
|
136
|
+
type PackageJson = Record<string, any> & ({
|
|
137
|
+
dependencies: PackageJsonDependencies;
|
|
138
|
+
} | {
|
|
139
|
+
devDependencies: PackageJsonDependencies;
|
|
140
|
+
} | {
|
|
141
|
+
peerDependencies: PackageJsonDependencies;
|
|
142
|
+
});
|
|
143
|
+
export declare const ONE_DAY: number;
|
|
144
|
+
declare const latestVersion: LatestVersion;
|
|
145
|
+
export type { LatestVersion, Package, PackageRange, PackageJson, PackageJsonDependencies, RegistryVersions, LatestVersionPackage, RequestOptions, LatestVersionOptions, };
|
|
146
|
+
export default latestVersion;
|
|
@@ -173,7 +173,8 @@ const getInstalledVersion = (pkgName, location = 'local')=>{
|
|
|
173
173
|
if (location === 'globalNpm') {
|
|
174
174
|
var _require;
|
|
175
175
|
return (_require = require((0, _path.join)(_globaldirs.npm.packages, pkgName, 'package.json'))) == null ? void 0 : _require.version;
|
|
176
|
-
}
|
|
176
|
+
}
|
|
177
|
+
if (location === 'globalYarn') {
|
|
177
178
|
var _yarnGlobalPkg_dependencies, _require1;
|
|
178
179
|
// Make sure package is globally installed by Yarn
|
|
179
180
|
const yarnGlobalPkg = require((0, _path.resolve)(_globaldirs.yarn.packages, '..', 'package.json'));
|
|
@@ -181,27 +182,26 @@ const getInstalledVersion = (pkgName, location = 'local')=>{
|
|
|
181
182
|
return undefined;
|
|
182
183
|
}
|
|
183
184
|
return (_require1 = require((0, _path.join)(_globaldirs.yarn.packages, pkgName, 'package.json'))) == null ? void 0 : _require1.version;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Compute the local paths manually as require.resolve() and require.resolve.paths()
|
|
188
|
+
* cannot be trusted anymore.
|
|
189
|
+
* @see https://github.com/nodejs/node/issues/33460
|
|
190
|
+
* @see https://github.com/nodejs/loaders/issues/26
|
|
191
|
+
*/ const { root } = (0, _path.parse)(process.cwd());
|
|
192
|
+
let path = process.cwd();
|
|
193
|
+
const localPaths = [
|
|
194
|
+
(0, _path.join)(path, 'node_modules')
|
|
195
|
+
];
|
|
196
|
+
while(path !== root){
|
|
197
|
+
path = (0, _path.dirname)(path);
|
|
198
|
+
localPaths.push((0, _path.join)(path, 'node_modules'));
|
|
199
|
+
}
|
|
200
|
+
for (const localPath of localPaths){
|
|
201
|
+
const pkgPath = (0, _path.join)(localPath, pkgName, 'package.json');
|
|
202
|
+
if ((0, _fs.existsSync)(pkgPath)) {
|
|
203
|
+
var _require2;
|
|
204
|
+
return (_require2 = require(pkgPath)) == null ? void 0 : _require2.version;
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
return undefined;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function getBooleanOption(options: Record<string, unknown>, key: string, fallback?: boolean): boolean;
|
|
2
|
+
export declare function getStringOption(options: Record<string, unknown>, key: string, fallback?: string): string;
|
|
3
|
+
export declare function getOptionalStringOption(options: Record<string, unknown>, key: string): string | undefined;
|
|
4
|
+
export declare function toObjectState<T extends Record<string, unknown>>(value: unknown, fallback: T): T;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
getBooleanOption: function() {
|
|
13
|
+
return getBooleanOption;
|
|
14
|
+
},
|
|
15
|
+
getOptionalStringOption: function() {
|
|
16
|
+
return getOptionalStringOption;
|
|
17
|
+
},
|
|
18
|
+
getStringOption: function() {
|
|
19
|
+
return getStringOption;
|
|
20
|
+
},
|
|
21
|
+
toObjectState: function() {
|
|
22
|
+
return toObjectState;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
function getBooleanOption(options, key, fallback = false) {
|
|
26
|
+
const value = options[key];
|
|
27
|
+
if (typeof value === 'boolean') {
|
|
28
|
+
return value;
|
|
29
|
+
}
|
|
30
|
+
if (typeof value === 'string') {
|
|
31
|
+
return value.toLowerCase() === 'true';
|
|
32
|
+
}
|
|
33
|
+
if (typeof value === 'number') {
|
|
34
|
+
return value !== 0;
|
|
35
|
+
}
|
|
36
|
+
return fallback;
|
|
37
|
+
}
|
|
38
|
+
function getStringOption(options, key, fallback = '') {
|
|
39
|
+
const value = options[key];
|
|
40
|
+
if (typeof value === 'string') {
|
|
41
|
+
return value;
|
|
42
|
+
}
|
|
43
|
+
if (typeof value === 'number' || typeof value === 'boolean') {
|
|
44
|
+
return String(value);
|
|
45
|
+
}
|
|
46
|
+
return fallback;
|
|
47
|
+
}
|
|
48
|
+
function getOptionalStringOption(options, key) {
|
|
49
|
+
const value = options[key];
|
|
50
|
+
if (typeof value === 'string') {
|
|
51
|
+
return value || undefined;
|
|
52
|
+
}
|
|
53
|
+
if (typeof value === 'number' || typeof value === 'boolean') {
|
|
54
|
+
return String(value);
|
|
55
|
+
}
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
function toObjectState(value, fallback) {
|
|
59
|
+
if (value && typeof value === 'object') {
|
|
60
|
+
return value;
|
|
61
|
+
}
|
|
62
|
+
return fallback;
|
|
63
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type Entry, type ZipFile as YauzlZipFile } from 'yauzl';
|
|
2
|
+
export declare function readEntry(entry: Entry, zipFile: YauzlZipFile): Promise<Buffer>;
|
|
3
|
+
export declare function enumZipEntries(zipFn: string, callback: (entry: Entry, zipFile: YauzlZipFile, nestedPath?: string) => Promise<any> | undefined, nestedPath?: string): Promise<unknown>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Package, Platform } from './types';
|
|
2
|
+
interface VersionCommandOptions {
|
|
3
|
+
appId?: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
metaInfo?: string;
|
|
7
|
+
platform?: Platform;
|
|
8
|
+
versionId?: string;
|
|
9
|
+
packageId?: string;
|
|
10
|
+
packageVersion?: string;
|
|
11
|
+
minPackageVersion?: string;
|
|
12
|
+
maxPackageVersion?: string;
|
|
13
|
+
packageVersionRange?: string;
|
|
14
|
+
rollout?: string;
|
|
15
|
+
dryRun?: boolean;
|
|
16
|
+
versionDeps?: Record<string, string>;
|
|
17
|
+
}
|
|
18
|
+
export declare const bindVersionToPackages: ({ appId, versionId, pkgs, rollout, dryRun, }: {
|
|
19
|
+
appId: string;
|
|
20
|
+
versionId: string;
|
|
21
|
+
pkgs: Package[];
|
|
22
|
+
rollout?: number;
|
|
23
|
+
dryRun?: boolean;
|
|
24
|
+
}) => Promise<void>;
|
|
25
|
+
export declare const versionCommands: {
|
|
26
|
+
publish: ({ args, options, }: {
|
|
27
|
+
args: string[];
|
|
28
|
+
options: VersionCommandOptions;
|
|
29
|
+
}) => Promise<string>;
|
|
30
|
+
versions: ({ options }: {
|
|
31
|
+
options: VersionCommandOptions;
|
|
32
|
+
}) => Promise<void>;
|
|
33
|
+
update: ({ options }: {
|
|
34
|
+
options: VersionCommandOptions;
|
|
35
|
+
}) => Promise<void>;
|
|
36
|
+
updateVersionInfo: ({ options, }: {
|
|
37
|
+
options: VersionCommandOptions;
|
|
38
|
+
}) => Promise<void>;
|
|
39
|
+
deleteVersion: ({ options, }: {
|
|
40
|
+
options: VersionCommandOptions;
|
|
41
|
+
}) => Promise<void>;
|
|
42
|
+
};
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "runWorkflow", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return runWorkflow;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
async function runWorkflow(workflowName, workflow, context) {
|
|
12
|
+
if (workflow.validate && !workflow.validate(context)) {
|
|
13
|
+
throw new Error(`Workflow '${workflowName}' validation failed`);
|
|
14
|
+
}
|
|
15
|
+
let previousResult;
|
|
16
|
+
for (const step of workflow.steps){
|
|
17
|
+
if (step.condition && !step.condition(context)) {
|
|
18
|
+
console.log(`Skipping step '${step.name}' due to condition`);
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
console.log(`Executing step '${step.name}'`);
|
|
22
|
+
previousResult = await step.execute(context, previousResult);
|
|
23
|
+
}
|
|
24
|
+
return previousResult;
|
|
25
|
+
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-update-cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.1",
|
|
4
4
|
"description": "command line tool for react-native-update (remote updates for react native)",
|
|
5
|
-
"main": "
|
|
5
|
+
"main": "lib/exports.js",
|
|
6
|
+
"types": "lib/exports.d.ts",
|
|
6
7
|
"bin": {
|
|
7
8
|
"pushy": "lib/index.js",
|
|
8
9
|
"cresc": "lib/index.js"
|
|
9
10
|
},
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./lib/exports.d.ts",
|
|
14
|
+
"require": "./lib/exports.js",
|
|
15
|
+
"default": "./lib/exports.js"
|
|
16
|
+
},
|
|
17
|
+
"./cli": {
|
|
18
|
+
"types": "./lib/index.d.ts",
|
|
19
|
+
"require": "./lib/index.js",
|
|
20
|
+
"default": "./lib/index.js"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
10
23
|
"files": [
|
|
11
24
|
"lib",
|
|
12
25
|
"src",
|
|
@@ -14,9 +27,11 @@
|
|
|
14
27
|
"cli.json"
|
|
15
28
|
],
|
|
16
29
|
"scripts": {
|
|
17
|
-
"build": "swc src -d lib --strip-leading-paths",
|
|
18
|
-
"prepublishOnly": "bun scripts/prepublish.
|
|
19
|
-
"lint": "tsc --noEmit
|
|
30
|
+
"build": "rm -rf lib && swc src -d lib --strip-leading-paths && tsc -p tsconfig.build.json",
|
|
31
|
+
"prepublishOnly": "bun scripts/prepublish.ts && bun run build && chmod +x lib/index.js",
|
|
32
|
+
"lint": "tsc --noEmit && biome check --write .",
|
|
33
|
+
"test": "bun test",
|
|
34
|
+
"test:coverage": "bun test --coverage --coverage-reporter=text --coverage-reporter=lcov"
|
|
20
35
|
},
|
|
21
36
|
"repository": {
|
|
22
37
|
"type": "git",
|
package/src/api.ts
CHANGED
|
@@ -9,7 +9,7 @@ import tcpp from 'tcp-ping';
|
|
|
9
9
|
import { getBaseUrl } from 'utils/http-helper';
|
|
10
10
|
import packageJson from '../package.json';
|
|
11
11
|
import type { Package, Session } from './types';
|
|
12
|
-
import { credentialFile, pricingPageUrl
|
|
12
|
+
import { IS_CRESC, credentialFile, pricingPageUrl } from './utils/constants';
|
|
13
13
|
import { t } from './utils/i18n';
|
|
14
14
|
|
|
15
15
|
const tcpPing = util.promisify(tcpp.ping);
|
package/src/app.ts
CHANGED
|
@@ -6,7 +6,13 @@ import { doDelete, get, post } from './api';
|
|
|
6
6
|
import type { Platform } from './types';
|
|
7
7
|
import { t } from './utils/i18n';
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
interface AppSummary {
|
|
10
|
+
id: number;
|
|
11
|
+
name: string;
|
|
12
|
+
platform: Platform;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const validPlatforms = ['ios', 'android', 'harmony'] as const;
|
|
10
16
|
|
|
11
17
|
export async function getPlatform(platform?: string) {
|
|
12
18
|
return assertPlatform(
|
|
@@ -14,11 +20,11 @@ export async function getPlatform(platform?: string) {
|
|
|
14
20
|
) as Platform;
|
|
15
21
|
}
|
|
16
22
|
|
|
17
|
-
export function assertPlatform(platform: string) {
|
|
18
|
-
if (!validPlatforms.includes(platform)) {
|
|
23
|
+
export function assertPlatform(platform: string): Platform {
|
|
24
|
+
if (!validPlatforms.includes(platform as Platform)) {
|
|
19
25
|
throw new Error(t('unsupportedPlatform', { platform }));
|
|
20
26
|
}
|
|
21
|
-
return platform;
|
|
27
|
+
return platform as Platform;
|
|
22
28
|
}
|
|
23
29
|
|
|
24
30
|
export function getSelectedApp(platform: Platform) {
|
|
@@ -36,7 +42,10 @@ export function getSelectedApp(platform: Platform) {
|
|
|
36
42
|
|
|
37
43
|
export async function listApp(platform: Platform | '' = '') {
|
|
38
44
|
const { data } = await get('/app/list');
|
|
39
|
-
const
|
|
45
|
+
const allApps = data as AppSummary[];
|
|
46
|
+
const list = platform
|
|
47
|
+
? allApps.filter((app: AppSummary) => app.platform === platform)
|
|
48
|
+
: allApps;
|
|
40
49
|
|
|
41
50
|
const header = [
|
|
42
51
|
{ value: t('appId') },
|
|
@@ -59,7 +68,7 @@ export async function chooseApp(platform: Platform) {
|
|
|
59
68
|
|
|
60
69
|
while (true) {
|
|
61
70
|
const id = await question(t('enterAppIdQuestion'));
|
|
62
|
-
const app = list.find((
|
|
71
|
+
const app = list.find((item: AppSummary) => item.id === Number(id));
|
|
63
72
|
if (app) {
|
|
64
73
|
return app;
|
|
65
74
|
}
|
|
@@ -70,7 +79,7 @@ export const appCommands = {
|
|
|
70
79
|
createApp: async function ({
|
|
71
80
|
options,
|
|
72
81
|
}: {
|
|
73
|
-
options: { name: string; downloadUrl: string; platform
|
|
82
|
+
options: { name: string; downloadUrl: string; platform?: Platform | '' };
|
|
74
83
|
}) {
|
|
75
84
|
const name = options.name || (await question(t('appNameQuestion')));
|
|
76
85
|
const { downloadUrl } = options;
|
|
@@ -97,16 +106,16 @@ export const appCommands = {
|
|
|
97
106
|
await doDelete(`/app/${id}`);
|
|
98
107
|
console.log(t('operationSuccess'));
|
|
99
108
|
},
|
|
100
|
-
apps: async ({ options }: { options: { platform
|
|
101
|
-
const { platform } = options;
|
|
102
|
-
listApp(platform);
|
|
109
|
+
apps: async ({ options }: { options: { platform?: Platform | '' } }) => {
|
|
110
|
+
const { platform = '' } = options;
|
|
111
|
+
await listApp(platform);
|
|
103
112
|
},
|
|
104
113
|
selectApp: async ({
|
|
105
114
|
args,
|
|
106
115
|
options,
|
|
107
116
|
}: {
|
|
108
117
|
args: string[];
|
|
109
|
-
options: { platform
|
|
118
|
+
options: { platform?: Platform | '' };
|
|
110
119
|
}) => {
|
|
111
120
|
const platform = await getPlatform(options.platform);
|
|
112
121
|
const id = args[0]
|