UNPKG

@halospv3/hce.shared-config

Version:

Automate commit message quality, changelogs, and CI/CD releases. Its `main` entry point is a Semantic Release config. Functions and classes are exposed for customization. An ESLint config, a Commitlint config, and addl. resources for .NET projects are als

1 lines 8.73 kB
{"version":3,"file":"semanticReleaseConfig.mjs","names":[],"sources":["../src/semanticReleaseConfig.ts"],"sourcesContent":["// @ts-types=\"./semantic-release__commit-analyzer.d.ts\"\nimport type { Options as SRCommitAnalyzerOptions } from '@semantic-release/commit-analyzer';\n// @ts-types=\"./semantic-release__exec.d.ts\"\nimport type { Options as SRExecOptions } from '@semantic-release/exec';\n// @ts-types=\"./semantic-release__git.d.ts\"\nimport type { Options as SRGitOptions } from '@semantic-release/git';\n// @ts-types=\"./semantic-release__github.d.ts\"\nimport type { Options as SRGithubOptions } from '@semantic-release/github';\nimport type { Options, PluginSpec } from 'semantic-release';\nimport { DefaultOptions } from './setupGitPluginSpec.default.ts';\n\nexport interface SRReleaseNotesGeneratorOptions {\n /**\n * conventional-changelog preset.\n * @default 'angular'\n */\n preset?: 'angular' | 'atom' | 'codemirror' | 'ember' | 'eslint' | 'express' | 'jquery' | 'jscs' | 'jshint' | 'conventionalcommits' | (string & Record<never, never>) | undefined;\n /**\n * Require-able npm package with a custom conventional-changelog preset.'\n * If {@link preset} is specified, then this is ignored.\n */\n config?: string | undefined;\n /**\n * Additional `conventional-changelog-parser` options that will overwrite ones loaded by `preset` or `config`.\n * `null | undefined` has no effect.\n */\n parserOpts?: object | null | undefined;\n /**\n * Additional `conventional-changelog-writer` options that will overwrite ones loaded by `preset` or `config`.\n * This is convenient to use a conventional-changelog preset with some\n * customizations without having to create a new module.\n * `null | undefined` has no effect.\n */\n writerOpts?: object | null | undefined;\n /**\n * The host used to generate links to issues and commits. See\n * {@link https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-writer#host conventional-changelog-writer#host}.\n * @default {string} The host from the repositoryurl option.\n */\n host?: unknown;\n /**\n * Whether to include a link to compare changes since previous release in the\n * release note.\n * @default true\n */\n linkCompare?: boolean;\n /**\n * Whether to include a link to issues and commits in the release note. See\n * {@link https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-writer#linkreferences conventional-changelog-writer#linkreferences}.\n * @default true\n */\n linkReferences?: unknown;\n /**\n * Keyword used to generate commit links (formatted as\n * <host>/<owner>/<repository>/<commit>/<commit_sha>). See\n * {@link https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-writer#commit conventional-changelog-writer#commit}.\n * @default `commits` for Bitbucket repositories, `commit` otherwise\n */\n commit?: unknown;\n /**\n * Keyword used to generate issue links (formatted as\n * <host>/<owner>/<repository>/<issue>/<issue_number>). See\n * {@link https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-writer#issue conventional-changelog-writer#issue}.\n * @default `issue` for Bitbucket repositories, `issues` otherwise\n */\n issue?: unknown;\n /**\n * Additional configuration passed to the\n * {@link https://github.com/conventional-changelog/conventional-changelog conventional-changelog}\n * preset. Used for example with\n * {@link https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-conventionalcommits#specific-options conventional-changelog-conventionalcommits}.\n */\n presetConfig?: unknown;\n}\n\n/**\n * A two-type PluginSpec to tie a plugin's name to its Options type. This is\n * intended for use by plugins to associate their Options type with their plugin\n * name.\n */\nexport type PluginSpecTuple<P extends string = string, T = unknown> = [P, T];\nexport type PluginSpecSRCommitAnalyzer<V extends SRCommitAnalyzerOptions = SRCommitAnalyzerOptions> = PluginSpecTuple<'@semantic-release/commit-analyzer', V>;\nexport type PluginSpecSRChangelog<V extends Record<'changelogFile' | 'changelogTitle', string>> = PluginSpecTuple<'@semantic-release/changelog', V>;\nexport type PluginSpecExportData<V extends Record<string, unknown> = Record<string, unknown>> = PluginSpecTuple<'semantic-release-export-data', V>;\nexport type PluginSpecSRReleaseNotesGen<V extends SRReleaseNotesGeneratorOptions = SRReleaseNotesGeneratorOptions> = PluginSpecTuple<'@semantic-release/release-notes-generator', V>;\nexport type PluginSpecSRExec<V extends SRExecOptions = SRExecOptions> = PluginSpecTuple<'@semantic-release/exec', V>;\nexport type PluginSpecSRGit<V extends SRGitOptions = SRGitOptions> = PluginSpecTuple<'@semantic-release/git', V>;\nexport type PluginSpecSRGithub<V extends SRGithubOptions = SRGithubOptions> = PluginSpecTuple<'@semantic-release/github', V>;\n\n/**\n * @satisfies { Readonly<PluginSpec[]> }\n */\nexport const defaultPlugins: readonly [\n '@semantic-release/commit-analyzer',\n '@semantic-release/release-notes-generator',\n '@semantic-release/npm',\n '@semantic-release/github',\n] = Object.freeze([\n '@semantic-release/commit-analyzer',\n '@semantic-release/release-notes-generator',\n '@semantic-release/npm',\n '@semantic-release/github',\n] as const) satisfies readonly PluginSpec[];\n\n// define as const for string literals in type, then...\n/**\n * @see baseConfig\n */\nconst _baseConfig = {\n /** @see https://semantic-release.gitbook.io/semantic-release/usage/plugins#plugin-options-configuration */\n preset: 'conventionalcommits' as const,\n branches: [\n 'main',\n { name: 'develop', channel: 'develop', prerelease: true },\n ] as ['main', { name: 'develop'; channel: 'develop'; prerelease: true }],\n plugins: [\n ['@semantic-release/commit-analyzer', {}],\n ['semantic-release-export-data', {}],\n ['@semantic-release/release-notes-generator', {}],\n ['@semantic-release/changelog', {}],\n ['@semantic-release/git', DefaultOptions],\n ['@semantic-release/exec', {}],\n ['@semantic-release/github', { addReleases: 'bottom', assets: ['./publish/*', '!./publish/.gitkeep'] }],\n ] as [\n PluginSpecSRCommitAnalyzer,\n PluginSpecExportData,\n PluginSpecSRReleaseNotesGen,\n PluginSpecSRChangelog<Record<'changelogFile' | 'changelogTitle', string>>,\n PluginSpecSRGit<typeof DefaultOptions>,\n PluginSpecSRExec,\n PluginSpecSRGithub<{ addReleases: 'bottom'; assets: [{ path: './publish/*' }] }>,\n ] | Exclude<PluginSpec, string>[],\n};\n\n/**\n * The base configuration for various Semantic Release scenarios.\n * - Prefers preset \"conventionalcommits\"\n * (Conventional-Changelog-ConventionalCommits).\n * - Creates tags and release commits on \"main\" branch, pre-releases on\n * \"develop\" branch in \"develop\" channel.\n * - Creates GitHub Releases.\n * - Exports the following variables as GitHub Actions outputs:\n * - \"new-release-published\": \"true\" | \"false\"\n * - \"new-release-version\" : string\n * - \"new-release-git-tag\" : string\n * - includes default plugins (except `@semantic-release/npm`) and more\n * - `@semantic-release/commit-analyzer`\n * - semantic-release-export-data\n * - `@semantic-release/release-notes-generator`\n * - `@semantic-release/changelog`\n * - `@semantic-release/git`\n * - add modified CHANGELOG.md in release commit\n * - `@semantic-release/exec`\n * - does nothing by default. Included for convenience.\n * - `@semantic-release/github`\n * - uploads all files from `./publish/*`. This is non-recursive.\n * - adds a list of links to related release pages (e.g. the release's page on npmjs.com)\n *\n * (OPTIONAL) update static Version strings before Git plugin\n * - https://github.com/jpoehnelt/semantic-release-replace-plugin\n * - https://github.com/droidsolutions/semantic-release-update-file\n * @satisfies {Options}\n */\nexport const baseConfig: typeof _baseConfig = _baseConfig satisfies Options;\n"],"mappings":";;;;;AA4FA,MAAa,iBAKT,OAAO,OAAO;CAChB;CACA;CACA;CACA;AACF,CAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DV,MAAa,aAAiC;;CArD5C,QAAQ;CACR,UAAU,CACR,QACA;EAAE,MAAM;EAAW,SAAS;EAAW,YAAY;CAAK,CAC1D;CACA,SAAS;EACP,CAAC,qCAAqC,CAAC,CAAC;EACxC,CAAC,gCAAgC,CAAC,CAAC;EACnC,CAAC,6CAA6C,CAAC,CAAC;EAChD,CAAC,+BAA+B,CAAC,CAAC;EAClC,CAAC,yBAAyB,cAAc;EACxC,CAAC,0BAA0B,CAAC,CAAC;EAC7B,CAAC,4BAA4B;GAAE,aAAa;GAAU,QAAQ,CAAC,eAAe,qBAAqB;EAAE,CAAC;CACxG;AAwC4C"}