diff --git a/README.md b/README.md index bf6377a..2d80872 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ 因为React Native调整了okhttp的依赖,对于0.26及以前版本,请指定安装1.0.x版本。 -0.31开始React Native调整了bundle的传参,因此需要更新本插件到2.1.0 +0.31开始React Native调整了bundle的传参,因此需要更新本插件到2.1.0或更高版本。 ### 优势 diff --git a/docs/guide.md b/docs/guide.md index e8f3df4..8ade1f7 100644 --- a/docs/guide.md +++ b/docs/guide.md @@ -50,11 +50,6 @@ npm config set registry https://registry.npm.taobao.org --global npm config set disturl https://npm.taobao.org/dist --global ``` -* Windows平台请注意 * - -1、你必须安装python 2.7以及一套C++环境(推荐VS2013或VS2015,VS2010及以前版本不可用) - -2、如果使用VS2015,你需要设置`npm config set msvs_version 2015 --global` ## 手动安装 @@ -64,8 +59,8 @@ npm config set disturl https://npm.taobao.org/dist --global 1. 在XCode中的Project Navigator里,右键点击`Libraries` ➜ `Add Files to [你的工程名]` 2. 进入`node_modules` ➜ `react-native-update` ➜ `ios 并选中 `RCTHotUpdate.xcodeproj` -3. 在XCode中的project navigator里,选中你的工程,在 `Build Phases` ➜ `Link Binary With Libraries` 中添加 `libRCTHotUpdate.a` -4. Run your project (`Cmd+R`)< +3. 在XCode中的project navigator里,选中你的工程,在 `Build Phases` ➜ `Link Binary With Libraries` 中添加 `libRCTHotUpdate.a` +4. Run your project (`Cmd+R`) #### Android @@ -84,8 +79,6 @@ npm config set disturl https://npm.taobao.org/dist --global ## 配置Bundle URL(iOS) -// 文档建设中 - 在工程target的Build Phases->Link Binary with Libraries中加入libz.tbd、libbz2.1.0.tbd @@ -145,6 +138,23 @@ public class MainActivity extends ReactActivity { } ``` +## iOS的ATS例外配置 +从iOS9开始,苹果要求以白名单的形式在Info.plist中列出外部的非https接口,以督促开发者部署https协议。在我们的服务部署https协议之前,请在Info.plist中添加如下例外(右键点击Info.plist,选择open as - source code): +```xml +NSAppTransportSecurity + + NSExceptionDomains + + reactnative.cn + + NSIncludesSubdomains + + + + +``` + + ## 登录与创建应用 在你的项目根目录下运行以下命令: diff --git a/local-cli/src/bundle.js b/local-cli/src/bundle.js index 5e56f57..c5ad3b8 100644 --- a/local-cli/src/bundle.js +++ b/local-cli/src/bundle.js @@ -12,11 +12,21 @@ import { import * as fs from 'fs'; import {ZipFile} from 'yazl'; import {open as openZipFile} from 'yauzl'; -import {diff} from 'node-bsdiff'; +// import {diff} from 'node-bsdiff'; import { question } from './utils'; import {checkPlatform} from './app'; import crypto from 'crypto'; +var diff; +try { + diff = require('node-bsdiff'); +} catch(e) { + diff = function() { + console.warn('This function needs "node-bsdiff". Please run "npm i node-bsdiff -S" from your project directory first!'); + throw new Error('This function needs module "node-bsdiff". Please install it first.') + } +} + function mkdir(dir){ return new Promise((resolve, reject) => { mkdirRecurisve(dir, err => { @@ -106,7 +116,7 @@ function basename(fn) { return m && m[1]; } -async function diffWithPPK(origin, next, output) { +async function diffFromPPK(origin, next, output) { await mkdir(path.dirname(output)); const originEntries = {}; @@ -223,7 +233,7 @@ async function diffWithPPK(origin, next, output) { await writePromise; } -async function diffWithPackage(origin, next, output, originBundleName, transformPackagePath = v=>v) { +async function diffFromPackage(origin, next, output, originBundleName, transformPackagePath = v=>v) { await mkdir(path.dirname(output)); const originEntries = {}; @@ -425,11 +435,11 @@ export const commands = { const realOutput = output.replace(/\$\{time\}/g, '' + Date.now()); if (!origin || !next) { - console.error('pushy diffWithApk '); + console.error('pushy diff '); process.exit(1); } - await diffWithPPK(origin, next, realOutput, 'index.bundlejs'); + await diffFromPPK(origin, next, realOutput, 'index.bundlejs'); console.log(`${realOutput} generated.`); }, @@ -440,11 +450,11 @@ export const commands = { const realOutput = output.replace(/\$\{time\}/g, '' + Date.now()); if (!origin || !next) { - console.error('pushy diffWithApk '); + console.error('pushy diffFromApk '); process.exit(1); } - await diffWithPackage(origin, next, realOutput, 'assets/index.android.bundle'); + await diffFromPackage(origin, next, realOutput, 'assets/index.android.bundle'); console.log(`${realOutput} generated.`); }, @@ -455,11 +465,11 @@ export const commands = { const realOutput = output.replace(/\$\{time\}/g, '' + Date.now()); if (!origin || !next) { - console.error('pushy diffWithIpa '); + console.error('pushy diffFromIpa '); process.exit(1); } - await diffWithPackage(origin, next, realOutput, 'main.jsbundle', v=>{ + await diffFromPackage(origin, next, realOutput, 'main.jsbundle', v=>{ const m = /^Payload\/[^/]+\/(.+)$/.exec(v); return m && m[1]; }); diff --git a/package.json b/package.json index 2bbc4d5..759c775 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,6 @@ "isomorphic-fetch": "^2.2.1", "mkdir-recursive": "^0.2.1", "node-apk-parser": "^0.2.3", - "node-bsdiff": "^0.1.4", "progress": "^1.1.8", "read": "^1.0.7", "request": "^2.69.0",