mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-26 12:29:06 +01:00
312f2afc41
The `auto-changelog.js` script has been refactoring into various different modules. This was done in preparation for migrating this to a separate repository, where it can be used in our libraries as well. Functionally this should act _mostly_ the same way, but there have been some changes. It was difficult to make this a pure refactor because of the strategy used to validate the changelog and ensure each addition remained valid. Instead of being updated in-place, the changelog is now parsed upfront and stored as a "Changelog" instance, which is a new class that was written to allow only valid changes. The new changelog is then stringified and completely overwrites the old one. The parsing had to be much more strict, as any unanticipated content would otherwise be erased unintentionally. This script now also normalizes the formatting of the changelog (though the individual change descriptions are still unformatted). The changelog stringification now accommodates non-linear releases as well. For example, you can now release v1.0.1 *after* v2.0.0, and it will be listed in chronological order while also correctly constructing the `compare` URLs for each release.
69 lines
1.7 KiB
JavaScript
69 lines
1.7 KiB
JavaScript
/**
|
|
* Version string
|
|
* @typedef {string} Version - A [SemVer]{@link https://semver.org/spec/v2.0.0.html}-
|
|
* compatible version string.
|
|
*/
|
|
|
|
/**
|
|
* Change categories.
|
|
*
|
|
* Most of these categories are from [Keep a Changelog]{@link https://keepachangelog.com/en/1.0.0/}.
|
|
* The "Uncategorized" category was added because we have many changes from
|
|
* older releases that would be difficult to categorize.
|
|
*
|
|
* @typedef {Record<string, string>} ChangeCategories
|
|
* @property {'Added'} Added - for new features.
|
|
* @property {'Changed'} Changed - for changes in existing functionality.
|
|
* @property {'Deprecated'} Deprecated - for soon-to-be removed features.
|
|
* @property {'Fixed'} Fixed - for any bug fixes.
|
|
* @property {'Removed'} Removed - for now removed features.
|
|
* @property {'Security'} Security - in case of vulnerabilities.
|
|
* @property {'Uncategorized'} Uncategorized - for any changes that have not
|
|
* yet been categorized.
|
|
*/
|
|
|
|
/**
|
|
* @type {ChangeCategories}
|
|
*/
|
|
const changeCategories = {
|
|
Added: 'Added',
|
|
Changed: 'Changed',
|
|
Deprecated: 'Deprecated',
|
|
Fixed: 'Fixed',
|
|
Removed: 'Removed',
|
|
Security: 'Security',
|
|
Uncategorized: 'Uncategorized',
|
|
};
|
|
|
|
/**
|
|
* Change categories in the order in which they should be listed in the
|
|
* changelog.
|
|
*
|
|
* @type {Array<keyof ChangeCategories>}
|
|
*/
|
|
const orderedChangeCategories = [
|
|
'Uncategorized',
|
|
'Added',
|
|
'Changed',
|
|
'Deprecated',
|
|
'Removed',
|
|
'Fixed',
|
|
'Security',
|
|
];
|
|
|
|
/**
|
|
* The header for the section of the changelog listing unreleased changes.
|
|
* @typedef {'Unreleased'} Unreleased
|
|
*/
|
|
|
|
/**
|
|
* @type {Unreleased}
|
|
*/
|
|
const unreleased = 'Unreleased';
|
|
|
|
module.exports = {
|
|
changeCategories,
|
|
orderedChangeCategories,
|
|
unreleased,
|
|
};
|