diff --git a/generateChangelog.js b/generateChangelog.js index cae1de12..0c00718d 100644 --- a/generateChangelog.js +++ b/generateChangelog.js @@ -1,22 +1,23 @@ -const fs = require("fs"); -const { version } = require("./package.json"); +import fs from 'fs'; +import { version } from './package.json'; -// write changelog to CHANGELOG.md -fs.writeFileSync("CHANGELOG.md", changelogContent); +// Define the content for the changelog +const changelogContent = `# Changelog\n\n## Version ${version}\n- Initial release.\n`; -// Update current version in README -fs.readFile("README.md", "utf8", (err, data) => { +fs.writeFileSync('CHANGELOG.md', changelogContent); + +fs.readFile('README.md', 'utf8', (err, data) => { if (err) { console.error(err); return; } const updatedReadme = data.replace(/CURRENT_VERSION_PLACEHOLDER/g, version); - fs.writeFile("README.md", updatedReadme, "utf8", (err) => { + fs.writeFile('README.md', updatedReadme, 'utf8', (err) => { if (err) { console.error(err); return; } - console.log("README updated with current version"); + console.log('README updated with current version'); }); });