mirror of
https://github.com/FranP-code/ChatGPT.git
synced 2025-10-13 00:13:25 +00:00
chore: download
This commit is contained in:
30
scripts/download.js
vendored
Normal file
30
scripts/download.js
vendored
Normal file
@@ -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 = /<!-- download start -->/;
|
||||
const endRe = /<!-- download end -->/;
|
||||
|
||||
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();
|
||||
Reference in New Issue
Block a user