@covector/changelog
Advanced tools
Comparing version 0.8.0 to 0.9.0
# Changelog | ||
## \[0.9.0] | ||
### Enhancements | ||
- [`7156ce0`](https://www.github.com/jbolda/covector/commit/7156ce0f6e45a852461ca24a4bc8b808419777a4)([#277](https://www.github.com/jbolda/covector/pull/277)) Add change for all exact deps rolled up to handle it with the changelog deps section. Add the version number to the changelog deps section. | ||
### Bug Fixes | ||
- [`708adf2`](https://www.github.com/jbolda/covector/commit/708adf2a60e7e4ac428d4c026fc89dc4dfe2e5a2)([#282](https://www.github.com/jbolda/covector/pull/282)) Fix the built-in fallback `deps: Dependecies` tag always appearing first in changelog when it should be the last one. | ||
- [`828818e`](https://www.github.com/jbolda/covector/commit/828818eecf14c638ef9c74e3d243c02b8162d485)([#278](https://www.github.com/jbolda/covector/pull/278)) The changelog function to pull the last version in the changelog did not properly consider headings deeper than level 1 and level 2. When a third level was added, this caused the function to return the full changelog. Search for next heading with a specific depth of 2. | ||
### Dependencies | ||
- Upgraded to `@covector/files@0.6.2` | ||
## \[0.8.0] | ||
@@ -4,0 +19,0 @@ |
@@ -31,2 +31,3 @@ "use strict"; | ||
config, | ||
applied, | ||
}); | ||
@@ -94,3 +95,4 @@ if (create) { | ||
} | ||
const applyChanges = ({ changelogs, assembledChanges, config, }) => { | ||
const getVersionFromApplied = (name, applied) => { var _a; return (_a = applied.find((pkg) => pkg.name === name)) === null || _a === void 0 ? void 0 : _a.version; }; | ||
const applyChanges = ({ changelogs, assembledChanges, config, applied, }) => { | ||
const gitSiteUrl = !config.gitSiteUrl | ||
@@ -136,5 +138,7 @@ ? "/" | ||
}; | ||
const changeTags = Object.assign({ | ||
// ensures there is a `deps` tag if `none` is defined | ||
deps: "Dependencies" }, ((_a = config.changeTags) !== null && _a !== void 0 ? _a : {})); | ||
const changeTags = (_a = config.changeTags) !== null && _a !== void 0 ? _a : {}; | ||
// ensures there is a `deps` tag if one wasn't defined | ||
if (!("deps" in changeTags)) { | ||
changeTags.deps = "Dependencies"; | ||
} | ||
/** | ||
@@ -150,3 +154,3 @@ * Untagged changes are changes that don't have a tag associated with and `config.defaultChangeTag` is not set. | ||
// fill `deps` tag | ||
const dependecies = Object.keys(assembledChanges.releases[change.changes.name].changes | ||
const dependencies = Object.keys(assembledChanges.releases[change.changes.name].changes | ||
.filter((c) => { var _a; return (_a = c.meta) === null || _a === void 0 ? void 0 : _a.dependencies; }) | ||
@@ -157,4 +161,11 @@ // reduce to an object of keys to avoid duplication of deps | ||
return acc; | ||
}, {})).map((dep) => ({ summary: `Updated to latest \`${dep}\`` })); | ||
groupedChangesByTag.deps.push(...dependecies); | ||
}, {})).map((dep) => { | ||
const appliedVersion = getVersionFromApplied(dep, applied); | ||
return { | ||
summary: appliedVersion | ||
? `Upgraded to \`${dep}@${appliedVersion}\`` | ||
: `Upgraded to latest \`${dep}\``, | ||
}; | ||
}); | ||
groupedChangesByTag.deps.push(...dependencies); | ||
assembledChanges.releases[change.changes.name].changes | ||
@@ -224,3 +235,3 @@ .filter((c) => { var _a; return !((_a = c.meta) === null || _a === void 0 ? void 0 : _a.dependencies); }) | ||
.slice(startNode + 1) | ||
.findIndex((node) => node.type === "heading"); | ||
.findIndex((node) => node.type === "heading" && node.depth === 2); | ||
const endNode = nextNode && nextNode > 0 ? nextNode + startNode + 1 : 9999; | ||
@@ -227,0 +238,0 @@ let changelogAST = Object.assign(Object.assign({}, changelogParsed), { children: changelogParsed.children.slice(startNode, endNode) }); |
{ | ||
"name": "@covector/changelog", | ||
"version": "0.8.0", | ||
"version": "0.9.0", | ||
"license": "Apache-2.0", | ||
@@ -19,3 +19,3 @@ "homepage": "https://github.com/jbolda/covector#readme", | ||
"dependencies": { | ||
"@covector/files": "0.6.1", | ||
"@covector/files": "0.6.2", | ||
"effection": "^2.0.6", | ||
@@ -22,0 +22,0 @@ "lodash": "^4.17.21", |
@@ -45,2 +45,3 @@ import { all, Operation } from "effection"; | ||
config, | ||
applied, | ||
}); | ||
@@ -145,2 +146,7 @@ | ||
const getVersionFromApplied = ( | ||
name: string, | ||
applied: { name: string; version: string }[] | ||
) => applied.find((pkg) => pkg.name === name)?.version; | ||
const applyChanges = ({ | ||
@@ -150,2 +156,3 @@ changelogs, | ||
config, | ||
applied, | ||
}: { | ||
@@ -158,2 +165,3 @@ changelogs: { | ||
config: ConfigFile; | ||
applied: { name: string; version: string }[]; | ||
}) => { | ||
@@ -211,7 +219,7 @@ const gitSiteUrl = !config.gitSiteUrl | ||
const changeTags: { [k: string]: string } = { | ||
// ensures there is a `deps` tag if `none` is defined | ||
deps: "Dependencies", | ||
...(config.changeTags ?? {}), | ||
}; | ||
const changeTags: { [k: string]: string } = config.changeTags ?? {}; | ||
// ensures there is a `deps` tag if one wasn't defined | ||
if (!("deps" in changeTags)) { | ||
changeTags.deps = "Dependencies"; | ||
} | ||
@@ -240,3 +248,3 @@ /** | ||
// fill `deps` tag | ||
const dependecies = Object.keys( | ||
const dependencies = Object.keys( | ||
assembledChanges.releases[change.changes.name].changes | ||
@@ -249,4 +257,11 @@ .filter((c) => c.meta?.dependencies) | ||
}, {} as { [k: string]: any }) | ||
).map((dep) => ({ summary: `Updated to latest \`${dep}\`` })); | ||
groupedChangesByTag.deps.push(...dependecies); | ||
).map((dep) => { | ||
const appliedVersion = getVersionFromApplied(dep, applied); | ||
return { | ||
summary: appliedVersion | ||
? `Upgraded to \`${dep}@${appliedVersion}\`` | ||
: `Upgraded to latest \`${dep}\``, | ||
}; | ||
}); | ||
groupedChangesByTag.deps.push(...dependencies); | ||
@@ -330,3 +345,3 @@ assembledChanges.releases[change.changes.name].changes | ||
.slice(startNode + 1) | ||
.findIndex((node: any) => node.type === "heading"); | ||
.findIndex((node: any) => node.type === "heading" && node.depth === 2); | ||
const endNode = | ||
@@ -333,0 +348,0 @@ nextNode && nextNode > 0 ? nextNode + startNode + 1 : 9999; |
@@ -13,2 +13,3 @@ import { | ||
changeFolder: ".changes", | ||
changeTags: { feat: "Features", bug: "Bugs" }, | ||
}; | ||
@@ -159,2 +160,3 @@ | ||
summary: "This is a test.", | ||
tag: "bug", | ||
}, | ||
@@ -166,2 +168,3 @@ { | ||
summary: "This is another test.", | ||
tag: "bug", | ||
}, | ||
@@ -173,2 +176,3 @@ { | ||
summary: "This is the last test.", | ||
tag: "feat", | ||
}, | ||
@@ -180,2 +184,3 @@ { | ||
summary: "This is the final test.", | ||
tag: "feat", | ||
}, | ||
@@ -225,8 +230,10 @@ ], | ||
"## \\[0.9.0]\n\n" + | ||
"### Features\n\n" + | ||
"- This is the last test.\n" + | ||
"- This is the final test.\n\n" + | ||
"### Bugs\n\n" + | ||
"- This is a test.\n" + | ||
"- This is another test.\n" + | ||
"- This is the last test.\n" + | ||
"- This is the final test.\n" | ||
"- This is another test.\n" | ||
); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
61328
1176
+ Added@covector/files@0.6.2(transitive)
- Removed@covector/files@0.6.1(transitive)
Updated@covector/files@0.6.2