Skip to content

Commit

Permalink
refactor: support windows (apache#1315)
Browse files Browse the repository at this point in the history
  • Loading branch information
SkyeYoung authored Sep 8, 2022
1 parent c1d7b13 commit d118236
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 6 deletions.
14 changes: 14 additions & 0 deletions blog/copy-folder.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { copyDir } from 'hexo-fs';

(async () => {
if (process.argv.length < 4) {
console.error('Usage: node --experimental-modules copy-folder.mjs ...srcDirs tarDir');
process.exit(1);
}

const [, , ...srcDirs] = process.argv;
const tarDir = srcDirs.pop();

await Promise.allSettled(srcDirs.map((srcDir) => copyDir(srcDir, `${tarDir}/${srcDir}`)));
})();
6 changes: 4 additions & 2 deletions blog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
"name": "blog",
"version": "1.0.0",
"scripts": {
"prepare-en": "cp -r src static en",
"prepare-zh": "cp -r src static i18n zh",
"copy-folder": "node --experimental-modules copy-folder.mjs",
"prepare-en": "yarn copy-folder src en",
"prepare-zh": "yarn copy-folder src static i18n zh",
"start:en": "yarn run prepare-en && docusaurus start en",
"start:zh": "yarn run prepare-zh && docusaurus start zh",
"build:en": "yarn run prepare-en && docusaurus build en -l en",
Expand All @@ -24,6 +25,7 @@
"@types/styled-components": "^5.1.24",
"@types/video.js": "^7.3.40",
"babel-plugin-styled-components": "^2.0.6",
"hexo-fs": "^3.1.0",
"stylelint-config-standard-scss": "^4.0.0",
"typescript": "^4.4.2"
},
Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@
"build:doc": "yarn workspace doc build",
"build:blog:zh": "yarn workspace blog build:zh",
"build:blog:en": "yarn workspace blog build:en",
"build:preview": "preview=true yarn run build",
"build:preview": "cross-env preview=true yarn run build",
"build:website:preview": "cross-env preview=true yarn workspace website build",
"build:doc:preview": "cross-env preview=true yarn workspace doc build",
"build:blog:zh:preview": "cross-env preview=true yarn workspace blog build:zh",
"build:blog:en:preview": "cross-env preview=true yarn workspace blog build:en",
"serve": "yarn workspace website docusaurus serve",
"serve:website": "yarn workspace website docusaurus serve",
"serve:doc": "yarn workspace doc docusaurus serve",
Expand All @@ -41,6 +45,7 @@
"@julian_cataldo/remark-lint-frontmatter-schema": "^3.6.2",
"@typescript-eslint/eslint-plugin": "^5.17.0",
"@typescript-eslint/parser": "^5.17.0",
"cross-env": "^7.0.3",
"eslint": "^8.2.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-plugin-import": "^2.25.3",
Expand Down
67 changes: 64 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3703,6 +3703,11 @@ bindings@^1.5.0:
dependencies:
file-uri-to-path "1.0.0"

bluebird@^3.5.1, bluebird@^3.5.2:
version "3.7.2"
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f"
integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==

[email protected]:
version "1.20.0"
resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.0.tgz#3de69bd89011c11573d7bfee6a64f11b6bd27cc5"
Expand Down Expand Up @@ -3884,7 +3889,7 @@ callsites@^3.0.0:
resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73"
integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==

camel-case@^4.1.1, camel-case@^4.1.2:
camel-case@^4.0.0, camel-case@^4.1.1, camel-case@^4.1.2:
version "4.1.2"
resolved "https://registry.yarnpkg.com/camel-case/-/camel-case-4.1.2.tgz#9728072a954f805228225a6deea6b38461e1bd5a"
integrity sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw==
Expand Down Expand Up @@ -4492,14 +4497,21 @@ cosmiconfig@^7.0.0, cosmiconfig@^7.0.1:
path-type "^4.0.0"
yaml "^1.10.0"

cross-env@^7.0.3:
version "7.0.3"
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf"
integrity sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==
dependencies:
cross-spawn "^7.0.1"

cross-fetch@^3.1.5:
version "3.1.5"
resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.5.tgz#e1389f44d9e7ba767907f7af8454787952ab534f"
integrity sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==
dependencies:
node-fetch "2.6.7"

[email protected], cross-spawn@^7.0.2, cross-spawn@^7.0.3:
[email protected], cross-spawn@^7.0.0, cross-spawn@^7.0.1, cross-spawn@^7.0.2, cross-spawn@^7.0.3:
version "7.0.3"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==
Expand Down Expand Up @@ -5027,7 +5039,7 @@ domelementtype@^2.0.1, domelementtype@^2.2.0:
resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-2.3.0.tgz#5c45e8e869952626331d7aab326d01daf65d589d"
integrity sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==

domhandler@^4.0.0, domhandler@^4.2.0, domhandler@^4.3.1:
domhandler@^4.0.0, domhandler@^4.2.0, domhandler@^4.2.2, domhandler@^4.3.1:
version "4.3.1"
resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-4.3.1.tgz#8d792033416f59d68bc03a5aa7b018c1ca89279c"
integrity sha512-GrwoxYN+uWlzO8uhUXRl0P+kHE4GtVPfYzVLcUxPL7KNdHKj66vvlhiweIHqYYXWlw+T8iLMp42Lm67ghw4WMQ==
Expand Down Expand Up @@ -5146,6 +5158,11 @@ entities@^2.0.0:
resolved "https://registry.yarnpkg.com/entities/-/entities-2.2.0.tgz#098dc90ebb83d8dffa089d55256b351d34c4da55"
integrity sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==

entities@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/entities/-/entities-3.0.1.tgz#2b887ca62585e96db3903482d336c1006c3001d4"
integrity sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q==

errno@^0.1.3:
version "0.1.8"
resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.8.tgz#8bb3e9c7d463be4976ff888f76b4809ebc2e811f"
Expand Down Expand Up @@ -6465,6 +6482,35 @@ header-case@^2.0.4:
capital-case "^1.0.4"
tslib "^2.0.3"

hexo-fs@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/hexo-fs/-/hexo-fs-3.1.0.tgz#2052ff72c68cda2c577a87aa0ea7980ae503fa99"
integrity sha512-SfoDH7zlU9Iop+bAfEONXezbNIkpVX1QqjNCBYpapilZR+xVOCfTEdlNixanrKBbLGPb2fXqrdDBFgrKuiVGQQ==
dependencies:
bluebird "^3.5.1"
chokidar "^3.0.0"
graceful-fs "^4.1.11"
hexo-util "^2.0.0"

hexo-util@^2.0.0:
version "2.7.0"
resolved "https://registry.yarnpkg.com/hexo-util/-/hexo-util-2.7.0.tgz#13d09292e79d260db35399710b3e19f3995443a3"
integrity sha512-hQM3h34nhDg0bSe/Tg1lnpODvNkz7h2u0+lZGzlKL0Oufp+5KCAEUX9wal7/xC7ax3/cwEn8IuoU75kNpZLpJQ==
dependencies:
bluebird "^3.5.2"
camel-case "^4.0.0"
cross-spawn "^7.0.0"
deepmerge "^4.2.2"
highlight.js "^11.0.1"
htmlparser2 "^7.0.0"
prismjs "^1.17.1"
strip-indent "^3.0.0"

highlight.js@^11.0.1:
version "11.6.0"
resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-11.6.0.tgz#a50e9da05763f1bb0c1322c8f4f755242cff3f5a"
integrity sha512-ig1eqDzJaB0pqEvlPVIpSSyMaO92bH1N2rJpLMN/nX396wTpDA4Eq0uK+7I/2XG17pFaaKE0kjV/XPeGt7Evjw==

history@^4.9.0:
version "4.10.1"
resolved "https://registry.yarnpkg.com/history/-/history-4.10.1.tgz#33371a65e3a83b267434e2b3f3b1b4c58aad4cf3"
Expand Down Expand Up @@ -6568,6 +6614,16 @@ htmlparser2@^6.1.0:
domutils "^2.5.2"
entities "^2.0.0"

htmlparser2@^7.0.0:
version "7.2.0"
resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-7.2.0.tgz#8817cdea38bbc324392a90b1990908e81a65f5a5"
integrity sha512-H7MImA4MS6cw7nbyURtLPO1Tms7C5H602LRETv95z1MxO/7CP7rDVROehUYeYBUYEON94NXXDEPmZuq+hX4sog==
dependencies:
domelementtype "^2.0.1"
domhandler "^4.2.2"
domutils "^2.8.0"
entities "^3.0.1"

http-cache-semantics@^4.0.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz#49e91c5cbf36c9b94bcfcd71c23d5249ec74e390"
Expand Down Expand Up @@ -9592,6 +9648,11 @@ prism-react-renderer@^1.2.1:
resolved "https://registry.yarnpkg.com/prism-react-renderer/-/prism-react-renderer-1.3.5.tgz#786bb69aa6f73c32ba1ee813fbe17a0115435085"
integrity sha512-IJ+MSwBWKG+SM3b2SUfdrhC+gu01QkV2KmRQgREThBfSQRoufqRfxfHUxpG1WcaFjP+kojcFyO9Qqtpgt3qLCg==

prismjs@^1.17.1:
version "1.29.0"
resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.29.0.tgz#f113555a8fa9b57c35e637bba27509dcf802dd12"
integrity sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q==

prismjs@^1.23.0:
version "1.28.0"
resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.28.0.tgz#0d8f561fa0f7cf6ebca901747828b149147044b6"
Expand Down

0 comments on commit d118236

Please sign in to comment.