Have the CHANGELOG conform to keepachangelog and replace `rewrite-changelog.mjs` script
Which issue, if any, is this issue related to?
#8290
Is there anything in the PR that needs further explanation?
TODO
- [ ] remove changesets
- [ ]
git add - [ ] alter
config.json
example
nvm use 18
echo "It adds ..." > description.txt
# npx changeset
# git add .changeset/foo-qux-bar.md
# git commit --author="John Doe <[email protected]>" -m "foo #3456"
npm run changesets-to-changelog "$(cat description.txt)"
git add -p CHANGELOG.md
putout plugin
const report = ({ type }) => {
switch (type) {
case 'move':
return 'qux';
break;
case 'remove':
return 'bar';
break;
}
};
export default {
name: 'foo',
fix,
traverse,
report,
};
function fix({ index, node, listItems, type }, tree) {
switch (type) {
case 'move':
// add sud-heading
tree.children.splice(index, 0, node);
// remove prefixes
listItems.forEach(({ children: [{ children: [line] } ] }) => {
line.value = line.value.split(': ')[1];
});
// add corresponding list
tree.children.splice(index + 1, 0, {
type: 'list',
spread: false,
children: listItems,
});
break;
case 'remove':
tree.children.splice(index, 1);
break;
}
}
function traverse(tree, { push }) {
let delta = 0;
for (const [index, node] of tree.children.entries()) {
if (node.type === 'list') {
const types = new Set();
node.children.forEach((listItem) => {
const line = listItem.children[0].children[0];
const [type] = line.value.split(': ');
if (!types.has(type)) {
types.add(type);
push({
node: {
type: 'heading',
depth: 3,
children: [{ type: 'text', value: type }],
},
index: index + delta,
listItems: node.children.filter(({ children: [paragraph] }) => {
const [prefix] = paragraph.children[0].value.split(': ');
return prefix === type;
}),
type: 'move',
});
delta = delta + 2;
}
});
push({
index: index + delta,
type: 'remove',
});
delta--;
}
}
}
manual fixes
@@ -1495,7 +1495,7 @@
### Fixed
-- "fatal[#3915](https://github.com/stylelint/stylelint/pull/3915)).
+- "fatal: Not a git repository" error ([#3915](https://github.com/stylelint/stylelint/pull/3915)).
- unintended increase in package size ([#3915](https://github.com/stylelint/stylelint/pull/3915)).
## 9.10.0 - 2019-01-16
@@ -1859,18 +1859,14 @@
This release is accompanied by:
-### A new
-
-- [semantic version policy](docs/about/semantic-versioning.md). The use of the tilde (`~`) in `package.json` is now recommended, e.g. `"stylelint": "~8.0.0"`, to guarantee the results of your builds ([#1865](https://github.com/stylelint/stylelint/issues/1865)).
-- [VISION document](docs/about/vision.md), complemented by ([#2704](https://github.com/stylelint/stylelint/pull/2704)):
+- A new [semantic version policy](docs/about/semantic-versioning.md). The use of the tilde (`~`) in `package.json` is now recommended, e.g. `"stylelint": "~8.0.0"`, to guarantee the results of your builds ([#1865](https://github.com/stylelint/stylelint/issues/1865)).
+- A new [VISION document](docs/about/vision.md), complemented by ([#2704](https://github.com/stylelint/stylelint/pull/2704)):
- The restructuring of the [list of rules](docs/user-guide/rules.md) into three groups:
- Possible errors
- Limit language features
- Stylistic issues
- The release of a new sharable config, [`stylelint-config-recommended`](https://github.com/stylelint/stylelint-config-recommended). This config only turns on the possible error rules. [`stylelint-config-standard`](https://github.com/stylelint/stylelint-config-standard) now builds on top of the recommended config by turning on over 60 additional stylistic rules.
-Changes:
-
@@ -488,6 +380,7 @@ Lastly, we've made a deprecation that may affect some plugins. We've updated our
- TypeScript definitions for ESM ([#7309](https://github.com/stylelint/stylelint/pull/7309)) ([@ybiquitous](https://github.com/ybiquitous)).
- `stylelint.rules` object to have `Promise` values ([#7279](https://github.com/stylelint/stylelint/pull/7279)) ([@ybiquitous](https://github.com/ybiquitous)).
- `stylelint.utils.checkAgainstRule` to be an async function ([#7339](https://github.com/stylelint/stylelint/pull/7339)) ([@ybiquitous](https://github.com/ybiquitous)).
+- `.js` extension to `.mjs` and `.cjs` ([#7307](https://github.com/stylelint/stylelint/pull/7307)) ([@ybiquitous](https://github.com/ybiquitous)).
### Deprecated
@@ -511,10 +404,6 @@ Lastly, we've made a deprecation that may affect some plugins. We've updated our
- CLI regression to avoid waiting for stdin without any input ([#7131](https://github.com/stylelint/stylelint/pull/7131)) ([@ybiquitous](https://github.com/ybiquitous)).
- CLI to avoid different outputs on empty files and empty stdin ([#7131](https://github.com/stylelint/stylelint/pull/7131)) ([@ybiquitous](https://github.com/ybiquitous)).
-### Refactored
-
-- `.js` extension to `.mjs` and `.cjs` ([#7307](https://github.com/stylelint/stylelint/pull/7307)) ([@ybiquitous](https://github.com/ybiquitous)).
-
## 15.11.0 - 2023-10-17
### Added
⚠️ No Changeset found
Latest commit: 9534ce446031deb96237d3e08aa4288c9e260f7b
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
Try the Instant Preview in Online Demo
Install the Instant Preview to Your Local
npm i -D https://pkg.pr.new/stylelint@8295