diff --git a/docs/.vuepress/public/assets/6d308bd9gw1f5scrp1p4rj20rs0gatbj.jpg b/docs/.vuepress/public/assets/6d308bd9gw1f5scrp1p4rj20rs0gatbj.jpg new file mode 100644 index 0000000..661ad4b Binary files /dev/null and b/docs/.vuepress/public/assets/6d308bd9gw1f5scrp1p4rj20rs0gatbj.jpg differ diff --git a/docs/.vuepress/public/assets/6d308bd9gy1ft3id6gbmej21kw12r7hb.jpg b/docs/.vuepress/public/assets/6d308bd9gy1ft3id6gbmej21kw12r7hb.jpg new file mode 100644 index 0000000..19d48a3 Binary files /dev/null and b/docs/.vuepress/public/assets/6d308bd9gy1ft3id6gbmej21kw12r7hb.jpg differ diff --git a/docs/.vuepress/public/assets/6d308bd9gy1ft3id6n0ajj21kw12rduv.jpg b/docs/.vuepress/public/assets/6d308bd9gy1ft3id6n0ajj21kw12rduv.jpg new file mode 100644 index 0000000..600a459 Binary files /dev/null and b/docs/.vuepress/public/assets/6d308bd9gy1ft3id6n0ajj21kw12rduv.jpg differ diff --git a/docs/.vuepress/public/assets/6d308bd9gy1ft3jq4frzjj21kw10nqek.jpg b/docs/.vuepress/public/assets/6d308bd9gy1ft3jq4frzjj21kw10nqek.jpg new file mode 100644 index 0000000..526712f Binary files /dev/null and b/docs/.vuepress/public/assets/6d308bd9gy1ft3jq4frzjj21kw10nqek.jpg differ diff --git a/docs/.vuepress/public/assets/6d308bd9gy1ft3jw0q7o0j21kw10ndql.jpg b/docs/.vuepress/public/assets/6d308bd9gy1ft3jw0q7o0j21kw10ndql.jpg new file mode 100644 index 0000000..e2b3a08 Binary files /dev/null and b/docs/.vuepress/public/assets/6d308bd9gy1ft3jw0q7o0j21kw10ndql.jpg differ diff --git a/docs/.vuepress/public/assets/6d308bd9gy1ft3jw2iloqj21kw10nguj.jpg b/docs/.vuepress/public/assets/6d308bd9gy1ft3jw2iloqj21kw10nguj.jpg new file mode 100644 index 0000000..041a966 Binary files /dev/null and b/docs/.vuepress/public/assets/6d308bd9gy1ft3jw2iloqj21kw10nguj.jpg differ diff --git a/docs/.vuepress/public/assets/6d308bd9gy1ft3jw318grj21kw10nwp4.jpg b/docs/.vuepress/public/assets/6d308bd9gy1ft3jw318grj21kw10nwp4.jpg new file mode 100644 index 0000000..9210caa Binary files /dev/null and b/docs/.vuepress/public/assets/6d308bd9gy1ft3jw318grj21kw10nwp4.jpg differ diff --git a/docs/.vuepress/public/assets/6d308bd9gy1ft3jw32rz0j21kw10ntma.jpg b/docs/.vuepress/public/assets/6d308bd9gy1ft3jw32rz0j21kw10ntma.jpg new file mode 100644 index 0000000..78a574b Binary files /dev/null and b/docs/.vuepress/public/assets/6d308bd9gy1ft3jw32rz0j21kw10ntma.jpg differ diff --git a/docs/.vuepress/public/assets/6d308bd9gy1ft3nqbd9e3j21kw0xx45p.jpg b/docs/.vuepress/public/assets/6d308bd9gy1ft3nqbd9e3j21kw0xx45p.jpg new file mode 100644 index 0000000..d28557e Binary files /dev/null and b/docs/.vuepress/public/assets/6d308bd9gy1ft3nqbd9e3j21kw0xx45p.jpg differ diff --git a/docs/.vuepress/public/assets/6d308bd9gy1ft3nqbgjesj21kw0xx7ee.jpg b/docs/.vuepress/public/assets/6d308bd9gy1ft3nqbgjesj21kw0xx7ee.jpg new file mode 100644 index 0000000..5b29e79 Binary files /dev/null and b/docs/.vuepress/public/assets/6d308bd9gy1ft3nqbgjesj21kw0xx7ee.jpg differ diff --git a/docs/.vuepress/public/assets/6d308bd9gy1ft3nqbnft5j21kw0xxaq1.jpg b/docs/.vuepress/public/assets/6d308bd9gy1ft3nqbnft5j21kw0xxaq1.jpg new file mode 100644 index 0000000..79b888e Binary files /dev/null and b/docs/.vuepress/public/assets/6d308bd9gy1ft3nqbnft5j21kw0xxaq1.jpg differ diff --git a/docs/.vuepress/public/assets/6d308bd9gy1ft3nqcab4vj21kw0xxwn0.jpg b/docs/.vuepress/public/assets/6d308bd9gy1ft3nqcab4vj21kw0xxwn0.jpg new file mode 100644 index 0000000..9ac528c Binary files /dev/null and b/docs/.vuepress/public/assets/6d308bd9gy1ft3nqcab4vj21kw0xxwn0.jpg differ diff --git a/docs/.vuepress/public/assets/6d308bd9gy1ft3nqcmte5j21kw0xxdm6.jpg b/docs/.vuepress/public/assets/6d308bd9gy1ft3nqcmte5j21kw0xxdm6.jpg new file mode 100644 index 0000000..8e40f8a Binary files /dev/null and b/docs/.vuepress/public/assets/6d308bd9gy1ft3nqcmte5j21kw0xxdm6.jpg differ diff --git a/docs/.vuepress/public/assets/6d308bd9gy1ft3nqcraoij21kw0xxjyt.jpg b/docs/.vuepress/public/assets/6d308bd9gy1ft3nqcraoij21kw0xxjyt.jpg new file mode 100644 index 0000000..04c2a40 Binary files /dev/null and b/docs/.vuepress/public/assets/6d308bd9gy1ft3nqcraoij21kw0xxjyt.jpg differ diff --git a/docs/.vuepress/public/assets/6d308bd9gy1ft3nqd3c7fj21kw0xxqcj.jpg b/docs/.vuepress/public/assets/6d308bd9gy1ft3nqd3c7fj21kw0xxqcj.jpg new file mode 100644 index 0000000..617c1a5 Binary files /dev/null and b/docs/.vuepress/public/assets/6d308bd9gy1ft3nqd3c7fj21kw0xxqcj.jpg differ diff --git a/docs/.vuepress/public/assets/6d308bd9gy1ftc27nq3rsj21kw12j7if.jpg b/docs/.vuepress/public/assets/6d308bd9gy1ftc27nq3rsj21kw12j7if.jpg new file mode 100644 index 0000000..06bd1af Binary files /dev/null and b/docs/.vuepress/public/assets/6d308bd9gy1ftc27nq3rsj21kw12j7if.jpg differ diff --git a/docs/.vuepress/public/assets/6d308bd9gy1ftc27pr7xuj21kw128gzp.jpg b/docs/.vuepress/public/assets/6d308bd9gy1ftc27pr7xuj21kw128gzp.jpg new file mode 100644 index 0000000..f52ba87 Binary files /dev/null and b/docs/.vuepress/public/assets/6d308bd9gy1ftc27pr7xuj21kw128gzp.jpg differ diff --git a/docs/.vuepress/public/assets/6d308bd9gy1ftc27q3vd3j21kw128tpk.jpg b/docs/.vuepress/public/assets/6d308bd9gy1ftc27q3vd3j21kw128tpk.jpg new file mode 100644 index 0000000..eabb874 Binary files /dev/null and b/docs/.vuepress/public/assets/6d308bd9gy1ftc27q3vd3j21kw128tpk.jpg differ diff --git a/docs/.vuepress/public/assets/6d308bd9gy1ftc4y26xzaj21kw10g12f.jpg b/docs/.vuepress/public/assets/6d308bd9gy1ftc4y26xzaj21kw10g12f.jpg new file mode 100644 index 0000000..e64d79e Binary files /dev/null and b/docs/.vuepress/public/assets/6d308bd9gy1ftc4y26xzaj21kw10g12f.jpg differ diff --git a/docs/.vuepress/public/assets/6d308bd9gy1ftc4y31cf5j21kw10g7kz.jpg b/docs/.vuepress/public/assets/6d308bd9gy1ftc4y31cf5j21kw10g7kz.jpg new file mode 100644 index 0000000..c48bbe8 Binary files /dev/null and b/docs/.vuepress/public/assets/6d308bd9gy1ftc4y31cf5j21kw10g7kz.jpg differ diff --git a/docs/.vuepress/public/assets/6d308bd9ly1ft2p8qmlazj21kw15ztol.jpg b/docs/.vuepress/public/assets/6d308bd9ly1ft2p8qmlazj21kw15ztol.jpg new file mode 100644 index 0000000..1b1f2c8 Binary files /dev/null and b/docs/.vuepress/public/assets/6d308bd9ly1ft2p8qmlazj21kw15ztol.jpg differ diff --git a/docs/.vuepress/public/assets/6d308bd9ly1ft2panw2oqj21kw15znaj.jpg b/docs/.vuepress/public/assets/6d308bd9ly1ft2panw2oqj21kw15znaj.jpg new file mode 100644 index 0000000..d39c15f Binary files /dev/null and b/docs/.vuepress/public/assets/6d308bd9ly1ft2panw2oqj21kw15znaj.jpg differ diff --git a/docs/.vuepress/public/assets/6d308bd9ly1ft2peam690j21kw15ztl8.jpg b/docs/.vuepress/public/assets/6d308bd9ly1ft2peam690j21kw15ztl8.jpg new file mode 100644 index 0000000..2e893fb Binary files /dev/null and b/docs/.vuepress/public/assets/6d308bd9ly1ft2peam690j21kw15ztl8.jpg differ diff --git a/docs/.vuepress/public/assets/6d308bd9ly1ft2plz2djxj21kw16pk5j.jpg b/docs/.vuepress/public/assets/6d308bd9ly1ft2plz2djxj21kw16pk5j.jpg new file mode 100644 index 0000000..b964290 Binary files /dev/null and b/docs/.vuepress/public/assets/6d308bd9ly1ft2plz2djxj21kw16pk5j.jpg differ diff --git a/docs/.vuepress/public/assets/6d308bd9ly1ft2pvmld7dj21kw148wn3.jpg b/docs/.vuepress/public/assets/6d308bd9ly1ft2pvmld7dj21kw148wn3.jpg new file mode 100644 index 0000000..55165cd Binary files /dev/null and b/docs/.vuepress/public/assets/6d308bd9ly1ft2pvmld7dj21kw148wn3.jpg differ diff --git a/docs/.vuepress/public/assets/6d308bd9ly1ft2pvmlnkij21kw148dph.jpg b/docs/.vuepress/public/assets/6d308bd9ly1ft2pvmlnkij21kw148dph.jpg new file mode 100644 index 0000000..dd1c324 Binary files /dev/null and b/docs/.vuepress/public/assets/6d308bd9ly1ft2pvmlnkij21kw148dph.jpg differ diff --git a/docs/.vuepress/public/assets/6d308bd9ly1ft2pvmlz1hj21kw148tl3.jpg b/docs/.vuepress/public/assets/6d308bd9ly1ft2pvmlz1hj21kw148tl3.jpg new file mode 100644 index 0000000..1df861f Binary files /dev/null and b/docs/.vuepress/public/assets/6d308bd9ly1ft2pvmlz1hj21kw148tl3.jpg differ diff --git a/docs/.vuepress/public/assets/6d308bd9ly1ft2pvmmewxj21kw14849j.jpg b/docs/.vuepress/public/assets/6d308bd9ly1ft2pvmmewxj21kw14849j.jpg new file mode 100644 index 0000000..b66d00c Binary files /dev/null and b/docs/.vuepress/public/assets/6d308bd9ly1ft2pvmmewxj21kw14849j.jpg differ diff --git a/docs/.vuepress/public/assets/6d308bd9ly1fz3wii2wqsj21bh0u0qij.jpg b/docs/.vuepress/public/assets/6d308bd9ly1fz3wii2wqsj21bh0u0qij.jpg new file mode 100644 index 0000000..10ff365 Binary files /dev/null and b/docs/.vuepress/public/assets/6d308bd9ly1fz3wii2wqsj21bh0u0qij.jpg differ diff --git a/docs/README.md b/docs/README.md index ba3d6b4..a745322 100644 --- a/docs/README.md +++ b/docs/README.md @@ -19,4 +19,4 @@ footer: MIT Licensed | Copyright © 2015-present Macaca Reliable is suitable for working with existing R&D processes in the continuous integration phase, and can also be used independently. ::: -![](https://wx3.sinaimg.cn/large/6d308bd9ly1fz3wii2wqsj21bh0u0qij.jpg) +![](/reliable/assets/6d308bd9ly1fz3wii2wqsj21bh0u0qij.jpg) diff --git a/docs/guide/README.md b/docs/guide/README.md index 081c3e2..fe129fb 100644 --- a/docs/guide/README.md +++ b/docs/guide/README.md @@ -6,4 +6,4 @@ Reliable is Macaca's continuous delivery service suite that provides test pass r Reliable supports one-click deployment, quickly has your own test management platform. ::: -![](http://ww2.sinaimg.cn/large/6d308bd9gw1f5scrp1p4rj20rs0gatbj.jpg) +![](/reliable/assets/6d308bd9gw1f5scrp1p4rj20rs0gatbj.jpg) diff --git a/docs/guide/jenkins-android.md b/docs/guide/jenkins-android.md index 9cc6aa0..acc315e 100644 --- a/docs/guide/jenkins-android.md +++ b/docs/guide/jenkins-android.md @@ -27,13 +27,13 @@ Just like reliable-web, we recommend to build Android with Docker. Create a new item named `android-app-bootstrap`, and select the `Freestyle project` mode.
- +
### Step2 - SCM Config
- +
Please input the `android-app-bootstrap` git url, and set the clone depth to `1`, branch to `master` is ok. @@ -45,7 +45,7 @@ https://github.com/app-bootstrap/android-app-bootstrap.git ### Step3 - Build Scripts Config
- +
**Noted** @@ -53,7 +53,7 @@ https://github.com/app-bootstrap/android-app-bootstrap.git - please confirm jenkins delete the workspace before build to avoid the old middle-file problem.
- +
We provide the Android build docker like `macacajs/macaca-android-build-docker`, so you can set the feild content like this: @@ -93,25 +93,25 @@ npm ERR! Exit status 1 ### Step4 - Build Now
- +
After the building ready, you can get the final result from reliable-web.
- +
We cat get the `debug` and `relese` package of the `android-app-bootstrap`.
- +
Scan the QRCode, you can download and install it with your device.
- +
You can also get other extra build infomation. If you want more, please tweak the [reliable-cli#configuration](//github.com/macacajs/reliable-cli#configuration) file. diff --git a/docs/guide/jenkins-ios.md b/docs/guide/jenkins-ios.md index f78fc83..45509b4 100644 --- a/docs/guide/jenkins-ios.md +++ b/docs/guide/jenkins-ios.md @@ -26,13 +26,13 @@ There are two sample projects, one for publish app and the other for publish pri Create a new item named `ios-app-bootstrap`, and select the `Freestyle project` mode.
- +
### Step2 - SCM Config
- +
Please input the `ios-app-bootstrap` git url, and set the clone depth to `1`, branch to `master` is ok. @@ -44,7 +44,7 @@ https://github.com/app-bootstrap/ios-app-bootstrap.git ### Step3 - Build Scripts Config
- +
``` @@ -72,25 +72,25 @@ npm ERR! Exit status 1 ### Step4 - Build Now
- +
After the building ready, you can get the final result from reliable-web.
- +
We cat get the `debug` package of the `ios-app-bootstrap`.
- +
Scan the QRCode, you can download and install it with your device.
- +
You can also get other extra build infomation. If you want more, please tweak the [reliable-cli#configuration](//github.com/macacajs/reliable-cli#configuration) file. @@ -100,9 +100,9 @@ You can also get other extra build infomation. If you want more, please tweak th Reliable support the Unit and E2E test reporter, coverage based on Macaca is supported.
- +
- +
diff --git a/docs/guide/jenkins-web.md b/docs/guide/jenkins-web.md index 6f389d3..7859508 100644 --- a/docs/guide/jenkins-web.md +++ b/docs/guide/jenkins-web.md @@ -19,13 +19,13 @@ Just like reliable-web, we recommend to build web with Docker. Create a new item named `web-app-bootstrap`, and select the `Freestyle project` mode.
- +
### Step2 - SCM Config
- +
Please input the `web-app-bootstrap` git url, and set the clone depth to `1`, branch to `master` is ok. @@ -41,7 +41,7 @@ https://github.com/app-bootstrap/web-app-bootstrap.git - please confirm jenkins delete the workspace before build to avoid the old middle-file problem.
- +
We provide the webpack build docker like `macacajs/macaca-electron-docker`, so you can set the feild content like this: @@ -82,13 +82,13 @@ npm ERR! Exit status 1 After the building ready, you can get the final result from reliable-web.
- +
We cat get the build results of the `web-app-bootstrap`.
- +
You can also get other extra build infomation. If you want more, please tweak the [reliable-cli#configuration](//github.com/macacajs/reliable-cli#configuration) file. @@ -98,21 +98,21 @@ You can also get other extra build infomation. If you want more, please tweak th Reliable support the Unit and E2E test reporter, coverage based on Macaca is supported.
- +
- +
- +
- +
- +
diff --git a/docs/zh/README.md b/docs/zh/README.md index c2f4d5b..e0e9523 100644 --- a/docs/zh/README.md +++ b/docs/zh/README.md @@ -19,4 +19,4 @@ footer: MIT Licensed | Copyright © 2015-present Macaca Reliable 适合在持续集成阶段与现有研发流程打通和衔接,当然也可以独立使用。 ::: -![](https://wx3.sinaimg.cn/large/6d308bd9ly1fz3wii2wqsj21bh0u0qij.jpg) +![](/reliable/assets/6d308bd9ly1fz3wii2wqsj21bh0u0qij.jpg) diff --git a/docs/zh/guide/README.md b/docs/zh/guide/README.md index f86be34..dcada0b 100644 --- a/docs/zh/guide/README.md +++ b/docs/zh/guide/README.md @@ -6,4 +6,4 @@ Reliable 是 Macaca 的持续交付服务套件,提供测试通过率、覆盖 Reliable 一键部署,拥有自己的测试管理平台。 ::: -![](http://ww2.sinaimg.cn/large/6d308bd9gw1f5scrp1p4rj20rs0gatbj.jpg) +![](/reliable/assets/6d308bd9gw1f5scrp1p4rj20rs0gatbj.jpg) diff --git a/docs/zh/guide/jenkins-android.md b/docs/zh/guide/jenkins-android.md index 9f5a48f..d533787 100644 --- a/docs/zh/guide/jenkins-android.md +++ b/docs/zh/guide/jenkins-android.md @@ -27,13 +27,13 @@ $ mkdir $HOME/reliable_home/gradle_cache 创建一个项目名为 `android-app-bootstrap`,并且选择自由风格模式。
- +
### 第2步 - SCM 配置
- +
输入项目的 git 地址,并且选择克隆深度为 1,分支为 `master`。 @@ -45,7 +45,7 @@ https://github.com/app-bootstrap/android-app-bootstrap.git ### 第3步 - 构建脚本配置
- +
**注意** @@ -53,7 +53,7 @@ https://github.com/app-bootstrap/android-app-bootstrap.git - 请确保勾选构建前删除运行空间,以排除老的中间文件造成的问题。
- +
我们提供 Android 构建 Docker 镜像 `macacajs/macaca-android-build-docker`,你可以设置如下: @@ -93,25 +93,25 @@ npm ERR! Exit status 1 ### 第4步 - 理解构建
- +
构建结束后,你可以在 reliable web 平台获得构建结果。
- +
比如我们能够获得 `android-app-bootstrap` 的 `debug` 类型包和 `release` 类型包。
- +
Reliable 平台也支持扫码下载安装等实用功能。
- +
我们也可以获得项目配置,版本等额外信息。如果需要更多上报信息可以参考上报脚本文档 [reliable-cli#configuration](//github.com/macacajs/reliable-cli#configuration)。 diff --git a/docs/zh/guide/jenkins-ios.md b/docs/zh/guide/jenkins-ios.md index e70ef22..469f12f 100644 --- a/docs/zh/guide/jenkins-ios.md +++ b/docs/zh/guide/jenkins-ios.md @@ -26,13 +26,13 @@ $ curl -fsSL https://github.com/macacajs/reliable-ios/files/2114440/Makefile.txt 创建一个项目名为 `ios-app-bootstrap`,并且选择自由风格模式。
- +
### 第2步 - SCM 配置
- +
输入项目的 git 地址,并且选择克隆深度为 1,分支为 `master`。 @@ -44,7 +44,7 @@ https://github.com/app-bootstrap/ios-app-bootstrap.git ### 第3步 - 构建脚本配置
- +
``` @@ -72,25 +72,25 @@ npm ERR! Exit status 1 ### 第4步 - 立即构建
- +
构建结束后,你可以在 reliable web 平台获得构建结果。
- +
比如我们能够获得 `ios-app-bootstrap` 的 `debug` 类型包。
- +
Reliable 平台也支持扫码下载安装等实用功能。
- +
我们也可以获得项目配置,版本等额外信息。如果需要更多上报信息可以参考上报脚本文档 [reliable-cli#configuration](//github.com/macacajs/reliable-cli#configuration)。 @@ -100,9 +100,9 @@ Reliable 平台也支持扫码下载安装等实用功能。 Reliable 无缝集成 Macaca 自动化测试工具,支持通过率报告,端到端链路刻画,覆盖率等质量覆盖方案。
- +
- +
diff --git a/docs/zh/guide/jenkins-web.md b/docs/zh/guide/jenkins-web.md index 01cbba6..d985fa2 100644 --- a/docs/zh/guide/jenkins-web.md +++ b/docs/zh/guide/jenkins-web.md @@ -19,13 +19,13 @@ Create a new item named `web-app-bootstrap`, and select the `Freestyle project` mode.
- +
### 第2步 - SCM 配置
- +
Please input the `web-app-bootstrap` git url, and set the clone depth to `1`, branch to `master` is ok. @@ -41,7 +41,7 @@ https://github.com/app-bootstrap/web-app-bootstrap.git - 请确保勾选构建前删除运行空间,以排除老的中间文件造成的问题。
- +
我们提供 Web 构建 Docker 镜像 `macacajs/macaca-electron-docker`,你可以设置如下: @@ -82,13 +82,13 @@ npm ERR! Exit status 1 构建结束后,你可以在 reliable web 平台获得构建结果。
- +
We cat get the build results of the `web-app-bootstrap`.
- +
我们也可以获得项目配置,版本等额外信息。如果需要更多上报信息可以参考上报脚本文档 [reliable-cli#configuration](//github.com/macacajs/reliable-cli#configuration)。 @@ -98,21 +98,21 @@ We cat get the build results of the `web-app-bootstrap`. Reliable 无缝集成 Macaca 自动化测试工具,支持通过率报告,端到端链路刻画,覆盖率等质量覆盖方案。
- +
- +
- +
- +
- +
diff --git a/package.json b/package.json index a4b9bff..b449334 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "husky": "^1.3.1", "macaca-ecosystem": "*", "mysql2": "^1.6.4", + "request": "^2.88.0", "sinon": "^6.1.4", "uuid": "^3.3.2", "vuepress": "^0.14.8" diff --git a/scripts/replace-image.js b/scripts/replace-image.js new file mode 100644 index 0000000..2d206c7 --- /dev/null +++ b/scripts/replace-image.js @@ -0,0 +1,76 @@ +var fs = require('fs'); +var path = require('path'); +var request = require('request'); + +var download = function(uri, filename, callback) { + request.head(uri, function(err, res, body) { + console.log(uri); + console.log('content-type:', res.headers['content-type']); + console.log('content-length:', res.headers['content-length']); + + request(uri) + .pipe(fs.createWriteStream(filename)) + .on('close', callback); + }); +}; + +const prefix = '/reliable'; + +// List all files in a directory in Node.js recursively in a synchronous fashion +const walkSync = function(dir, fileList) { + var fs = fs || require('fs'), + files = fs.readdirSync(dir); + fileList = fileList || []; + files.forEach(function(file) { + if (fs.statSync(dir + file).isDirectory()) { + fileList = walkSync(dir + file + '/', fileList); + } else { + fileList.push(path.join(dir, file)); + } + }); + return fileList; +}; + +if (process.argv.length <= 2) { + console.log('Usage: ' + __filename + ' path/to/directory'); + process.exit(-1); +} + +var targetPath = process.argv[2]; + +const fileList = walkSync(targetPath, []); +const mdList = fileList.filter(file => file.endsWith('.md')); + +function replacer(match, p1, p2, p3, p4, p5, p6, p7, offset, string) { + console.log(p1, p2, p3, p4, p5, p6, p7, match); + download( + match.startsWith('//') ? 'https:' + match : match, + './docs/.vuepress/public/assets/' + [p6, p7].join('.'), + function() { + console.log(match + ' done'); + } + ); + return prefix + '/assets/' + [p6, p7].join('.'); +} + +mdList.forEach(file => { + fs.readFile(file, 'utf8', function(err, data) { + if (err) { + return console.log(err); + } + // console.log(data); + console.log(file); + const matchRes = data.match( + /(http(s?):)*\/\/([/.\w\s-])*(sinaimg\.cn\/)(large|square)\/([\w]*)\.(jpg|gif|png)/g + ); + // console.log(matchRes); + var result = data.replace( + /(http(s?):)*\/\/([/.\w\s-])*(sinaimg\.cn\/)(large|square)\/([\w]*)\.(jpg|gif|png)/g, + replacer + ); + console.log(result); + fs.writeFile(file, result, 'utf8', function(err) { + if (err) return console.log(err); + }); + }); +});