mirror of
https://gitcode.com/github-mirrors/react-native-update-cli.git
synced 2025-09-18 02:16:11 +08:00
Compare commits
7 Commits
v1.4.0-bet
...
v1.4.1
Author | SHA1 | Date | |
---|---|---|---|
![]() |
11799dd0c1 | ||
![]() |
2ab0cad7e5 | ||
![]() |
ec8d6a767b | ||
![]() |
fa8290fcbf | ||
![]() |
46d308c7c2 | ||
![]() |
9e721e1858 | ||
![]() |
c30454976c |
33
cli.json
33
cli.json
@@ -123,7 +123,7 @@
|
||||
"description": "Create diff patch",
|
||||
"options": {
|
||||
"output": {
|
||||
"default": "build/output/diff",
|
||||
"default": ".pushy/output/diff",
|
||||
"hasValue": true
|
||||
}
|
||||
}
|
||||
@@ -132,7 +132,7 @@
|
||||
"description": "Create diff patch from a Android package(.apk)",
|
||||
"options": {
|
||||
"output": {
|
||||
"default": "build/output/diff-${time}.apk-patch",
|
||||
"default": ".pushy/output/diff-${time}.apk-patch",
|
||||
"hasValue": true
|
||||
}
|
||||
}
|
||||
@@ -141,7 +141,34 @@
|
||||
"description": "Create diff patch from a iOS package(.ipa)",
|
||||
"options": {
|
||||
"output": {
|
||||
"default": "build/output/diff-${time}.ipa-patch",
|
||||
"default": ".pushy/output/diff-${time}.ipa-patch",
|
||||
"hasValue": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"hdiff": {
|
||||
"description": "Create hdiff patch",
|
||||
"options": {
|
||||
"output": {
|
||||
"default": ".pushy/output/hdiff",
|
||||
"hasValue": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"hdiffFromApk": {
|
||||
"description": "Create hdiff patch from a Android package(.apk)",
|
||||
"options": {
|
||||
"output": {
|
||||
"default": ".pushy/output/hdiff-${time}.apk-patch",
|
||||
"hasValue": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"hdiffFromIpa": {
|
||||
"description": "Create hdiff patch from a iOS package(.ipa)",
|
||||
"options": {
|
||||
"output": {
|
||||
"default": ".pushy/output/hdiff-${time}.ipa-patch",
|
||||
"hasValue": true
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-native-update-cli",
|
||||
"version": "1.4.0-beta0",
|
||||
"version": "1.4.1",
|
||||
"description": "Command tools for javaScript updater with `pushy` service for react native apps.",
|
||||
"main": "index.js",
|
||||
"bin": {
|
||||
|
@@ -16,6 +16,9 @@ const os = require('os');
|
||||
var bsdiff, hdiff, diff;
|
||||
try {
|
||||
bsdiff = require('node-bsdiff').diff;
|
||||
} catch (e) {}
|
||||
|
||||
try {
|
||||
hdiff = require('node-hdiffpatch').diff;
|
||||
} catch (e) {}
|
||||
|
||||
@@ -29,12 +32,12 @@ async function runReactNativeBundleCommand(
|
||||
config,
|
||||
) {
|
||||
let gradleConfig = {};
|
||||
// if (platform === 'android') {
|
||||
// gradleConfig = await checkGradleConfig();
|
||||
// if (gradleConfig.crunchPngs !== false) {
|
||||
// throw new Error('请先禁用android的crunchPngs优化,具体请参考 https://pushy.reactnative.cn/docs/getting-started.html#%E7%A6%81%E7%94%A8android%E7%9A%84crunch%E4%BC%98%E5%8C%96')
|
||||
// }
|
||||
// }
|
||||
if (platform === 'android') {
|
||||
gradleConfig = await checkGradleConfig();
|
||||
// if (gradleConfig.crunchPngs !== false) {
|
||||
// throw new Error('请先禁用android的crunchPngs优化,具体请参考 https://pushy.reactnative.cn/docs/getting-started.html#%E7%A6%81%E7%94%A8android%E7%9A%84crunch%E4%BC%98%E5%8C%96')
|
||||
// }
|
||||
}
|
||||
|
||||
let reactNativeBundleArgs = [];
|
||||
|
||||
@@ -116,7 +119,6 @@ async function checkGradleConfig() {
|
||||
try {
|
||||
const gradleConfig = await g2js.parseFile('android/app/build.gradle');
|
||||
const projectConfig = gradleConfig['project.ext.react'];
|
||||
crunchPngs = gradleConfig.android.buildTypes.release.crunchPngs;
|
||||
for (const packagerConfig of projectConfig) {
|
||||
if (
|
||||
packagerConfig.includes('enableHermes') &&
|
||||
@@ -126,6 +128,7 @@ async function checkGradleConfig() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
crunchPngs = gradleConfig.android.buildTypes.release.crunchPngs;
|
||||
} catch (e) {}
|
||||
return {
|
||||
enableHermes,
|
||||
@@ -473,7 +476,7 @@ function enumZipEntries(zipFn, callback) {
|
||||
});
|
||||
}
|
||||
|
||||
function diffArgsCheck({ args, options, diffFn }) {
|
||||
function diffArgsCheck(args, options, diffFn) {
|
||||
const [origin, next] = args;
|
||||
|
||||
if (!origin || !next) {
|
||||
@@ -562,29 +565,25 @@ export const commands = {
|
||||
},
|
||||
|
||||
async diff({ args, options }) {
|
||||
const { origin, next, realOutput } = diffArgsCheck({ args, options, diff });
|
||||
const { origin, next, realOutput } = diffArgsCheck(args, options, 'diff');
|
||||
|
||||
await diffFromPPK(origin, next, realOutput, 'index.bundlejs');
|
||||
console.log(`${realOutput} generated.`);
|
||||
},
|
||||
|
||||
async hdiff({ args, options }) {
|
||||
const { origin, next, realOutput } = diffArgsCheck({
|
||||
args,
|
||||
options,
|
||||
hdiff,
|
||||
});
|
||||
const { origin, next, realOutput } = diffArgsCheck(args, options, 'hdiff');
|
||||
|
||||
await diffFromPPK(origin, next, realOutput, 'index.bundlejs');
|
||||
console.log(`${realOutput} generated.`);
|
||||
},
|
||||
|
||||
async diffFromApk({ args, options }) {
|
||||
const { origin, next, realOutput } = diffArgsCheck({
|
||||
const { origin, next, realOutput } = diffArgsCheck(
|
||||
args,
|
||||
options,
|
||||
diffFromApk,
|
||||
});
|
||||
'diffFromApk',
|
||||
);
|
||||
|
||||
await diffFromPackage(
|
||||
origin,
|
||||
@@ -596,11 +595,11 @@ export const commands = {
|
||||
},
|
||||
|
||||
async hdiffFromApk({ args, options }) {
|
||||
const { origin, next, realOutput } = diffArgsCheck({
|
||||
const { origin, next, realOutput } = diffArgsCheck(
|
||||
args,
|
||||
options,
|
||||
hdiffFromApk,
|
||||
});
|
||||
'hdiffFromApk',
|
||||
);
|
||||
|
||||
await diffFromPackage(
|
||||
origin,
|
||||
@@ -612,11 +611,11 @@ export const commands = {
|
||||
},
|
||||
|
||||
async diffFromIpa({ args, options }) {
|
||||
const { origin, next, realOutput } = diffArgsCheck({
|
||||
const { origin, next, realOutput } = diffArgsCheck(
|
||||
args,
|
||||
options,
|
||||
diffFromIpa,
|
||||
});
|
||||
'diffFromIpa',
|
||||
);
|
||||
|
||||
await diffFromPackage(origin, next, realOutput, 'main.jsbundle', (v) => {
|
||||
const m = /^Payload\/[^/]+\/(.+)$/.exec(v);
|
||||
@@ -627,11 +626,11 @@ export const commands = {
|
||||
},
|
||||
|
||||
async hdiffFromIpa({ args, options }) {
|
||||
const { origin, next, realOutput } = diffArgsCheck({
|
||||
const { origin, next, realOutput } = diffArgsCheck(
|
||||
args,
|
||||
options,
|
||||
hdiffFromIpa,
|
||||
});
|
||||
'hdiffFromIpa',
|
||||
);
|
||||
|
||||
await diffFromPackage(origin, next, realOutput, 'main.jsbundle', (v) => {
|
||||
const m = /^Payload\/[^/]+\/(.+)$/.exec(v);
|
||||
|
Reference in New Issue
Block a user