Skip to content

Commit

Permalink
fix:changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
raizo07 committed Jun 20, 2024
1 parent df92782 commit d4474c1
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions generateChangelog.js
Original file line number Diff line number Diff line change
@@ -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');
});
});

0 comments on commit d4474c1

Please sign in to comment.