{"id":2359,"date":"2022-08-15T10:25:48","date_gmt":"2022-08-15T02:25:48","guid":{"rendered":"https:\/\/199604.com\/?p=2359"},"modified":"2022-08-15T10:25:48","modified_gmt":"2022-08-15T02:25:48","slug":"npm-run-all-%e7%ae%80%e5%8d%95%e4%bd%bf%e7%94%a8","status":"publish","type":"post","link":"https:\/\/199604.com\/2359","title":{"rendered":"npm-run-all \u7b80\u5355\u4f7f\u7528"},"content":{"rendered":"<h1>npm-run-all \u7b80\u5355\u4f7f\u7528<\/h1>\n<p>\u6700\u8fd1\u65b0\u9879\u76ee\u53d1\u73b0\u524d\u7aef\u7814\u53d1\u516c\u53f8\u5f00\u59cb\u4f7f\u7528<a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/link.juejin.cn?target=https%3A%2F%2Fgithub.com%2Fmysticatea%2Fnpm-run-all\">mysticatea\/npm-run-all<\/a> \u8fd9\u4e2a\u795e\u5668\uff0c\u8fd9\u4e2a\u5de5\u5177\u662f\u4e3a\u4e86\u89e3\u51b3\u5b98\u65b9\u7684 <code>npm run<\/code> \u547d\u4ee4\u65e0\u6cd5\u540c\u65f6\u8fd0\u884c\u591a\u4e2a\u811a\u672c\u7684\u95ee\u9898\uff0c\u5b83\u53ef\u4ee5\u628a\u8bf8\u5982 <code>npm run clean &amp;&amp; npm run build:css &amp;&amp; npm run build:js &amp;&amp; npm run build:html<\/code> \u7684\u4e00\u957f\u4e32\u7684\u547d\u4ee4\u901a\u8fc7 glob \u8bed\u6cd5\u7b80\u5316\u6210 <code>npm-run-all clean build:*<\/code> \u8fd9\u6837\u7cbe\u81f4\u5c0f\u5de7\u7684\u6a21\u6837\u3002\u518d\u8005\u5927\u5bb6\u4e5f\u77e5\u9053 shell \u7684 <code>&amp;<\/code> \u8bed\u6cd5\u5b9e\u9645\u4e0a\u662f\u4e0d\u652f\u6301 cmd \u7684\uff0c\u4e3a\u4e86\u8de8\u5e73\u53f0\u4e5f\u6700\u597d\u4f7f\u7528\u8fd9\u6837\u7684\u7b2c\u4e09\u65b9\u5e93\u6765\u63d0\u4f9b\u652f\u6301\u3002<\/p>\n<h2>\u5b89\u88c5<\/h2>\n<pre><code class=\"language-shell \">$ npm install npm-run-all --save-dev\n# \u6216\u8005\n$ yarn add npm-run-all --dev\n<\/code><\/pre>\n<h2>\u987a\u5e8f\u6267\u884c<\/h2>\n<pre><code class=\"language-shell \">$ npm-run-all clean lint build\n<\/code><\/pre>\n<p>\u4f9d\u6b21\u6267\u884c\u4e09\u4e2a\u4efb\u52a1\uff0c\u6ce8\u610f\u5982\u679c\u67d0\u4e2a\u811a\u672c\u9000\u51fa\u65f6\u8fd4\u56de\u503c\u4e3a\u7a7a\u503c\uff0c\u90a3\u4e48\u540e\u7eed\u811a\u672c\u9ed8\u8ba4\u662f\u4e0d\u4f1a\u6267\u884c\u7684\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u53c2\u6570 <code>--continue-on-error<\/code> \u6765\u89c4\u907f\u8fd9\u79cd\u884c\u4e3a\u3002<\/p>\n<h2>\u5e76\u884c\u6267\u884c<\/h2>\n<pre><code class=\"language-shell \">$ npm-run-all --parallel lint build\n<\/code><\/pre>\n<p><code>npm-run-all<\/code> \u63d0\u4f9b\u4e86\u591a\u79cd\u8fd0\u884c\u591a\u4e2a\u547d\u4ee4\u7684\u65b9\u5f0f\uff0c\u5e38\u7528\u7684\u6709\u4ee5\u4e0b\u51e0\u4e2a\uff1a<\/p>\n<pre><code class=\"language-shell \">--parallel: \u5e76\u884c\u8fd0\u884c\u591a\u4e2a\u547d\u4ee4\uff0c\u4f8b\u5982\uff1anpm-run-all --parallel lint build\n--serial: \u591a\u4e2a\u547d\u4ee4\u6309\u6392\u5217\u987a\u5e8f\u6267\u884c\uff0c\u4f8b\u5982\uff1anpm-run-all --serial clean lint build:**\n--continue-on-error: \u662f\u5426\u5ffd\u7565\u9519\u8bef\uff0c\u6dfb\u52a0\u6b64\u53c2\u6570 npm-run-all \u4f1a\u81ea\u52a8\u9000\u51fa\u51fa\u9519\u7684\u547d\u4ee4\uff0c\u7ee7\u7eed\u8fd0\u884c\u6b63\u5e38\u7684\n--race: \u6dfb\u52a0\u6b64\u53c2\u6570\u4e4b\u540e\uff0c\u53ea\u8981\u6709\u4e00\u4e2a\u547d\u4ee4\u8fd0\u884c\u51fa\u9519\uff0c\u90a3\u4e48 npm-run-all \u5c31\u4f1a\u7ed3\u675f\u6389\u5168\u90e8\u7684\u547d\u4ee4\n<\/code><\/pre>\n<p>\u7ed3\u5408<code>package.json<\/code>\u5373\u53ef\u5feb\u901f\u591a\u7ebf\u7a0b\u6253\u5305<\/p>\n<pre><code class=\"language-json \">{\n  \"name\": \"xinsec-iot\",\n  \"version\": \"4.1.0\",\n  \"description\": \"vite + qiankun + vue3\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"install\": \"npm-run-all --parallel install:*\",\n    \"install:main\": \"cd .\/main &amp;&amp; npm install\",\n    \"install:sys\": \"cd .\/application\/sys &amp;&amp; npm install\",\n    \"install:assets\": \"cd .\/application\/assets &amp;&amp; npm install\",\n    \"install:baby\": \"cd .\/application\/baby &amp;&amp; npm install\",\n    \"serve\": \"npm-run-all --parallel start:*\",\n    \"start:main\": \"cd .\/main &amp;&amp; npm run dev\",\n    \"start:sys\": \"cd .\/application\/sys &amp;&amp; npm run dev\",\n    \"start:assets\": \"cd .\/application\/assets &amp;&amp; npm run dev\",\n    \"start:baby\": \"cd .\/application\/baby &amp;&amp; npm run dev\",\n    \"build\": \"npm-run-all --parallel build:*\",\n    \"build:main\": \"cd .\/main &amp;&amp; npm run build\",\n    \"build:sys\": \"cd .\/application\/sys &amp;&amp; npm run build\",\n    \"build:assets\": \"cd .\/application\/assets &amp;&amp; npm run build\",\n    \"build:baby\": \"cd .\/application\/baby &amp;&amp; npm run build\"\n  },\n  \"license\": \"ISC\",\n  \"devDependencies\": {\n    \"npm-run-all\": \"^4.1.5\"\n  }\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>npm-run-all \u7b80\u5355\u4f7f\u7528 \u6700\u8fd1\u65b0\u9879\u76ee\u53d1\u73b0\u524d\u7aef\u7814\u53d1\u516c\u53f8\u5f00\u59cb\u4f7f\u7528mysticatea\/npm-run-al [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[404,342,305],"tags":[406,405],"class_list":["post-2359","post","type-post","status-publish","format-standard","hentry","category-npm","category-vue","category-yaml","tag-npm","tag-npm-run-all"],"_links":{"self":[{"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/posts\/2359","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/comments?post=2359"}],"version-history":[{"count":1,"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/posts\/2359\/revisions"}],"predecessor-version":[{"id":2360,"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/posts\/2359\/revisions\/2360"}],"wp:attachment":[{"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/media?parent=2359"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/categories?post=2359"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/tags?post=2359"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}