mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-05-05 13:57:10 -04:00
Added Chinese version
Added Chinese version
This commit is contained in:
parent
d037338a23
commit
730a68b92a
466 changed files with 31255 additions and 0 deletions
15
zh-CN/scripts/shared/changelog.mjs
Normal file
15
zh-CN/scripts/shared/changelog.mjs
Normal file
|
@ -0,0 +1,15 @@
|
|||
import { readFile, writeFile } from 'fs/promises';
|
||||
|
||||
export { addToChangelog };
|
||||
|
||||
async function addToChangelog({ changelog, version, changelogPath = './CHANGELOG.md' }) {
|
||||
const changelogContent = await readFile(changelogPath, 'utf-8');
|
||||
const versionTitle = `## Version ${version}`;
|
||||
|
||||
if (changelogContent.includes(versionTitle)) {
|
||||
throw new Error(`Version ${version} already exists in the changelog`);
|
||||
}
|
||||
|
||||
const newChangeLogContent = changelogContent.replace('## ', `${versionTitle}\n\n${changelog}\n\n## `);
|
||||
await writeFile(changelogPath, newChangeLogContent, 'utf-8');
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue