{"id":188,"date":"2021-04-29T18:04:01","date_gmt":"2021-04-29T10:04:01","guid":{"rendered":"https:\/\/fugary.com\/?p=188"},"modified":"2021-04-29T18:04:01","modified_gmt":"2021-04-29T10:04:01","slug":"%e4%bd%bf%e7%94%a8%e5%be%ae%e8%bd%afcodepush%e5%8a%a8%e6%80%81%e6%9b%b4%e6%96%b0cordova-app","status":"publish","type":"post","link":"https:\/\/fugary.com\/?p=188","title":{"rendered":"\u4f7f\u7528\u5fae\u8f6fCodePush\u52a8\u6001\u66f4\u65b0Cordova APP"},"content":{"rendered":"<p>\u4f7f\u7528\u5fae\u8f6fCodePush\u52a8\u6001\u66f4\u65b0Cordova APP<\/p>\n<p><strong>code-push<\/strong>\u662f\u5fae\u8f6f\u63d0\u4f9b\u7684\u4e00\u5957\u7528\u4e8e\u70ed\u66f4\u65b0 React Native\u548c Cordova\u5e94\u7528\u7684\u670d\u52a1\uff0c\u5fae\u8f6f\u7684appcenter\u63d0\u4f9b\u66f4\u65b0\u670d\u52a1\uff0c\u4e5f\u53ef\u4ee5\u81ea\u5df1\u642d\u5efa\u670d\u52a1\u5668code-push-server\u3002<\/p>\n<p><a href=\"https:\/\/microsoft.github.io\/code-push\/\">https:\/\/microsoft.github.io\/code-push\/<\/a><\/p>\n<p><a href=\"https:\/\/appcenter.ms\">https:\/\/appcenter.ms<\/a><\/p>\n<h3>\u5b89\u88c5appcenter-cli<\/h3>\n<p><code>code-push-cli<\/code>\u5df2\u7ecf\u5e9f\u5f03\uff0c\u76ee\u524d\u63a8\u8350\u4f7f\u7528<code>appcenter-cli<\/code>\uff0c\u539f\u6765\u7684<code>npm install -g code-push-cli<\/code>\u5df2\u7ecf\u4e0d\u5efa\u8bae\u4f7f\u7528\u4e86\u3002<\/p>\n<p><strong>\u6ce8\u610f\uff1a\u4e00\u822c\u60c5\u51b5\u4e0b\u7684\u547d\u4ee4\u90fd\u53ef\u4ee5\u6dfb\u52a0<code>--help<\/code>\u67e5\u770b\u5e2e\u52a9\u4fe1\u606f\u3002<\/strong><\/p>\n<p><a href=\"https:\/\/docs.microsoft.com\/en-us\/appcenter\/cli\">https:\/\/docs.microsoft.com\/en-us\/appcenter\/cli<\/a><\/p>\n<pre><code class=\"language-sh\">npm install -g appcenter-cli\nappcenter -v\nappcenter --help<\/code><\/pre>\n<h3>\u767b\u5f55AppCenter<\/h3>\n<p>\u767b\u5f55\u8d26\u53f7\uff1a<\/p>\n<pre><code class=\"language-sh\">appcenter login<\/code><\/pre>\n<p>\u5f39\u51fa\u5230\u6d4f\u89c8\u5668\u767b\u5f55\uff0c\u4e5f\u53ef\u4ee5\u5728\u6d4f\u89c8\u5668\u8f93\u5165\u547d\u4ee4\u8fd4\u56de\u7684\u5730\u5740\uff0c\u5982\uff1a<a href=\"https:\/\/appcenter.ms\/cli-login?hostname=10390-SDIT\">https:\/\/appcenter.ms\/cli-login?hostname=10390-SDIT<\/a><\/p>\n<p><div class='fancybox-wrapper' data-fancybox='post-images' href='https:\/\/git.mengqingpo.com:8888\/fugary\/blogpic1\/-\/raw\/master\/images\/20210429171752.png'><img src=\"https:\/\/git.mengqingpo.com:8888\/fugary\/blogpic1\/-\/raw\/master\/images\/20210429171752.png\" alt=\"\" \/><\/div><\/p>\n<p>\u53ef\u4ee5\u9009\u62e9\u767b\u5f55\u65b9\u5f0f\uff0c\u5982Github\u7b49\uff1a<\/p>\n<p><div class='fancybox-wrapper' data-fancybox='post-images' href='https:\/\/git.mengqingpo.com:8888\/fugary\/blogpic1\/-\/raw\/master\/images\/20210429171804.png'><img src=\"https:\/\/git.mengqingpo.com:8888\/fugary\/blogpic1\/-\/raw\/master\/images\/20210429171804.png\" alt=\"\" \/><\/div><\/p>\n<p>\u767b\u5f55\u540e\u83b7\u53d6Access code from browser:\u586b\u5165<\/p>\n<p><div class='fancybox-wrapper' data-fancybox='post-images' href='https:\/\/git.mengqingpo.com:8888\/fugary\/blogpic1\/-\/raw\/master\/images\/20210429171857.png'><img src=\"https:\/\/git.mengqingpo.com:8888\/fugary\/blogpic1\/-\/raw\/master\/images\/20210429171857.png\" alt=\"\" \/><\/div><\/p>\n<p>\u767b\u5f55\u6210\u529f\u3002<\/p>\n<h3>\u914d\u7f6eAppCenter CodePush<\/h3>\n<p>\u767b\u5f55\u6210\u529f\u4e4b\u540e\uff0c\u53ef\u4ee5\u521b\u5efa\u548c\u914d\u7f6eApp\u4e86\u3002<\/p>\n<h4>\u521b\u5efaAPP<\/h4>\n<p><code>appcenter apps<\/code>\u4e0b\u9762\u7684\u547d\u4ee4\u5c31\u662f\u7ba1\u7406app\u5217\u8868\uff1a<\/p>\n<pre><code class=\"language-shell\">#\u5e2e\u52a9\nappcenter apps --help\n#\u8bf4\u660e\uff08\u5e2e\u52a9\uff1aappcenter apps create --help\uff09\nappcenter apps create -p|--platform &lt;arg&gt; -o|--os &lt;arg&gt; -d|--display-name &lt;arg&gt; [-r|--release-type &lt;arg&gt;] [-n|--name &lt;arg&gt;] [--description &lt;arg&gt;]\n#\u793a\u4f8b\nappcenter apps create -p Cordova -o Android -d NewConnectApp<\/code><\/pre>\n<p>\u521b\u5efa\u7ed3\u679c:<\/p>\n<blockquote>\n<p>App Secret:            b50fff61-41a5-48fd-bc0e-xxxxxxxx<br \/>\nDescription:<br \/>\nDisplay Name:          NewConnectApp<br \/>\nName:                  NewConnectApp<br \/>\nOS:                    Android<br \/>\nPlatform:              Cordova<br \/>\nRelease Type:<br \/>\nOwner ID:              8e4aa89e-fc54-4e75-8c8e-xxxxxxxxxx<br \/>\nOwner Display Name:    Gary<br \/>\nOwner Email:           xxxxxxxxxx@gmail.com<br \/>\nOwner Name:            fugary<br \/>\nAzure Subscription ID:<\/p>\n<\/blockquote>\n<h4>\u521b\u5efaCodePushKey<\/h4>\n<p>\u65b0\u5efaApp\u4e4b\u540eCodePushKey\u4e3a\u7a7a\uff0c\u521b\u5efaDeployment\uff0c\u4f1a\u5f97\u5230CodePushKey\uff0c\u8fd9\u4e2akey\u5c06\u586b\u5230Cordova App\u7684config.xml\u6587\u4ef6\u4e2d\uff0c\u53ea\u6709\u586b\u5165\u4e4b\u540e\u624d\u80fd\u4f7f\u7528\u3002<\/p>\n<pre><code class=\"language-shell\">appcenter codepush deployment --help\n# \u521b\u5efaDeployment\nappcenter codepush deployment add -a fugary\/NewConnectApp Production\nappcenter codepush deployment list -a fugary\/NewConnectApp --displayKeys<\/code><\/pre>\n<p>\u83b7\u53d6\u5230Key\u5982\u4e0b\uff1a<\/p>\n<p><div class='fancybox-wrapper' data-fancybox='post-images' href='https:\/\/git.mengqingpo.com:8888\/fugary\/blogpic1\/-\/raw\/master\/images\/20210429172214.png'><img src=\"https:\/\/git.mengqingpo.com:8888\/fugary\/blogpic1\/-\/raw\/master\/images\/20210429172214.png\" alt=\"\" \/><\/div><\/p>\n<h3>\u914d\u7f6eCordova APP<\/h3>\n<p>\u8fd9\u91cc\u5047\u8bbe\u5df2\u7ecf\u5f00\u53d1\u597d\u57fa\u4e8eCordova\u7684App\u4e86\u3002<\/p>\n<h4>\u5b89\u88c5\u914d\u7f6ecordova-plugin-code-push\u63d2\u4ef6<\/h4>\n<p>\u5730\u5740\uff1a<a href=\"https:\/\/github.com\/Microsoft\/cordova-plugin-code-push\">https:\/\/github.com\/Microsoft\/cordova-plugin-code-push<\/a><\/p>\n<p>\u5b89\u88c5cordova-plugin-code-push\u63d2\u4ef6<\/p>\n<pre><code class=\"language-sh\">cordova plugin add cordova-plugin-code-push@latest<\/code><\/pre>\n<p>\u914d\u7f6econfig.xml<\/p>\n<p>YOUR-ANDROID-DEPLOYMENT-KEY\u5c31\u662f\u4e0a\u9762\u83b7\u53d6\u5230\u7684CodePushKey\uff1a<\/p>\n<pre><code class=\"language-xml\">&lt;platform name=&quot;android&quot;&gt;\n    &lt;preference name=&quot;CodePushDeploymentKey&quot; value=&quot;YOUR-ANDROID-DEPLOYMENT-KEY&quot; \/&gt;\n&lt;\/platform&gt;\n&lt;platform name=&quot;ios&quot;&gt;\n    &lt;preference name=&quot;CodePushDeploymentKey&quot; value=&quot;YOUR-IOS-DEPLOYMENT-KEY&quot; \/&gt;\n&lt;\/platform&gt;<\/code><\/pre>\n<p>platform\u76f8\u5173\u5e94\u8be5\u5df2\u7ecf\u5b58\u5728\uff0c\u53ea\u9700\u8981\u6dfb\u52a0\u4e00\u884c\uff1a<\/p>\n<p><code>&lt;preference name=&quot;CodePushDeploymentKey&quot; value=&quot;YOUR-ANDROID-DEPLOYMENT-KEY&quot; \/&gt;<\/code><\/p>\n<h4>\u4f7f\u7528codepush\u66f4\u65b0<\/h4>\n<p>\u5728\u4ee3\u7801\u4e2d\u9700\u8981\u8c03\u7528\u66f4\u65b0\u4ee3\u7801\uff1a<\/p>\n<pre><code class=\"language-js\">if (window.cordova &amp;&amp; window.codePush) {\n   window.codePush.sync() \/\/ \u9ed8\u8ba4ON_NEXT_RESTART\u5b89\u88c5\n}<\/code><\/pre>\n<h3>\u53d1\u5e03\u5230AppCenter<\/h3>\n<pre><code class=\"language-shell\">appcenter codepush release-cordova --help\nappcenter codepush release-cordova -a fugary\/NewConnectApp  -d Production --description &quot;new release&quot;<\/code><\/pre>\n<p>\u4e0b\u6b21\u542f\u52a8App\u7684\u65f6\u5019\u4f1a\u81ea\u52a8\u66f4\u65b0app\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f7f\u7528\u5fae\u8f6fCodePush\u52a8\u6001\u66f4\u65b0Cordova APP code-push\u662f\u5fae\u8f6f\u63d0\u4f9b\u7684\u4e00\u5957\u7528\u4e8e\u70ed\u66f4\u65b0 Reac [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[26,37,36],"_links":{"self":[{"href":"https:\/\/fugary.com\/index.php?rest_route=\/wp\/v2\/posts\/188"}],"collection":[{"href":"https:\/\/fugary.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fugary.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fugary.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fugary.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=188"}],"version-history":[{"count":1,"href":"https:\/\/fugary.com\/index.php?rest_route=\/wp\/v2\/posts\/188\/revisions"}],"predecessor-version":[{"id":189,"href":"https:\/\/fugary.com\/index.php?rest_route=\/wp\/v2\/posts\/188\/revisions\/189"}],"wp:attachment":[{"href":"https:\/\/fugary.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=188"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fugary.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=188"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fugary.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=188"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}