react-native-update-cli 1.8.0 → 1.10.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/cli.json +23 -0
- package/lib/api.js +1 -5
- package/lib/app.js +1 -1
- package/lib/bundle.js +15 -15
- package/lib/versions.js +12 -0
- package/package.json +2 -2
- package/src/api.js +0 -4
- package/src/app.js +1 -1
- package/src/bundle.js +24 -20
- package/src/versions.js +14 -0
- package/lib/.DS_Store +0 -0
package/cli.json
CHANGED
|
@@ -88,6 +88,29 @@
|
|
|
88
88
|
}
|
|
89
89
|
},
|
|
90
90
|
|
|
91
|
+
"updateVersionInfo": {
|
|
92
|
+
"options": {
|
|
93
|
+
"platform": {
|
|
94
|
+
"hasValue": true
|
|
95
|
+
},
|
|
96
|
+
"versionId": {
|
|
97
|
+
"hasValue": true
|
|
98
|
+
},
|
|
99
|
+
"name": {
|
|
100
|
+
"default": false,
|
|
101
|
+
"hasValue": true
|
|
102
|
+
},
|
|
103
|
+
"description": {
|
|
104
|
+
"default": false,
|
|
105
|
+
"hasValue": true
|
|
106
|
+
},
|
|
107
|
+
"metaInfo": {
|
|
108
|
+
"default": false,
|
|
109
|
+
"hasValue": true
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
|
|
91
114
|
"build": {
|
|
92
115
|
"description": "Bundle javascript and copy assets."
|
|
93
116
|
},
|
package/lib/api.js
CHANGED
|
@@ -166,11 +166,7 @@ async function uploadFile(fn, key) {
|
|
|
166
166
|
bar.tick(data.length);
|
|
167
167
|
});
|
|
168
168
|
_request2.default.post(realUrl, {
|
|
169
|
-
formData
|
|
170
|
-
headers: {
|
|
171
|
-
'User-Agent': userAgent,
|
|
172
|
-
'X-AccessToken': session ? session.token : ''
|
|
173
|
-
}
|
|
169
|
+
formData
|
|
174
170
|
}, (err, resp, body) => {
|
|
175
171
|
if (err) {
|
|
176
172
|
return reject(err);
|
package/lib/app.js
CHANGED
|
@@ -105,7 +105,7 @@ const commands = exports.commands = {
|
|
|
105
105
|
},
|
|
106
106
|
selectApp: async function ({ args, options }) {
|
|
107
107
|
const platform = checkPlatform(options.platform || (await (0, _utils.question)('平台(ios/android):')));
|
|
108
|
-
const id = args[0]
|
|
108
|
+
const id = args[0] ? parseInt(args[0]) : (await chooseApp(platform)).id;
|
|
109
109
|
|
|
110
110
|
let updateInfo = {};
|
|
111
111
|
if (_fs2.default.existsSync('update.json')) {
|
package/lib/bundle.js
CHANGED
|
@@ -55,6 +55,7 @@ async function runReactNativeBundleCommand(bundleName, development, entryFile, o
|
|
|
55
55
|
|
|
56
56
|
fs.emptyDirSync(outputFolder);
|
|
57
57
|
|
|
58
|
+
// TODO sourcemap
|
|
58
59
|
Array.prototype.push.apply(reactNativeBundleArgs, [path.join('node_modules', 'react-native', 'local-cli', 'cli.js'), 'bundle', '--assets-dest', outputFolder, '--bundle-output', path.join(outputFolder, bundleName), '--dev', development, '--entry-file', entryFile, '--platform', platform, '--reset-cache']);
|
|
59
60
|
|
|
60
61
|
if (sourcemapOutput) {
|
|
@@ -81,7 +82,7 @@ async function runReactNativeBundleCommand(bundleName, development, entryFile, o
|
|
|
81
82
|
if (exitCode) {
|
|
82
83
|
reject(new Error(`"react-native bundle" command exited with code ${exitCode}.`));
|
|
83
84
|
} else {
|
|
84
|
-
if (gradleConfig.enableHermes) {
|
|
85
|
+
if (platform === 'android' && gradleConfig.enableHermes || platform === 'ios' && fs.existsSync('ios/Pods/hermes-engine')) {
|
|
85
86
|
await compileHermesByteCode(bundleName, outputFolder);
|
|
86
87
|
}
|
|
87
88
|
resolve(null);
|
|
@@ -118,13 +119,19 @@ async function checkGradleConfig() {
|
|
|
118
119
|
|
|
119
120
|
async function compileHermesByteCode(bundleName, outputFolder) {
|
|
120
121
|
console.log(`Hermes enabled, now compiling to hermes bytecode:\n`);
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
122
|
+
// >= rn 0.69
|
|
123
|
+
let hermesCommand = `node_modules/react-native/sdks/hermesc/${getHermesOSBin()}/hermesc`;
|
|
124
|
+
// < rn 0.69
|
|
125
|
+
if (!fs.existsSync(hermesCommand)) {
|
|
126
|
+
const hermesPackage = fs.existsSync('node_modules/hermes-engine') ? 'node_modules/hermes-engine' // 0.2+
|
|
127
|
+
: 'node_modules/hermesvm'; // < 0.2
|
|
128
|
+
const hermesPath = `${hermesPackage}/${getHermesOSBin()}`;
|
|
129
|
+
|
|
130
|
+
hermesCommand = fs.existsSync(`${hermesPath}/hermesc`) ? `${hermesPath}/hermesc` // 0.5+
|
|
131
|
+
: `${hermesPath}/hermes`; // < 0.5
|
|
132
|
+
}
|
|
127
133
|
|
|
134
|
+
// TODO sourcemap
|
|
128
135
|
spawnSync(path.join.apply(null, hermesCommand.split('/')), ['-emit-binary', '-out', path.join(outputFolder, bundleName), path.join(outputFolder, bundleName), '-O'], { stdio: 'ignore' });
|
|
129
136
|
}
|
|
130
137
|
|
|
@@ -455,14 +462,7 @@ const commands = exports.commands = {
|
|
|
455
462
|
bundle: async function ({ options }) {
|
|
456
463
|
const platform = (0, _app.checkPlatform)(options.platform || (await (0, _utils.question)('平台(ios/android):')));
|
|
457
464
|
|
|
458
|
-
let {
|
|
459
|
-
bundleName,
|
|
460
|
-
entryFile,
|
|
461
|
-
intermediaDir,
|
|
462
|
-
output,
|
|
463
|
-
dev,
|
|
464
|
-
verbose
|
|
465
|
-
} = (0, _utils.translateOptions)(_extends({}, options, {
|
|
465
|
+
let { bundleName, entryFile, intermediaDir, output, dev, verbose } = (0, _utils.translateOptions)(_extends({}, options, {
|
|
466
466
|
platform
|
|
467
467
|
}));
|
|
468
468
|
|
package/lib/versions.js
CHANGED
|
@@ -142,5 +142,17 @@ const commands = exports.commands = {
|
|
|
142
142
|
versionId
|
|
143
143
|
});
|
|
144
144
|
console.log('操作成功');
|
|
145
|
+
},
|
|
146
|
+
updateVersionInfo: async function ({ args, options }) {
|
|
147
|
+
const platform = (0, _app.checkPlatform)(options.platform || (await (0, _utils.question)('平台(ios/android):')));
|
|
148
|
+
const { appId } = await (0, _app.getSelectedApp)(platform);
|
|
149
|
+
const versionId = options.versionId || (await chooseVersion(appId)).id;
|
|
150
|
+
|
|
151
|
+
const updateParams = {};
|
|
152
|
+
options.name && (updateParams.name = options.name);
|
|
153
|
+
options.description && (updateParams.description = options.description);
|
|
154
|
+
options.metaInfo && (updateParams.metaInfo = options.metaInfo);
|
|
155
|
+
await put(`/app/${appId}/version/${versionId}`, updateParams);
|
|
156
|
+
console.log('操作成功');
|
|
145
157
|
}
|
|
146
158
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-update-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "Command tools for javaScript updater with `pushy` service for react native apps.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"cli-arguments": "^0.2.1",
|
|
37
37
|
"filesize-parser": "^1.5.0",
|
|
38
38
|
"fs-extra": "8",
|
|
39
|
-
"gradle-to-js": "^2.0.
|
|
39
|
+
"gradle-to-js": "^2.0.1",
|
|
40
40
|
"node-fetch": "^2.6.1",
|
|
41
41
|
"progress": "^2.0.3",
|
|
42
42
|
"read": "^1.0.7",
|
package/src/api.js
CHANGED
package/src/app.js
CHANGED
|
@@ -100,7 +100,7 @@ export const commands = {
|
|
|
100
100
|
const platform = checkPlatform(
|
|
101
101
|
options.platform || (await question('平台(ios/android):')),
|
|
102
102
|
);
|
|
103
|
-
const id = args[0]
|
|
103
|
+
const id = args[0] ? parseInt(args[0]) : (await chooseApp(platform)).id;
|
|
104
104
|
|
|
105
105
|
let updateInfo = {};
|
|
106
106
|
if (fs.existsSync('update.json')) {
|
package/src/bundle.js
CHANGED
|
@@ -48,6 +48,7 @@ async function runReactNativeBundleCommand(
|
|
|
48
48
|
|
|
49
49
|
fs.emptyDirSync(outputFolder);
|
|
50
50
|
|
|
51
|
+
// TODO sourcemap
|
|
51
52
|
Array.prototype.push.apply(reactNativeBundleArgs, [
|
|
52
53
|
path.join('node_modules', 'react-native', 'local-cli', 'cli.js'),
|
|
53
54
|
'bundle',
|
|
@@ -94,7 +95,10 @@ async function runReactNativeBundleCommand(
|
|
|
94
95
|
),
|
|
95
96
|
);
|
|
96
97
|
} else {
|
|
97
|
-
if (
|
|
98
|
+
if (
|
|
99
|
+
(platform === 'android' && gradleConfig.enableHermes) ||
|
|
100
|
+
(platform === 'ios' && fs.existsSync('ios/Pods/hermes-engine'))
|
|
101
|
+
) {
|
|
98
102
|
await compileHermesByteCode(bundleName, outputFolder);
|
|
99
103
|
}
|
|
100
104
|
resolve(null);
|
|
@@ -134,15 +138,21 @@ async function checkGradleConfig() {
|
|
|
134
138
|
|
|
135
139
|
async function compileHermesByteCode(bundleName, outputFolder) {
|
|
136
140
|
console.log(`Hermes enabled, now compiling to hermes bytecode:\n`);
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
141
|
+
// >= rn 0.69
|
|
142
|
+
let hermesCommand = `node_modules/react-native/sdks/hermesc/${getHermesOSBin()}/hermesc`;
|
|
143
|
+
// < rn 0.69
|
|
144
|
+
if (!fs.existsSync(hermesCommand)) {
|
|
145
|
+
const hermesPackage = fs.existsSync('node_modules/hermes-engine')
|
|
146
|
+
? 'node_modules/hermes-engine' // 0.2+
|
|
147
|
+
: 'node_modules/hermesvm'; // < 0.2
|
|
148
|
+
const hermesPath = `${hermesPackage}/${getHermesOSBin()}`;
|
|
149
|
+
|
|
150
|
+
hermesCommand = fs.existsSync(`${hermesPath}/hermesc`)
|
|
151
|
+
? `${hermesPath}/hermesc` // 0.5+
|
|
152
|
+
: `${hermesPath}/hermes`; // < 0.5
|
|
153
|
+
}
|
|
145
154
|
|
|
155
|
+
// TODO sourcemap
|
|
146
156
|
spawnSync(
|
|
147
157
|
path.join.apply(null, hermesCommand.split('/')),
|
|
148
158
|
[
|
|
@@ -514,17 +524,11 @@ export const commands = {
|
|
|
514
524
|
options.platform || (await question('平台(ios/android):')),
|
|
515
525
|
);
|
|
516
526
|
|
|
517
|
-
let {
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
dev,
|
|
523
|
-
verbose,
|
|
524
|
-
} = translateOptions({
|
|
525
|
-
...options,
|
|
526
|
-
platform,
|
|
527
|
-
});
|
|
527
|
+
let { bundleName, entryFile, intermediaDir, output, dev, verbose } =
|
|
528
|
+
translateOptions({
|
|
529
|
+
...options,
|
|
530
|
+
platform,
|
|
531
|
+
});
|
|
528
532
|
|
|
529
533
|
// const sourcemapOutput = path.join(intermediaDir, bundleName + ".map");
|
|
530
534
|
|
package/src/versions.js
CHANGED
|
@@ -149,4 +149,18 @@ export const commands = {
|
|
|
149
149
|
});
|
|
150
150
|
console.log('操作成功');
|
|
151
151
|
},
|
|
152
|
+
updateVersionInfo: async function ({ args, options }) {
|
|
153
|
+
const platform = checkPlatform(
|
|
154
|
+
options.platform || (await question('平台(ios/android):')),
|
|
155
|
+
);
|
|
156
|
+
const { appId } = await getSelectedApp(platform);
|
|
157
|
+
const versionId = options.versionId || (await chooseVersion(appId)).id;
|
|
158
|
+
|
|
159
|
+
const updateParams = {};
|
|
160
|
+
options.name && (updateParams.name = options.name);
|
|
161
|
+
options.description && (updateParams.description = options.description);
|
|
162
|
+
options.metaInfo && (updateParams.metaInfo = options.metaInfo);
|
|
163
|
+
await put(`/app/${appId}/version/${versionId}`, updateParams);
|
|
164
|
+
console.log('操作成功');
|
|
165
|
+
},
|
|
152
166
|
};
|
package/lib/.DS_Store
DELETED
|
Binary file
|