diff --git a/changelog_templater/CHANGELOG.template.md b/changelog_templater/CHANGELOG.template.md new file mode 100644 index 0000000000..e4779fe147 --- /dev/null +++ b/changelog_templater/CHANGELOG.template.md @@ -0,0 +1,122 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [3.X.X] - Month, XX, 202X + +### React + +#### Breaking + +- [Component] What are the breaking changes? + +#### Added + +- [Component] What is added? + +#### Changed + +Changes that are not related to specific components +- [Component] What has been changed + +#### Fixed + +- [Component] What bugs/typos are fixed? + +### Core + +#### Breaking + +- [Component] What are the breaking changes? + +#### Added + +- [Component] What is added? + +#### Changed + +Changes that are not related to specific components +- [Component] What has been changed + +#### Fixed + +- [Component] What bugs/typos are fixed? + +### Documentation + +#### Breaking + +- [Component] What are the breaking changes? + +#### Added + +- [Component] What is added? + +#### Changed + +Changes that are not related to specific components +- [Component] What has been changed + +#### Fixed + +- [Component] What bugs/typos are fixed? + +### Figma + +#### Breaking + +- [Component] What are the breaking changes? + +#### Added + +- [Component] What is added? + +#### Changed + +Changes that are not related to specific components +- [Component] What has been changed + +#### Fixed + +- [Component] What bugs/typos are fixed? + +### Sketch/Abstract + +#### Breaking + +- [Component] What are the breaking changes? + +#### Added + +- [Component] What is added? + +#### Changed + +Changes that are not related to specific components +- [Component] What has been changed + +#### Fixed + +- [Component] What bugs/typos are fixed? + +### Hds-js + +#### Breaking + +- [Component] What are the breaking changes? + +#### Added + +- [Component] What is added? + +#### Changed + +Changes that are not related to specific components +- [Component] What has been changed + +#### Fixed + +- [Component] What bugs/typos are fixed? diff --git a/changelog_templater/changelog_templater.js b/changelog_templater/changelog_templater.js new file mode 100644 index 0000000000..f64004bc38 --- /dev/null +++ b/changelog_templater/changelog_templater.js @@ -0,0 +1,16 @@ +/** + * This takes the CHANGELOG.md and prepends the CHANGELOG.template.md to it. + */ + +const fs = require('fs'); +const changeLogFile = './CHANGELOG.md'; + +const old = fs.readFileSync(changeLogFile, 'utf8'); +const template = fs.readFileSync('./changelog_templater/CHANGELOG.template.md', 'utf8'); + +// this get the index of the latest version in the changelog +const indexOfLastVersion = old.indexOf('## ['); +const oldWithoutStart = old.slice(indexOfLastVersion); +const changeLogWithTemplate = template + "\n" + oldWithoutStart; + +fs.writeFileSync(changeLogFile, changeLogWithTemplate); \ No newline at end of file diff --git a/package.json b/package.json index 77aa43891d..8611c8a30c 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,8 @@ "start:core": "lerna run --scope hds-core start", "start:react": "lerna run --scope hds-react start", "release": "lerna publish from-package --yes", - "update-versions": "lerna version --exact --no-git-tag-version --no-push --amend --yes" + "update-versions": "lerna version --exact --no-git-tag-version --no-push --amend --yes", + "changelog_templater": "node ./changelog_templater/changelog_templater.js" }, "devDependencies": { "lerna": "^7.0.1",