{"id":10006808,"date":"2022-11-04T15:35:35","date_gmt":"2022-11-04T07:35:35","guid":{"rendered":"https:\/\/ityet.com\/?p=10006808"},"modified":"2022-11-04T15:35:35","modified_gmt":"2022-11-04T07:35:35","slug":"taro-%e8%87%aa%e5%8a%a8%e9%83%a8%e7%bd%b2%e5%be%ae%e4%bf%a1%e6%94%af%e4%bb%98%e5%ae%9d%e5%b0%8f%e7%a8%8b%e5%ba%8f%ef%bc%88%e9%99%84%e5%b8%a6%e5%8a%a8%e6%80%81%e4%bf%ae%e6%94%b9%e6%94%af%e4%bb%98","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10006808","title":{"rendered":"Taro \u81ea\u52a8\u90e8\u7f72\u5fae\u4fe1+\u652f\u4ed8\u5b9d\u5c0f\u7a0b\u5e8f\uff08\u9644\u5e26\u52a8\u6001\u4fee\u6539\u652f\u4ed8\u5b9d\u4f53\u9a8c\u7248\u7248\u672c\u53f7\uff09"},"content":{"rendered":"<blockquote><p>\u80cc\u666f\uff1a\u4f7f\u7528taro3\u540c\u65f6\u5f00\u53d1 <code>\u5fae\u4fe1\u5c0f\u7a0b\u5e8f + \u652f\u4ed8\u5b9d\u5c0f\u7a0b\u5e8f<\/code>\uff1b\u5e38\u89c4\u4e0a\u4f20\u65b9\u5f0f\u4e3a\uff1a\u5728\u672c\u5730\u6253\u5305\u5b8c\u5fae\u4fe1\u4f7f\u7528\u5f00\u53d1\u8005\u5de5\u5177\u4e0a\u4f20\uff1b\u518d\u6b21\u6253\u5305\u652f\u4ed8\u5b9d\u4f7f\u7528\u652f\u4ed8\u5b9d\u5f00\u53d1\u8005\u5de5\u5177\u4e0a\u4f20\uff1b\u76f8\u5bf9\u7e41\u7410\uff1b\u6240\u4ee5\u4f7f\u7528<code>ci\u673a\u5668\u4eba<\/code>\u914d\u5408<code>jenkins<\/code>\u8fbe\u5230\u63d0\u4ea4\u4ee3\u7801<code>\u81ea\u52a8\u90e8\u7f72\u53cc\u5e73\u53f0<\/code>\u5e76\u4e14\u53d1\u9001<code>\u98de\u4e66\u6d88\u606f\u901a\u77e5<\/code><\/p><\/blockquote>\n<h3>1. \u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u81ea\u52a8\u4e0a\u4f20\u4f53\u9a8c\u7248<\/h3>\n<h4>1.1 \u5b89\u88c5\u76f8\u5173\u63d2\u4ef6\u4f9d\u8d56<\/h4>\n<p><a href=\"https:\/\/link.segmentfault.com\/?enc=rLWbUVJk6w6MPJLfp0%2BAQg%3D%3D.3RoxmbDmcelqUDapvIGAvCGfYSG0Mr8rs%2Fik7zKOG1TReo79iktLfM8MPtLg5qEJ\" rel=\"nofollow\">\u5c0f\u7a0b\u5e8f\u6301\u7eed\u96c6\u6210<\/a> \u501f\u52a9\u8be5\u6587\u6863\u7684<code>plugin-mini-ci<\/code>\u63d2\u4ef6\u8fdb\u884c\u673a\u5668\u4eba\u81ea\u52a8\u90e8\u7f72\u529f\u80fd<\/p>\n<h4>1.2 \u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u673a\u5668\u4eba\u90e8\u7f72\u4ee3\u7801\u914d\u7f6e<\/h4>\n<p>\u6253\u5305\u914d\u7f6e\u4fee\u6539<\/p>\n<pre><code class=\"javascript\">\/\/ config\/index.js\nconst CIPluginOpt = {\n  \/\/ \u5fae\u4fe1\u5c0f\u7a0b\u5e8f\n  weapp: {\n    appid: 'appid',\n   \/\/ \u5728\u5f00\u653e\u5e73\u53f0\u4e0b\u8f7d\u7684\u5bc6\u94a5\u6587\u4ef6\uff1b\u653e\u5230\u6839\u76ee\u5f55\u7684\u8def\u5f84\uff1b\u89c1\u4e0b\u56fe\n    privateKeyPath: 'private.appid.key'\n  },\n  \/\/ \u7248\u672c\u53f7\n  version: '0.0.2',\n  \/\/ \u7248\u672c\u53d1\u5e03\u63cf\u8ff0\n  desc: '\u7248\u672c\u63cf\u8ff0'\n\/\/ ....\u5176\u4ed6\u4ee3\u7801\nconst config = {\n  \/\/ \u5176\u4ed6\u4ee3\u7801\n  plugins:[['@tarojs\/plugin-mini-ci', CIPluginOpt], '@tarojs\/plugin-html', 'taro-plugin-pinia'],\n  }\n}<\/code><\/pre>\n<h4>1.3 \u8bbe\u7f6e\u81ea\u52a8\u4e0a\u4f20\u4f53\u9a8c\u7248\u767d\u540d\u5355<\/h4>\n<p>\u6dfb\u52a0\u6253\u5305\u540e\u4e0a\u4f20ip\u767d\u540d\u5355<br \/><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc3u4w\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h4>1.4 \u914d\u7f6enpm\u6253\u5305+\u4e0a\u4f20\u547d\u4ee4<\/h4>\n<pre><code class=\"json\">   \/\/ package.json\n &quot;build:weapp:upload&quot;: &quot;taro build --type weapp --upload&quot;,\n<\/code><\/pre>\n<p>\u4f7f\u7528<code>npm run build:weapp:upload<\/code>  \u5373\u53ef\u5b8c\u6210\u672c\u5730\u6253\u5305\u540e\u6210\u529f\u4e0a\u4f20\u5230\u4f53\u9a8c\u7248<br \/><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc3u5y\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>\u81f3\u6b64\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u672c\u5730\u6253\u5305\u81ea\u52a8\u90e8\u7f72\u5230\u4f53\u9a8c\u7248\u5df2\u7ecf\u5b8c\u6210\uff01[\u6492\u82b1\ud83c\udf89]<\/p>\n<h3>2. \u652f\u4ed8\u5b9d\u5c0f\u7a0b\u5e8f\u81ea\u52a8\u4e0a\u4f20\u5230\u4f53\u9a8c\u7248<\/h3>\n<blockquote><p>\u524d\u8a00\uff1a\u652f\u4ed8\u5b9d\u5c0f\u7a0b\u5e8f\u4f53\u9a8c\u7248\u7248\u672c\u53f7\u76f8\u5bf9\u4e25\u683c\uff08\u9700\u8981\u672c\u6b21\u4e0a\u4f20\u7684\u7248\u672c\u53f7\u5fc5\u987b\u5927\u4e8e\u4e0a\u6b21\u7684\u7248\u672c\u53f7\uff09<\/p><\/blockquote>\n<h4>2.1 \u5b89\u88c5\u76f8\u5173\u63d2\u4ef6\u4f9d\u8d56\uff08\u548c1\u76f8\u540c\uff09<\/h4>\n<p><a href=\"https:\/\/link.segmentfault.com\/?enc=fq4IEXIYI3KzJFV4j%2FgV1A%3D%3D.7YKQ5sPvC1HjKYeJrlKsxIxFsp43kuyCKznImFohJNOC%2FK1bkwNwtZ%2BRRQLWyz0F\" rel=\"nofollow\">\u5c0f\u7a0b\u5e8f\u6301\u7eed\u96c6\u6210<\/a> \u501f\u52a9\u8be5\u6587\u6863\u7684<code>plugin-mini-ci<\/code>\u63d2\u4ef6\u8fdb\u884c\u673a\u5668\u4eba\u81ea\u52a8\u90e8\u7f72\u529f\u80fd<\/p>\n<h4>2.2 \u4fee\u6539\u4e0a\u4f20\u524d\u7248\u672c\u53f7<\/h4>\n<ul>\n<li>\u53ef\u4ee5\u624b\u52a8\u7684\u4fee\u6539\u7248\u672c\u53f7\u7136\u540e\u7ee7\u7eed<\/li>\n<li>\u4e5f\u53ef\u4ee5\u4f7f\u7528<code>nodejs<\/code>\u4fee\u6539\u7248\u672c\u53f7\u7136\u540e\u7ee7\u7eed\uff08\u672c\u9879\u76ee\u4f7f\u7528\u65b9\u6848<a href=\"https:\/\/segmentfault.com\/a\/1190000042741814\">\u4f7f\u7528nodejs\u4fee\u6539\u9879\u76eepackage.json\u7248\u672c\u53f7<\/a>\uff09<\/li>\n<\/ul>\n<h4>2.3 \u652f\u4ed8\u5b9d\u5c0f\u7a0b\u5e8f\u673a\u5668\u4eba\u90e8\u7f72\u4ee3\u7801\u914d\u7f6e<\/h4>\n<p>\u6253\u5305\u914d\u7f6e\u4fee\u6539<\/p>\n<pre><code class=\"javascript\">\/\/ config\/index.js\n\/\/ \u5f15\u5165package.json\u5185\u7684\u7248\u672c\u53f7\nimport packageData from '..\/package.json'\nconst CIPluginOpt = {\n  \/\/ \u5fae\u4fe1\u5c0f\u7a0b\u5e8f\n  weapp: {\n    appid: 'appid',\n   \/\/ \u5728\u5f00\u653e\u5e73\u53f0\u4e0b\u8f7d\u7684\u5bc6\u94a5\u6587\u4ef6\uff1b\u653e\u5230\u6839\u76ee\u5f55\u7684\u8def\u5f84\uff1b\u89c1\u4e0b\u56fe\n    privateKeyPath: 'private.appid.key'\n  },\n  \/\/ \u652f\u4ed8\u5b9d\u5c0f\u7a0b\u5e8f\n  alipay: {\n    appId: '\u652f\u4ed8\u5b9d\u5c0f\u7a0b\u5e8fappid',\n    toolId: '\u4f7f\u7528\u5de5\u5177\u751f\u6210\uff08\u89c12.3.1\uff09,\n    privateKeyPath: '\u79c1\u94a5\u4f7f\u7528\u5de5\u5177\u751f\u6210\uff08\u89c12.3.1\uff09'\n  },\n  \/\/ \u7248\u672c\u53f7\uff08\u5982\u679c\u662f\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5c31\u56fa\u5b9a002\uff1b\u53ef\u4ee5\u4e0d\u7528\u66f4\u65b0\u4f53\u9a8c\u7248\u4e8c\u7ef4\u7801\u56fe\u7247\uff1b\u5176\u4ed6\u76f4\u63a5\u8bfbpackage.json\u7684\u7248\u672c\u53f7\uff09\n  version: process.argv.includes('weapp') ? '0.0.2' : packageData.version,\n  \/\/ \u7248\u672c\u53d1\u5e03\u63cf\u8ff0\n  desc: '\u7248\u672c\u63cf\u8ff0'\n\/\/ ....\u5176\u4ed6\u4ee3\u7801\nconst config = {\n  \/\/ \u5176\u4ed6\u4ee3\u7801\n  plugins:[['@tarojs\/plugin-mini-ci', CIPluginOpt], '@tarojs\/plugin-html', 'taro-plugin-pinia'],\n  }\n}<\/code><\/pre>\n<h5>2.3.1 \u751f\u6210\u914d\u7f6e\u9700\u8981\u7684 toolId<\/h5>\n<p>\u5b89\u88c5\u5de5\u5177<br \/><code>npm install alipay-dev -g<\/code><br \/>\u5de5\u5177\u521d\u59cb\u5316\u914d\u7f6e<\/p>\n<ol>\n<li>\u8fd0\u884c <code>alipaydev key create -w<\/code> \u751f\u6210\u5bc6\u94a5\u3002<br \/><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc3u9Z\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/li>\n<li>\u8fd0\u884c <code>alipaydev key upload<\/code> \u81ea\u52a8\u6253\u5f00\u6d4f\u89c8\u5668\u914d\u7f6e\u9875\u6216\u76f4\u63a5\u524d\u5f80 \u5de5\u5177\u5bc6\u94a5\u8bbe\u7f6e \u9875\u9762\uff0c\u914d\u7f6e\u5de5\u5177\u516c\u94a5\uff08\u7b2c\u4e00\u6b65\u4e2d\u751f\u6210\u7684 \u516c\u94a5\uff09\u4ee5\u53ca\u8bbe\u7f6e IP \u767d\u540d\u5355\uff08\u53ef\u9009\uff09\uff0c\u8bbe\u7f6e\u5b8c\u6210\u540e\u7cfb\u7edf\u4f1a\u4e3a\u60a8\u5206\u914d\u4e00\u4e2a\u5de5\u5177 ID\uff08<code>toolId<\/code>\uff09\u3002<br \/><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc3u9T\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/li>\n<\/ol>\n<h4>2.4 \u914d\u7f6enpm\u6253\u5305+\u4e0a\u4f20\u547d\u4ee4<\/h4>\n<pre><code class=\"json\">    &quot;build:alipay:upload&quot;: &quot;taro build --type alipay --upload&quot;,<\/code><\/pre>\n<ul>\n<li>\u6ca1\u6709\u4fee\u6539\u7248\u672c\u53f7\u7684\u7ed3\u679c<br \/><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc3vck\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/li>\n<li>\u4fee\u6539\u5927\u4e8e\u4e0a\u6b21\u4f53\u9a8c\u7248\u7684\u7ed3\u679c<br \/><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc3vcA\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/li>\n<\/ul>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000042741593\">https:\/\/segmentfault.com\/a\/1190000042741593<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u80cc\u666f\uff1a\u4f7f\u7528taro3\u540c\u65f6\u5f00\u53d1 \u5fae\u4fe1\u5c0f\u7a0b\u5e8f + \u652f\u4ed8\u5b9d\u5c0f\u7a0b\u5e8f\uff1b\u5e38\u89c4\u4e0a\u4f20\u65b9\u5f0f\u4e3a\uff1a\u5728\u672c\u5730\u6253\u5305\u5b8c\u5fae\u4fe1\u4f7f\u7528\u5f00\u53d1\u8005\u5de5\u5177\u4e0a\u4f20 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-10006808","post","type-post","status-publish","format-standard","hentry","category-share"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10006808","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10006808"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10006808\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10006808"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10006808"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10006808"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}