@latipun7/releaserc
Version:
๐ฅท Nerdy Ninja's shareable Semantic Release configuration ๐
129 lines (128 loc) โข 4.31 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.vscePlugins = exports.plugins = void 0;
const fs_1 = require("fs");
const path_1 = require("path");
const preset = 'conventionalcommits';
const releaseRules = [
{ breaking: true, release: 'major' },
{ revert: true, release: 'patch' },
{ type: 'feat', release: 'minor' },
{ type: 'feature', release: 'minor' },
{ type: 'fix', release: 'patch' },
{ type: 'docs', release: 'patch' },
{ type: 'perf', release: 'patch' },
{ type: 'revert', release: 'patch' },
{ type: 'security', release: 'patch' },
];
const presetConfig = {
types: [
{ type: 'feat', section: 'โจ Features' },
{ type: 'feature', section: 'โจ Features' },
{ type: 'fix', section: '๐ Fixes' },
{ type: 'perf', section: 'โก Performance Improvements' },
{ type: 'revert', section: 'โป๏ธ Reverts' },
{ type: 'docs', section: '๐ Documentations' },
{ type: 'security', section: '๐ Security Patches' },
{ type: 'style', section: '๐จ Styles', hidden: true },
{ type: 'chore', section: '๐งน Miscellaneous Chores', hidden: true },
{ type: 'refactor', section: '๐ฏ Code Refactoring', hidden: true },
{ type: 'test', section: '๐งช Tests', hidden: true },
{ type: 'build', section: '๐๏ธ Builds System', hidden: true },
{ type: 'ci', section: '๐ Continuous Integrations', hidden: true },
],
};
const parserOpts = {
referenceActions: [
'close',
'closes',
'closed',
'fix',
'fixes',
'fixed',
'resolve',
'resolves',
'resolved',
'see',
'sees',
'track',
'tracks',
'tracked',
],
};
const writerOpts = {
mainTemplate: (0, fs_1.readFileSync)((0, path_1.resolve)(__dirname, '..', 'templates', 'main.hbs'), { encoding: 'utf-8' }),
commitPartial: (0, fs_1.readFileSync)((0, path_1.resolve)(__dirname, '..', 'templates', 'commit-partial.hbs'), { encoding: 'utf-8' }),
partials: {
importantNotes: '{{{text}}}',
commitNotes: '{{{body}}}',
},
commitGroupsSort: (first, second) => {
const commitGroupOrder = [
'โจ Features',
'๐ Fixes',
'๐ Security Patches',
'โก Performance Improvements',
'โป๏ธ Reverts',
'๐ Documentations',
];
const gRankA = commitGroupOrder.indexOf(first.title || '');
const gRankB = commitGroupOrder.indexOf(second.title || '');
if (gRankA <= gRankB)
return -1;
return 1;
},
};
const commitAnalyzerPlugin = [
'@semantic-release/commit-analyzer',
{ preset, parserOpts, releaseRules, presetConfig },
];
const releaseNotesGeneratorPlugin = [
'@semantic-release/release-notes-generator',
{ preset, parserOpts, writerOpts, presetConfig },
];
const changelogPlugin = [
'@semantic-release/changelog',
{
changelogFile: 'changelog.md',
changelogTitle: '# Changelog\n\nAll notable changes to this project will be documented in this file.\nThis project adheres to [Semantic Versioning](https://semver.org) and [Conventional Commits](https://www.conventionalcommits.org) for commit guidelines.\n\n',
},
];
const npmPlugin = '@semantic-release/npm';
const vscePlugin = ['semantic-release-vsce', { packageVsix: true }];
const gitPlugin = [
'@semantic-release/git',
{
message: 'chore(release): publish <%= nextRelease.gitTag %> ๐ฆ๐\n\n[skip ci]',
assets: [
'changelog.md',
'package.json',
'package-lock.json',
'npm-shrinkwrap.json',
'yarn.lock',
],
},
];
const githubPlugin = '@semantic-release/github';
const githubVSCEPlugin = [
'@semantic-release/github',
{ assets: '*.vsix' },
];
const plugins = [
commitAnalyzerPlugin,
releaseNotesGeneratorPlugin,
changelogPlugin,
npmPlugin,
gitPlugin,
githubPlugin,
];
exports.plugins = plugins;
const vscePlugins = [
commitAnalyzerPlugin,
releaseNotesGeneratorPlugin,
changelogPlugin,
vscePlugin,
gitPlugin,
githubVSCEPlugin,
];
exports.vscePlugins = vscePlugins;