1
0
mirror of https://gitcode.com/github-mirrors/react-native-update-cli.git synced 2025-09-17 18:06:10 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

Compare commits

..

3 Commits

Author SHA1 Message Date
sunnylqm
46d308c7c2 v1.4.0-beta1 2021-04-11 18:11:24 +08:00
sunnylqm
9e721e1858 try require diff separately 2021-04-11 18:11:08 +08:00
sunnylqm
c30454976c v1.4.0-beta0 2021-04-08 16:07:10 +08:00
3 changed files with 49 additions and 23 deletions

View File

@@ -123,7 +123,7 @@
"description": "Create diff patch", "description": "Create diff patch",
"options": { "options": {
"output": { "output": {
"default": "build/output/diff", "default": ".pushy/output/diff",
"hasValue": true "hasValue": true
} }
} }
@@ -132,7 +132,7 @@
"description": "Create diff patch from a Android package(.apk)", "description": "Create diff patch from a Android package(.apk)",
"options": { "options": {
"output": { "output": {
"default": "build/output/diff-${time}.apk-patch", "default": ".pushy/output/diff-${time}.apk-patch",
"hasValue": true "hasValue": true
} }
} }
@@ -141,7 +141,34 @@
"description": "Create diff patch from a iOS package(.ipa)", "description": "Create diff patch from a iOS package(.ipa)",
"options": { "options": {
"output": { "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 "hasValue": true
} }
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "react-native-update-cli", "name": "react-native-update-cli",
"version": "1.4.0-beta0", "version": "1.4.0-beta1",
"description": "Command tools for javaScript updater with `pushy` service for react native apps.", "description": "Command tools for javaScript updater with `pushy` service for react native apps.",
"main": "index.js", "main": "index.js",
"bin": { "bin": {

View File

@@ -16,6 +16,9 @@ const os = require('os');
var bsdiff, hdiff, diff; var bsdiff, hdiff, diff;
try { try {
bsdiff = require('node-bsdiff').diff; bsdiff = require('node-bsdiff').diff;
} catch (e) {}
try {
hdiff = require('node-hdiffpatch').diff; hdiff = require('node-hdiffpatch').diff;
} catch (e) {} } catch (e) {}
@@ -473,7 +476,7 @@ function enumZipEntries(zipFn, callback) {
}); });
} }
function diffArgsCheck({ args, options, diffFn }) { function diffArgsCheck(args, options, diffFn) {
const [origin, next] = args; const [origin, next] = args;
if (!origin || !next) { if (!origin || !next) {
@@ -562,29 +565,25 @@ export const commands = {
}, },
async diff({ args, options }) { 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'); await diffFromPPK(origin, next, realOutput, 'index.bundlejs');
console.log(`${realOutput} generated.`); console.log(`${realOutput} generated.`);
}, },
async hdiff({ args, options }) { async hdiff({ args, options }) {
const { origin, next, realOutput } = diffArgsCheck({ const { origin, next, realOutput } = diffArgsCheck(args, options, 'hdiff');
args,
options,
hdiff,
});
await diffFromPPK(origin, next, realOutput, 'index.bundlejs'); await diffFromPPK(origin, next, realOutput, 'index.bundlejs');
console.log(`${realOutput} generated.`); console.log(`${realOutput} generated.`);
}, },
async diffFromApk({ args, options }) { async diffFromApk({ args, options }) {
const { origin, next, realOutput } = diffArgsCheck({ const { origin, next, realOutput } = diffArgsCheck(
args, args,
options, options,
diffFromApk, 'diffFromApk',
}); );
await diffFromPackage( await diffFromPackage(
origin, origin,
@@ -596,11 +595,11 @@ export const commands = {
}, },
async hdiffFromApk({ args, options }) { async hdiffFromApk({ args, options }) {
const { origin, next, realOutput } = diffArgsCheck({ const { origin, next, realOutput } = diffArgsCheck(
args, args,
options, options,
hdiffFromApk, 'hdiffFromApk',
}); );
await diffFromPackage( await diffFromPackage(
origin, origin,
@@ -612,11 +611,11 @@ export const commands = {
}, },
async diffFromIpa({ args, options }) { async diffFromIpa({ args, options }) {
const { origin, next, realOutput } = diffArgsCheck({ const { origin, next, realOutput } = diffArgsCheck(
args, args,
options, options,
diffFromIpa, 'diffFromIpa',
}); );
await diffFromPackage(origin, next, realOutput, 'main.jsbundle', (v) => { await diffFromPackage(origin, next, realOutput, 'main.jsbundle', (v) => {
const m = /^Payload\/[^/]+\/(.+)$/.exec(v); const m = /^Payload\/[^/]+\/(.+)$/.exec(v);
@@ -627,11 +626,11 @@ export const commands = {
}, },
async hdiffFromIpa({ args, options }) { async hdiffFromIpa({ args, options }) {
const { origin, next, realOutput } = diffArgsCheck({ const { origin, next, realOutput } = diffArgsCheck(
args, args,
options, options,
hdiffFromIpa, 'hdiffFromIpa',
}); );
await diffFromPackage(origin, next, realOutput, 'main.jsbundle', (v) => { await diffFromPackage(origin, next, realOutput, 'main.jsbundle', (v) => {
const m = /^Payload\/[^/]+\/(.+)$/.exec(v); const m = /^Payload\/[^/]+\/(.+)$/.exec(v);