From 423664caa637bf66bcd2b38c4ccc6ecbed58ddd1 Mon Sep 17 00:00:00 2001 From: lencx Date: Sat, 10 Dec 2022 12:18:35 +0800 Subject: [PATCH] chore: download --- README.md | 4 ++++ package.json | 1 + scripts/download.js | 30 ++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 scripts/download.js diff --git a/README.md b/README.md index 49bfd0b..9bc3576 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,8 @@ [![ChatGPT downloads](https://img.shields.io/github/downloads/lencx/ChatGPT/total.svg?style=flat-square)](https://github.com/lencx/ChatGPT/releases) + + **Latest:** - `Mac`: [ChatGPT_0.1.6_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.1.6/ChatGPT_0.1.6_x64.dmg) @@ -19,6 +21,8 @@ [Other version...](https://github.com/lencx/ChatGPT/releases) + + ## Features - multi-platform: `macOS` `Linux` `Windows` diff --git a/package.json b/package.json index 99fff55..a3651b0 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "build": "yarn tauri build", "updater": "tr updater", "release": "tr release --git", + "download": "node ./scripts/download.js", "tr": "tr", "tauri": "tauri" }, diff --git a/scripts/download.js b/scripts/download.js new file mode 100644 index 0000000..5e59be4 --- /dev/null +++ b/scripts/download.js @@ -0,0 +1,30 @@ +const fs = require('fs'); +const path = require('path'); + +const argv = process.argv.slice(2); + +console.log('«6» /ChatGPT/scripts/download.js ~> ', argv[0]); + + +function init() { + const content = fs.readFileSync('README.md', 'utf8').split('\n'); + const startRe = //; + const endRe = //; + + let flag = false; + for (let i = 0; i < content.length; i++) { + if (startRe.test(content[i])) { + flag = true; + } + if (flag) { + content[i] = content[i].replace(/(\d+).(\d+).(\d+)/g, argv[0]); + } + if (endRe.test(content[i])) { + break; + } + } + + fs.writeFileSync('README.md', content.join('\n'), 'utf8'); +} + +init(); \ No newline at end of file