Skip to content

Commit

Permalink
() add changelog prepender and template
Browse files Browse the repository at this point in the history
  • Loading branch information
mrTuomoK committed Feb 6, 2024
1 parent fbd8b16 commit b71711a
Show file tree
Hide file tree
Showing 3 changed files with 140 additions and 1 deletion.
122 changes: 122 additions & 0 deletions changelog_templater/CHANGELOG.template.md
Original file line number Diff line number Diff line change
@@ -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?
16 changes: 16 additions & 0 deletions changelog_templater/changelog_templater.js
Original file line number Diff line number Diff line change
@@ -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);
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit b71711a

Please sign in to comment.