fix: pass next release to updatePackageVersion & replace ## unreleased with new version (#3806)
* fix: pass next version to updatePackageVersion * replace unreleased with next version in changelog * fix * fix
This commit is contained in:
parent
2e61fec7a6
commit
380aaa30e6
@ -18,7 +18,7 @@ const release = async (nextVersion) => {
|
|||||||
try {
|
try {
|
||||||
updateReadme();
|
updateReadme();
|
||||||
await updateChangelog(nextVersion);
|
await updateChangelog(nextVersion);
|
||||||
updatePackageVersion();
|
updatePackageVersion(nextVersion);
|
||||||
await exec(`git add -u`);
|
await exec(`git add -u`);
|
||||||
await exec(
|
await exec(
|
||||||
`git commit -m "docs: release excalidraw@excalidraw@${nextVersion} 🎉"`,
|
`git commit -m "docs: release excalidraw@excalidraw@${nextVersion} 🎉"`,
|
||||||
|
@ -69,7 +69,7 @@ const getLibraryCommitsSinceLastRelease = async () => {
|
|||||||
return commitList;
|
return commitList;
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateChangelog = async () => {
|
const updateChangelog = async (nextVersion) => {
|
||||||
const commitList = await getLibraryCommitsSinceLastRelease();
|
const commitList = await getLibraryCommitsSinceLastRelease();
|
||||||
let changelogForLibrary =
|
let changelogForLibrary =
|
||||||
"## Excalidraw Library\n\n**_This section lists the updates made to the excalidraw library and will not affect the integration._**\n\n";
|
"## Excalidraw Library\n\n**_This section lists the updates made to the excalidraw library and will not affect the integration._**\n\n";
|
||||||
@ -84,10 +84,13 @@ const updateChangelog = async () => {
|
|||||||
});
|
});
|
||||||
changelogForLibrary += "---\n";
|
changelogForLibrary += "---\n";
|
||||||
const lastVersionIndex = existingChangeLog.indexOf(`## ${lastVersion}`);
|
const lastVersionIndex = existingChangeLog.indexOf(`## ${lastVersion}`);
|
||||||
const updatedContent =
|
let updatedContent =
|
||||||
existingChangeLog.slice(0, lastVersionIndex) +
|
existingChangeLog.slice(0, lastVersionIndex) +
|
||||||
changelogForLibrary +
|
changelogForLibrary +
|
||||||
existingChangeLog.slice(lastVersionIndex + 1);
|
existingChangeLog.slice(lastVersionIndex);
|
||||||
|
const currentDate = new Date().toISOString().slice(0, 10);
|
||||||
|
const newVersion = `## ${nextVersion} (${currentDate})`;
|
||||||
|
updatedContent = updatedContent.replace(`## Unreleased`, newVersion);
|
||||||
fs.writeFileSync(`${excalidrawDir}/CHANGELOG.md`, updatedContent, "utf8");
|
fs.writeFileSync(`${excalidrawDir}/CHANGELOG.md`, updatedContent, "utf8");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user