diff --git a/README.md b/README.md index 191a61c..218b18e 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,10 @@ $ node runner.js init {operator_name} To initialize folder and config file for an operator ``` ``` bash +$ node runner.js readme {operator_name} +To add operator info to README.md +``` +``` bash $ node runner.js directory To generate directory.json ``` diff --git a/libs/file.js b/libs/file.js index 32902ba..3b2d593 100644 --- a/libs/file.js +++ b/libs/file.js @@ -15,7 +15,7 @@ export async function read(filePath, encoding = 'utf8') { return await fsP.readFile(filePath, encoding, { flag: 'r' }) } -export async function readSync(filePath, encoding = 'utf8') { +export function readSync(filePath, encoding = 'utf8') { return fs.readFileSync(filePath, encoding, { flag: 'r' }) } @@ -50,6 +50,6 @@ export async function copy(sourcePath, targetPath) { return await fsP.copyFile(sourcePath, targetPath) } -function append(content, filePath) { - +export function appendSync(content, filePath) { + return fs.appendFileSync(filePath, content, 'utf8'); } diff --git a/libs/readme.js b/libs/readme.js index 84b5991..ad05b82 100644 --- a/libs/readme.js +++ b/libs/readme.js @@ -1,5 +1,11 @@ - +import path from 'path' +import { appendSync, readSync } from './file.js' export function append(config, operatorName, rootDir) { - + const operatorConfig = config.operators[operatorName] + const projectJson = JSON.parse(readSync(path.join(rootDir, config.folder.operator, operatorName, 'project.json'))) + appendSync( + `\n| ${operatorConfig.title.split(' - ')[0].split('Arknights: ')[1]} | [Link](https://arknights.halyul.dev/${operatorConfig.link}/) | [Link](https://steamcommunity.com/sharedfiles/filedetails/?id=${projectJson.workshopid}) |`, + path.join(rootDir, 'README.md') + ) } \ No newline at end of file diff --git a/public/assets/char_2024_chyue_2.png b/public/assets/char_2024_chyue_2.png deleted file mode 100644 index 2f30ddc..0000000 Binary files a/public/assets/char_2024_chyue_2.png and /dev/null differ diff --git a/public/assets/logo_sui.png b/public/assets/logo_sui.png deleted file mode 100755 index 1b93097..0000000 Binary files a/public/assets/logo_sui.png and /dev/null differ diff --git a/public/operator_bg.png b/public/operator_bg.png deleted file mode 100644 index 8575fc4..0000000 Binary files a/public/operator_bg.png and /dev/null differ