@halospv3/hce.shared-config 3.4.7-develop.1 → 3.4.8-develop.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -5
- package/mjs/CaseInsensitiveMap.mjs +27 -1
- package/mjs/CaseInsensitiveMap.mjs.map +1 -1
- package/mjs/commitlintConfig.mjs +13 -1
- package/mjs/commitlintConfig.mjs.map +1 -1
- package/mjs/debug.mjs +8 -1
- package/mjs/debug.mjs.map +1 -1
- package/mjs/dotnet/GithubNugetRegistryInfo.mjs +39 -1
- package/mjs/dotnet/GithubNugetRegistryInfo.mjs.map +1 -1
- package/mjs/dotnet/GitlabNugetRegistryInfo.mjs +81 -1
- package/mjs/dotnet/GitlabNugetRegistryInfo.mjs.map +1 -1
- package/mjs/dotnet/IsNextVersionAlreadyPublished.cli.mjs +42 -1
- package/mjs/dotnet/IsNextVersionAlreadyPublished.cli.mjs.map +1 -1
- package/mjs/dotnet/MSBuildProject.mjs +345 -2
- package/mjs/dotnet/MSBuildProject.mjs.map +1 -1
- package/mjs/dotnet/MSBuildProjectProperties.mjs +233 -1
- package/mjs/dotnet/MSBuildProjectProperties.mjs.map +1 -1
- package/mjs/dotnet/NugetProjectProperties.mjs +520 -1
- package/mjs/dotnet/NugetProjectProperties.mjs.map +1 -1
- package/mjs/dotnet/NugetRegistryInfo.mjs +599 -3
- package/mjs/dotnet/NugetRegistryInfo.mjs.map +1 -1
- package/mjs/dotnet/helpers.mjs +222 -1
- package/mjs/dotnet/helpers.mjs.map +1 -1
- package/mjs/dotnet/index.mjs +9 -1
- package/mjs/dotnet.mjs +9 -1
- package/mjs/eslintConfig.mjs +97 -1
- package/mjs/eslintConfig.mjs.map +1 -1
- package/mjs/index.mjs +2 -1
- package/mjs/insertPlugins.mjs +35 -1
- package/mjs/insertPlugins.mjs.map +1 -1
- package/mjs/semanticReleaseConfig.mjs +63 -1
- package/mjs/semanticReleaseConfig.mjs.map +1 -1
- package/mjs/semanticReleaseConfigDotnet.mjs +223 -6
- package/mjs/semanticReleaseConfigDotnet.mjs.map +1 -1
- package/mjs/setupGitPluginSpec.default.mjs +18 -2
- package/mjs/setupGitPluginSpec.default.mjs.map +1 -1
- package/mjs/setupGitPluginSpec.mjs +108 -1
- package/mjs/setupGitPluginSpec.mjs.map +1 -1
- package/mjs/utils/Exact.d.mts +10 -10
- package/mjs/utils/Exact.d.mts.map +1 -1
- package/mjs/utils/env.mjs +39 -1
- package/mjs/utils/env.mjs.map +1 -1
- package/mjs/utils/execAsync.mjs +54 -7
- package/mjs/utils/execAsync.mjs.map +1 -1
- package/mjs/utils/isError.mjs +17 -1
- package/mjs/utils/isError.mjs.map +1 -1
- package/mjs/utils/miscTypes.mjs +7 -1
- package/mjs/utils/miscTypes.mjs.map +1 -1
- package/mjs/utils/reflection/filterForGetters.mjs +25 -1
- package/mjs/utils/reflection/filterForGetters.mjs.map +1 -1
- package/mjs/utils/reflection/getOwnPropertyDescriptors.mjs +27 -1
- package/mjs/utils/reflection/getOwnPropertyDescriptors.mjs.map +1 -1
- package/mjs/utils/reflection/getOwnPropertyDescriptorsRecursively.mjs +34 -1
- package/mjs/utils/reflection/getOwnPropertyDescriptorsRecursively.mjs.map +1 -1
- package/mjs/utils/reflection/getPrototypeChainOf.mjs +39 -1
- package/mjs/utils/reflection/getPrototypeChainOf.mjs.map +1 -1
- package/mjs/utils/reflection/getPrototypeOf.mjs +12 -1
- package/mjs/utils/reflection/getPrototypeOf.mjs.map +1 -1
- package/mjs/utils/reflection/inheritance.mjs +10 -1
- package/mjs/utils/reflection/inheritance.mjs.map +1 -1
- package/mjs/utils/reflection/isConstructor.mjs +30 -1
- package/mjs/utils/reflection/isConstructor.mjs.map +1 -1
- package/mjs/utils/reflection/isGetterDescriptor.mjs +13 -1
- package/mjs/utils/reflection/isGetterDescriptor.mjs.map +1 -1
- package/mjs/utils/reflection/listOwnGetters.mjs +29 -1
- package/mjs/utils/reflection/listOwnGetters.mjs.map +1 -1
- package/mjs/utils/reflection.mjs +10 -1
- package/package.json +17 -43
- package/src/utils/Exact.d.ts +17 -0
- package/mjs/utils/Exact.mjs +0 -2
- package/mjs/utils/Exact.mjs.map +0 -1
- package/src/utils/Exact.ts +0 -49
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.mjs","names":["MSBPP"],"sources":["../../src/dotnet/helpers.ts"],"sourcesContent":["import { type, type Type } from 'arktype';\n// eslint-disable-next-line unicorn/import-style\nimport * as path from 'node:path';\nimport { cwd } from 'node:process';\nimport { MSBuildProject } from './MSBuildProject.ts';\nimport { MSBuildProjectProperties as MSBPP } from './MSBuildProjectProperties.ts';\nimport { NugetRegistryInfo } from './NugetRegistryInfo.ts';\nimport type { Default } from 'arktype/internal/attributes.ts';\n\nconst ourDefaultPubDir = path.join('.', 'publish') as `.${'/' | '\\\\'}publish`;\n\n/**\n * Build a prepareCmd string from .NET projects.\\\n * This will include a `dotnet publish` for each project's RID and TFM permutation,\\\n * `dotnet pack` for each project with output paths separated by NuGet Source and PackageId,\\\n * and `dotnet nuget sign` for each nupkg output directory.\n * @todo parse Solution files to publish all projects with default Publish parameters (as evaluated by MSBuild).\n * @param projectsToPublish An array of relative or full file paths of `.csproj`\n * projects -OR- an array of {@link MSBuildProject} objects.\n * The project paths will be passed to `dotnet publish` commands.\n * @param projectsToPackAndPush\n * Relative and/or full file paths of projects to pass to `dotnet pack`. If\n * string[], only the default NuGet Source will be used. If GitHub, GitLab,\n * etc. are also desired, pass {@link NugetRegistryInfo}[]\n * @param dotnetNugetSignOpts A {@link DotnetNugetSignOptions} object. The value\n * of the `--output` argument will be set to {@link ourDefaultPubDir} if `undefined`.\n * @returns A single string of CLI commands joined by ' && '\n */\nexport async function configurePrepareCmd(\n projectsToPublish: string[] | MSBuildProject[],\n projectsToPackAndPush?: string[] | NugetRegistryInfo[],\n dotnetNugetSignOpts?: typeof DotnetNugetSignOptions.inferIn,\n): Promise<string> {\n const evaluatedProjects: MSBuildProject[] = [];\n\n // append evaluated projects\n for (const p of projectsToPublish.filter(p => p instanceof MSBuildProject)) {\n evaluatedProjects.push(p);\n }\n if (projectsToPackAndPush) {\n for (const p of projectsToPackAndPush.filter(p => p instanceof NugetRegistryInfo)) {\n evaluatedProjects.push(p.project);\n }\n }\n\n const dotnetPublishCmd: string = await formatDotnetPublish(projectsToPublish);\n const dotnetPackCmd: string | undefined = await formatDotnetPack(projectsToPackAndPush ?? []);\n const dotnetNugetSignCmd: string | undefined = formatDotnetNugetSign(dotnetNugetSignOpts);\n\n return [\n dotnetPublishCmd,\n dotnetPackCmd,\n dotnetNugetSignCmd,\n // remove no-op commands\n ]\n .filter(v => v !== undefined)\n .join(' && ');\n\n /**\n * Create a string of CLI commands to run `dotnet publish` or the Publish\n * MSBuild target for one or more projects.\n * @async\n * @param projectsToPublish An array of one or more projects, either\n * pre-evaluated (see {@link MSBuildProject.Evaluate}) or as full file paths.\\\n * NOTE: Although `dotnet publish` allows directory or Solution file (.sln,\n * .slnx) paths, this function expects projects' full or relative file\n * paths.\n * @returns A Promise of a string. This string contains one or more `dotnet publish`\n * commands conjoined by \" && \". It may also include one or more\n * `dotnet msbuild ${...} -t:PublishAll -p:Configuration=Release` commands.\n */\n async function formatDotnetPublish(\n projectsToPublish: string[] | MSBuildProject[],\n ): Promise<string> {\n /* Fun Fact: You can define a property and get the evaluated value in the same command!\n ```pwsh\n dotnet msbuild .\\src\\HXE.csproj -property:RuntimeIdentifiers=\"\"\"place;holder\"\"\" -getProperty:RuntimeIdentifiers\n place;holder\n ```\n enclosing with \"\"\" is required in pwsh to prevent the semicolon from breaking the string.\n */\n if (!Array.isArray(projectsToPublish) || projectsToPublish.length === 0) {\n throw new Error(\n `Type of projectsToPublish (${typeof projectsToPublish}) is not allowed. Expected a string[] or MSBuildProject[] where length > 0.`,\n );\n }\n\n // each may have TargetFramework OR TargetFrameworks (plural)\n const evaluatedPublishProjects: MSBuildProject[] = await Promise.all(\n projectsToPublish.map(async (proj): Promise<MSBuildProject> => {\n if (proj instanceof MSBuildProject)\n return proj;\n\n // filter for projects whose full paths match the full path of the given string\n const filteredProjects = evaluatedProjects.filter(p =>\n p.Properties.MSBuildProjectFullPath === MSBPP.GetFullPath(proj),\n );\n\n // if no pre-existing MSBuildProject found,\n // evaluate a new one and push it\n if (filteredProjects.length === 0) {\n const _proj = await MSBuildProject.Evaluate({\n FullName: proj,\n GetProperty: MSBuildProject.MatrixProperties,\n GetItem: [],\n GetTargetResult: [],\n Property: {},\n Targets: ['Restore'],\n });\n evaluatedProjects.push(_proj);\n return _proj;\n }\n\n /**\n * Finds and returns the subjectively \"best\" project in {@link filteredProjects}\n * @returns the subjective \"best\" project in {@link filteredProjects}\n */\n function getBest() {\n let best: MSBuildProject | undefined;\n if (filteredProjects.length > 0 && (best = filteredProjects[0]) instanceof MSBuildProject)\n return best;\n throw new Error('No MSBuildProjects could be found!');\n }\n\n /*\n todo: improve filtering to select \"optimal\" instance.\n Which properties are most-needed?\n For now, we just pray the project has a well-defined publish flow e.g.\n @halospv3/hce.shared-config/dotnet/PublishAll.targets\n */\n return getBest();\n }),\n );\n\n /**\n * Returns an array of one or more `dotnet` arguments.\n * @param proj An {@link MSBuildProject} to be published for one or more\n * runtime-framework combinations.\n * @returns If {@link proj} imports {@link ../../dotnet/PublishAll.targets}...\n * ```\n * [`${proj.Properties.MSBuildProjectFullPath} -t:PublishAll -p:Configuration=Release`]\n * ```\n * Else, an array of `dotnet publish` arguments permutations e.g.\n * ```\n * [\n * 'myProj.csproj --runtime win7-x86 --framework net6.0',\n * 'myProj.csproj --runtime win7-x64 --framework net6.0'\n * ]\n * ```\n * @example\n * const publishCmdArray = [];\n * const permutations = getPublishArgsPermutations(msbuildProject);\n * for (const permutation of permutations) {\n * if (permutation[0] === 'PublishAll') {\n * // 'dotnet msbuild full/path/to/myProj.csproj t:PublishAll'\n * publishCmdArray.push(`dotnet msbuild ${permutation[1]}`)\n * }\n * else {\n * publishCmdArray.push(`dotnet publish ${permutation}`)\n * }\n * }\n * // return array as success-chained CLI commands.\n * return publishCmdArray.join(' && ');\n */\n function getPublishArgsPermutations(proj: MSBuildProject):\n ([`\"${typeof proj.Properties.MSBuildProjectFullPath}\" -t:PublishAll -p:Configuration=Release`])\n | ([`\"${typeof proj.Properties.MSBuildProjectFullPath}\"`])\n | (`\"${typeof proj.Properties.MSBuildProjectFullPath}\" --runtime ${string} --framework ${string}`)[]\n | (`\"${typeof proj.Properties.MSBuildProjectFullPath}\" --runtime ${string}`)[]\n | (`\"${typeof proj.Properties.MSBuildProjectFullPath}\" --framework ${string}`)[] {\n /**\n * If the project imports PublishAll to publish for each TFM-RID\n * permutation, return the appropriate command line.\n */\n if (proj.Targets.includes('PublishAll'))\n return [`\"${proj.Properties.MSBuildProjectFullPath}\" -t:PublishAll -p:Configuration=Release`];\n\n // #region formatFrameworksAndRuntimes\n const tfmRidPermutations: `--runtime ${string} --framework ${string}`[]\n | `--runtime ${string}`[]\n | `--framework ${string}`[]\n = []; // forEach, run dotnet [proj.Properties.MSBuildProjectFullPath,...v]\n const RIDs: string[] = proj.Properties.RuntimeIdentifiers.split(';').filter(v => v !== '');\n const TFMs: string[] = proj.Properties.TargetFrameworks.split(';').filter(v => v !== '');\n\n if (TFMs.length === 0 && RIDs.length === 0)\n return [`\"${proj.Properties.MSBuildProjectFullPath}\"`] as [`\"${string}\"`];\n\n if (RIDs.length > 0) {\n if (TFMs.length > 0) {\n for (const RID of RIDs) {\n for (const TFM of TFMs) {\n (tfmRidPermutations as `--runtime ${string} --framework ${string}`[]).push(\n `--runtime ${RID} --framework ${TFM}`,\n );\n }\n }\n }\n else {\n // assume singular TFM. No need to specify it.\n for (const RID of RIDs) {\n (tfmRidPermutations as `--runtime ${string}`[]).push(\n `--runtime ${RID}`,\n );\n }\n }\n }\n else if (TFMs.length > 0) {\n for (const TFM of TFMs) {\n (tfmRidPermutations as `--framework ${string}`[]).push(`--framework ${TFM}`);\n }\n }\n\n /** prepend each set of args with the project's path */\n return tfmRidPermutations.map(permArgs =>\n `\"${proj.Properties.MSBuildProjectFullPath}\" ${permArgs}`,\n ) as `\"${typeof proj.Properties.MSBuildProjectFullPath}\" --runtime ${string} --framework ${string}`[]\n | `\"${typeof proj.Properties.MSBuildProjectFullPath}\" --runtime ${string}`[]\n | `\"${typeof proj.Properties.MSBuildProjectFullPath}\" --framework ${string}`[];\n // #endregion formatFrameworksAndRuntimes\n }\n\n const publishCmds: (`dotnet publish \"${string}\"` | `dotnet publish \"${string}\" ${string}` | `dotnet msbuild \"${string}\" -t:PublishAll -p:Configuration=Release`)[] = [];\n /** convert {@link evaluatedPublishProjects} to sets of space-separated CLI args. */\n const argsSets = evaluatedPublishProjects.map(\n proj => getPublishArgsPermutations(proj),\n );\n for (const args of argsSets) {\n if (typeof args === 'string')\n throw new Error(`\\`args\\` should not be a string!`);\n for (const permutation of args) {\n if (typeof permutation === 'string' && permutation.length === 1)\n throw new Error('Something has gone terribly wrong. A `dotnet publish` argument set was split to single characters!');\n if (/\".+\" -t:PublishAll -p:Configuration=Release/.test(permutation))\n publishCmds.push(`dotnet msbuild ${permutation as `\"${string}\" -t:PublishAll -p:Configuration=Release`}`);\n else\n publishCmds.push(`dotnet publish ${permutation}`);\n }\n }\n\n // For each argSet, create a new exec command. Then, join all commands with ' && ' so they are executed serially, synchronously.\n // e.g. `dotnet publish project.csproj --runtime win7-x86 --framework net6.0 && dotnet publish project.csproj --runtime win-x64 --framework net8.0\n return publishCmds.join(' && ');\n }\n\n /**\n * @param projectsToPackAndPush a string[] or {@link NugetRegistryInfo}[].\n * If a string[], the string must be the platform-dependent (not file://),\n * full path(s) to one or more projects with the .NET \"Pack\" MSBuild target.\n * See {@link https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-pack}\n * for command line usage.\n * @returns one or more command line strings joined with ' && '.\n * Each command line comprises the `dotnet pack` command, a project file path,\n * and a hardcoded output path (`--output ${cwd()}/publish`)\n */\n async function formatDotnetPack(\n projectsToPackAndPush: string[] | NugetRegistryInfo[],\n ): Promise<string | undefined> {\n if (projectsToPackAndPush.length === 0)\n return undefined;\n return await Promise.all(\n projectsToPackAndPush.map(async (proj) => {\n if (proj instanceof NugetRegistryInfo)\n return proj;\n\n const msbpArr: MSBuildProject[] = await Promise.all(await MSBuildProject.PackableProjectsToMSBuildProjects([proj]));\n if (msbpArr.length === 0 || msbpArr[0] === undefined) {\n throw new Error('This should be impossible!');\n }\n const msbp: MSBuildProject = msbpArr[0];\n\n evaluatedProjects.push(msbp);\n\n return new NugetRegistryInfo({ project: msbp });\n }),\n ).then((nriArray: NugetRegistryInfo[]): string => {\n return nriArray\n .map((nri: NugetRegistryInfo): string =>\n nri.GetPackCommand(NugetRegistryInfo.PackPackagesOptionsType.from({})),\n ).join(' && ');\n });\n }\n}\n\n/**\n * Prepare the CLI command to push NuGet packages. This should added to the `publishCmd` option of `@semantic-release/exec`\n *\n * Ensure your verifyConditionsCmd is set to prevent releases failing due to bad tokens or packages!\n * See {@link NugetRegistryInfo#PackDummyPackage}, {@link NugetRegistryInfo#GetPushDummyCommand}\n * @param registryInfos an array of {@link NugetRegistryInfo} (or derived classes) instances.\n * @param packageOutputPath Default: `${cwd()}/publish`.\\\n * The directory at which dotnet outputs the given projects' packages. Passed to\n * `dotnet pack` via the `--output` argument.\n * @returns a string of `dotnet pack` and `dotnet push` commands, joined by ' && '.\n */\nexport function configureDotnetNugetPush(\n registryInfos: NugetRegistryInfo[],\n // Explicit type required by JSR\n // eslint-disable-next-line @typescript-eslint/no-inferrable-types\n packageOutputPath: string = `${cwd()}/publish`,\n): string {\n if (registryInfos.some(registry => registry.source.trim() === ''))\n throw new Error('The URL for one of the provided NuGet registries was empty or whitespace.');\n\n const packCmds = registryInfos.map(\n (nri): string =>\n nri.GetPackCommand(\n { output: packageOutputPath },\n true,\n true,\n ),\n );\n\n const pushCmds = registryInfos.map(nri => nri.GetPushCommand({ root: packageOutputPath }, true, true));\n\n return [...packCmds, ...pushCmds].join(' && ');\n}\n\n/**\n * You should try {@link ../../dotnet/SignAfterPack.targets}!.\n * @param opts A {@link DotnetNugetSignOptions} object to be deconstructed and\n * passed to `dotnet nuget sign` as args.\n * @returns `dotnet nuget sign {...}`\n */\nfunction formatDotnetNugetSign(\n opts: typeof DotnetNugetSignOptions.inferIn | undefined,\n): string | undefined {\n if (opts === undefined)\n return undefined;\n\n const validOpts = DotnetNugetSignOptions.from(opts);\n const args: ['--timestamper', typeof validOpts.timestamper, '-o', string, ...string[]] = [\n '--timestamper', validOpts.timestamper,\n '-o', validOpts.output ?? ourDefaultPubDir,\n ];\n if (validOpts.certificatePassword)\n args.push('---certificate-password', validOpts.certificatePassword);\n if (validOpts.hashAlgorithm)\n args.push('--hash-algorithm', validOpts.hashAlgorithm);\n if (validOpts.overwrite)\n args.push('--overwrite');\n if (validOpts.timestampHashAlgorithm)\n args.push('--timestamp-hash-algorithm', validOpts.timestampHashAlgorithm);\n if (validOpts.verbosity)\n args.push('-v', validOpts.verbosity);\n\n if ('certificatePath' in validOpts)\n args.push('--certificate-path', validOpts.certificatePath);\n else if ('certificateStoreName' in validOpts) {\n SetSubjectNameOrFingerprint();\n args.push('--certificate-store-name', validOpts.certificateStoreName);\n }\n else if ('certificateStoreLocation' in validOpts) {\n SetSubjectNameOrFingerprint();\n args.push('--certificate-store-location', validOpts.certificateStoreLocation);\n }\n else throw new Error('No code signing certificate was specified!');\n\n return `dotnet nuget sign ${args.join(' ')} `;\n\n // eslint-disable-next-line jsdoc/require-jsdoc\n function SetSubjectNameOrFingerprint() {\n if ('certificateSubjectName' in validOpts)\n args.push('--certificate-subject-name', validOpts.certificateSubjectName);\n\n else if ('certificateFingerprint' in validOpts)\n args.push('--certificate-fingerprint', validOpts.certificateFingerprint);\n else throw new Error('If certificateStoreName or certificateStoreLocation is set, either certificateSubjectName or certificateFingerprint must also be set!');\n }\n}\n\nconst DotnetNugetSignOptions: Type<\n {\n timestamper: Default<string, 'https://rfc3161.ai.moda/'>;\n certificatePassword?: string | undefined;\n hashAlgorithm?: string | undefined;\n output?: string | undefined;\n overwrite?: true | undefined;\n timestampHashAlgorithm?: string | undefined;\n verbosity?: 'q' | 'quiet' | 'm' | 'minimal' | 'n' | 'normal' | 'd' | 'detailed' | 'diag' | 'diagnostic';\n } & ({\n certificatePath: string;\n certificateSubjectName: string;\n } | {\n certificatePath: string;\n certificateFingerprint: string;\n } | {\n certificateStoreName: string;\n certificateSubjectName: string;\n } | {\n certificateStoreName: string;\n certificateFingerprint: string;\n } | {\n certificateStoreLocation: string;\n certificateSubjectName: string;\n } | {\n certificateStoreLocation: string;\n certificateFingerprint: string;\n })> = type({\n /**\n * Password for the certificate, if needed. This option can be used to specify\n * the password for the certificate. The command will throw an error message\n * if certificate is password protected but password is not provided as input.\n */\n 'certificatePassword?': 'string',\n /**\n * Hash algorithm to be used to sign the package. Defaults to SHA256.\n */\n 'hashAlgorithm?': 'string | \"SHA256\"',\n /**\n * Directory where the signed package(s) should be saved. By default the\n * original package is overwritten by the signed package.\n */\n 'output?': 'string',\n /**\n * Switch to indicate if the current signature should be overwritten. By\n * default the command will fail if the package already has a signature.\n */\n 'overwrite?': 'true',\n /**\n * URL to an RFC 3161 timestamping server.\n */\n timestamper: 'string = \"https://rfc3161.ai.moda/\"',\n /**\n * Hash algorithm to be used to sign the package. Defaults to SHA256.\n */\n 'timestampHashAlgorithm?': 'string | \"SHA256\"',\n /**\n * Set the verbosity level of the command. Allowed values are q[uiet],\n * m[inimal], n[ormal], d[etailed], and diag[nostic].\n */\n 'verbosity?': '\"q\"|\"quiet\"|\"m\"|\"minimal\"|\"n\"|\"normal\"|\"d\"|\"detailed\"|\"diag\"|\"diagnostic\"',\n}).and(\n type({\n /**\n * File path to the certificate to be used while signing the package.\n */\n certificatePath: 'string',\n }).or(\n type({\n /**\n * Name of the X.509 certificate store to use to search for the\n * certificate. Defaults to \"My\", the X.509 certificate store for personal\n * certificates.\n *\n * This option should be used when specifying the certificate via\n * --certificate-subject-name or --certificate-fingerprint options.\n */\n certificateStoreName: 'string',\n }).or({\n /**\n * Name of the X.509 certificate store use to search for the\n * certificate. Defaults to \"CurrentUser\", the X.509 certificate store\n * used by the current user.\n *\n * This option should be used when specifying the certificate via\n * --certificate-subject-name or --certificate-fingerprint options.\n */\n certificateStoreLocation: 'string',\n }),\n ).and(\n type({\n /**\n * Subject name of the certificate used to search a local certificate\n * store for the certificate. The search is a case-insensitive string\n * comparison using the supplied value, which will find all certificates\n * with the subject name containing that string, regardless of other\n * subject values. The certificate store can be specified by\n * --certificate-store-name and --certificate-store-location options.\n */\n certificateSubjectName: 'string',\n }).or({\n /**\n * SHA-256, SHA-384 or SHA-512 fingerprint of the certificate used to\n * search a local certificate store for the certificate. The certificate\n * store can be specified by --certificate-store-name and\n * --certificate-store-location options.\n */\n certificateFingerprint: 'string',\n }),\n ),\n);\n"],"mappings":"0RASA,MAAM,EAAmB,EAAK,KAAK,IAAK,UAAU,CAmBlD,eAAsB,EACpB,EACA,EACA,EACiB,CACjB,IAAM,EAAsC,EAAE,CAG9C,IAAK,IAAM,KAAK,EAAkB,OAAO,GAAK,aAAa,EAAe,CACxE,EAAkB,KAAK,EAAE,CAE3B,GAAI,EACF,IAAK,IAAM,KAAK,EAAsB,OAAO,GAAK,aAAa,EAAkB,CAC/E,EAAkB,KAAK,EAAE,QAAQ,CAQrC,MAAO,CAJ0B,MAAM,EAAoB,EAAkB,CACnC,MAAM,EAAiB,GAAyB,EAAE,CAAC,CAC9C,EAAsB,EAAoB,CAOxF,CACE,OAAO,GAAK,IAAM,IAAA,GAAU,CAC5B,KAAK,OAAO,CAef,eAAe,EACb,EACiB,CAQjB,GAAI,CAAC,MAAM,QAAQ,EAAkB,EAAI,EAAkB,SAAW,EACpE,MAAU,MACR,8BAA8B,OAAO,EAAkB,6EACxD,CAIH,IAAM,EAA6C,MAAM,QAAQ,IAC/D,EAAkB,IAAI,KAAO,IAAkC,CAC7D,GAAI,aAAgB,EAClB,OAAO,EAGT,IAAM,EAAmB,EAAkB,OAAO,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otnet/helpers.ts"],"sourcesContent":["import { type, type Type } from 'arktype';\n// eslint-disable-next-line unicorn/import-style\nimport * as path from 'node:path';\nimport { cwd } from 'node:process';\nimport { MSBuildProject } from './MSBuildProject.ts';\nimport { MSBuildProjectProperties as MSBPP } from './MSBuildProjectProperties.ts';\nimport { NugetRegistryInfo } from './NugetRegistryInfo.ts';\nimport type { Default } from 'arktype/internal/attributes.ts';\n\nconst ourDefaultPubDir = path.join('.', 'publish') as `.${'/' | '\\\\'}publish`;\n\n/**\n * Build a prepareCmd string from .NET projects.\\\n * This will include a `dotnet publish` for each project's RID and TFM permutation,\\\n * `dotnet pack` for each project with output paths separated by NuGet Source and PackageId,\\\n * and `dotnet nuget sign` for each nupkg output directory.\n * @todo parse Solution files to publish all projects with default Publish parameters (as evaluated by MSBuild).\n * @param projectsToPublish An array of relative or full file paths of `.csproj`\n * projects -OR- an array of {@link MSBuildProject} objects.\n * The project paths will be passed to `dotnet publish` commands.\n * @param projectsToPackAndPush\n * Relative and/or full file paths of projects to pass to `dotnet pack`. If\n * string[], only the default NuGet Source will be used. If GitHub, GitLab,\n * etc. are also desired, pass {@link NugetRegistryInfo}[]\n * @param dotnetNugetSignOpts A {@link DotnetNugetSignOptions} object. The value\n * of the `--output` argument will be set to {@link ourDefaultPubDir} if `undefined`.\n * @returns A single string of CLI commands joined by ' && '\n */\nexport async function configurePrepareCmd(\n projectsToPublish: string[] | MSBuildProject[],\n projectsToPackAndPush?: string[] | NugetRegistryInfo[],\n dotnetNugetSignOpts?: typeof DotnetNugetSignOptions.inferIn,\n): Promise<string> {\n const evaluatedProjects: MSBuildProject[] = [];\n\n // append evaluated projects\n for (const p of projectsToPublish.filter(p => p instanceof MSBuildProject)) {\n evaluatedProjects.push(p);\n }\n if (projectsToPackAndPush) {\n for (const p of projectsToPackAndPush.filter(p => p instanceof NugetRegistryInfo)) {\n evaluatedProjects.push(p.project);\n }\n }\n\n const dotnetPublishCmd: string = await formatDotnetPublish(projectsToPublish);\n const dotnetPackCmd: string | undefined = await formatDotnetPack(projectsToPackAndPush ?? []);\n const dotnetNugetSignCmd: string | undefined = formatDotnetNugetSign(dotnetNugetSignOpts);\n\n return [\n dotnetPublishCmd,\n dotnetPackCmd,\n dotnetNugetSignCmd,\n // remove no-op commands\n ]\n .filter(v => v !== undefined)\n .join(' && ');\n\n /**\n * Create a string of CLI commands to run `dotnet publish` or the Publish\n * MSBuild target for one or more projects.\n * @async\n * @param projectsToPublish An array of one or more projects, either\n * pre-evaluated (see {@link MSBuildProject.Evaluate}) or as full file paths.\\\n * NOTE: Although `dotnet publish` allows directory or Solution file (.sln,\n * .slnx) paths, this function expects projects' full or relative file\n * paths.\n * @returns A Promise of a string. This string contains one or more `dotnet publish`\n * commands conjoined by \" && \". It may also include one or more\n * `dotnet msbuild ${...} -t:PublishAll -p:Configuration=Release` commands.\n */\n async function formatDotnetPublish(\n projectsToPublish: string[] | MSBuildProject[],\n ): Promise<string> {\n /* Fun Fact: You can define a property and get the evaluated value in the same command!\n ```pwsh\n dotnet msbuild .\\src\\HXE.csproj -property:RuntimeIdentifiers=\"\"\"place;holder\"\"\" -getProperty:RuntimeIdentifiers\n place;holder\n ```\n enclosing with \"\"\" is required in pwsh to prevent the semicolon from breaking the string.\n */\n if (!Array.isArray(projectsToPublish) || projectsToPublish.length === 0) {\n throw new Error(\n `Type of projectsToPublish (${typeof projectsToPublish}) is not allowed. Expected a string[] or MSBuildProject[] where length > 0.`,\n );\n }\n\n // each may have TargetFramework OR TargetFrameworks (plural)\n const evaluatedPublishProjects: MSBuildProject[] = await Promise.all(\n projectsToPublish.map(async (proj): Promise<MSBuildProject> => {\n if (proj instanceof MSBuildProject)\n return proj;\n\n // filter for projects whose full paths match the full path of the given string\n const filteredProjects = evaluatedProjects.filter(p =>\n p.Properties.MSBuildProjectFullPath === MSBPP.GetFullPath(proj),\n );\n\n // if no pre-existing MSBuildProject found,\n // evaluate a new one and push it\n if (filteredProjects.length === 0) {\n const _proj = await MSBuildProject.Evaluate({\n FullName: proj,\n GetProperty: MSBuildProject.MatrixProperties,\n GetItem: [],\n GetTargetResult: [],\n Property: {},\n Targets: ['Restore'],\n });\n evaluatedProjects.push(_proj);\n return _proj;\n }\n\n /**\n * Finds and returns the subjectively \"best\" project in {@link filteredProjects}\n * @returns the subjective \"best\" project in {@link filteredProjects}\n */\n function getBest() {\n let best: MSBuildProject | undefined;\n if (filteredProjects.length > 0 && (best = filteredProjects[0]) instanceof MSBuildProject)\n return best;\n throw new Error('No MSBuildProjects could be found!');\n }\n\n /*\n todo: improve filtering to select \"optimal\" instance.\n Which properties are most-needed?\n For now, we just pray the project has a well-defined publish flow e.g.\n @halospv3/hce.shared-config/dotnet/PublishAll.targets\n */\n return getBest();\n }),\n );\n\n /**\n * Returns an array of one or more `dotnet` arguments.\n * @param proj An {@link MSBuildProject} to be published for one or more\n * runtime-framework combinations.\n * @returns If {@link proj} imports {@link ../../dotnet/PublishAll.targets}...\n * ```\n * [`${proj.Properties.MSBuildProjectFullPath} -t:PublishAll -p:Configuration=Release`]\n * ```\n * Else, an array of `dotnet publish` arguments permutations e.g.\n * ```\n * [\n * 'myProj.csproj --runtime win7-x86 --framework net6.0',\n * 'myProj.csproj --runtime win7-x64 --framework net6.0'\n * ]\n * ```\n * @example\n * const publishCmdArray = [];\n * const permutations = getPublishArgsPermutations(msbuildProject);\n * for (const permutation of permutations) {\n * if (permutation[0] === 'PublishAll') {\n * // 'dotnet msbuild full/path/to/myProj.csproj t:PublishAll'\n * publishCmdArray.push(`dotnet msbuild ${permutation[1]}`)\n * }\n * else {\n * publishCmdArray.push(`dotnet publish ${permutation}`)\n * }\n * }\n * // return array as success-chained CLI commands.\n * return publishCmdArray.join(' && ');\n */\n function getPublishArgsPermutations(proj: MSBuildProject):\n ([`\"${typeof proj.Properties.MSBuildProjectFullPath}\" -t:PublishAll -p:Configuration=Release`])\n | ([`\"${typeof proj.Properties.MSBuildProjectFullPath}\"`])\n | (`\"${typeof proj.Properties.MSBuildProjectFullPath}\" --runtime ${string} --framework ${string}`)[]\n | (`\"${typeof proj.Properties.MSBuildProjectFullPath}\" --runtime ${string}`)[]\n | (`\"${typeof proj.Properties.MSBuildProjectFullPath}\" --framework ${string}`)[] {\n /**\n * If the project imports PublishAll to publish for each TFM-RID\n * permutation, return the appropriate command line.\n */\n if (proj.Targets.includes('PublishAll'))\n return [`\"${proj.Properties.MSBuildProjectFullPath}\" -t:PublishAll -p:Configuration=Release`];\n\n // #region formatFrameworksAndRuntimes\n const tfmRidPermutations: `--runtime ${string} --framework ${string}`[]\n | `--runtime ${string}`[]\n | `--framework ${string}`[]\n = []; // forEach, run dotnet [proj.Properties.MSBuildProjectFullPath,...v]\n const RIDs: string[] = proj.Properties.RuntimeIdentifiers.split(';').filter(v => v !== '');\n const TFMs: string[] = proj.Properties.TargetFrameworks.split(';').filter(v => v !== '');\n\n if (TFMs.length === 0 && RIDs.length === 0)\n return [`\"${proj.Properties.MSBuildProjectFullPath}\"`] as [`\"${string}\"`];\n\n if (RIDs.length > 0) {\n if (TFMs.length > 0) {\n for (const RID of RIDs) {\n for (const TFM of TFMs) {\n (tfmRidPermutations as `--runtime ${string} --framework ${string}`[]).push(\n `--runtime ${RID} --framework ${TFM}`,\n );\n }\n }\n }\n else {\n // assume singular TFM. No need to specify it.\n for (const RID of RIDs) {\n (tfmRidPermutations as `--runtime ${string}`[]).push(\n `--runtime ${RID}`,\n );\n }\n }\n }\n else if (TFMs.length > 0) {\n for (const TFM of TFMs) {\n (tfmRidPermutations as `--framework ${string}`[]).push(`--framework ${TFM}`);\n }\n }\n\n /** prepend each set of args with the project's path */\n return tfmRidPermutations.map(permArgs =>\n `\"${proj.Properties.MSBuildProjectFullPath}\" ${permArgs}`,\n ) as `\"${typeof proj.Properties.MSBuildProjectFullPath}\" --runtime ${string} --framework ${string}`[]\n | `\"${typeof proj.Properties.MSBuildProjectFullPath}\" --runtime ${string}`[]\n | `\"${typeof proj.Properties.MSBuildProjectFullPath}\" --framework ${string}`[];\n // #endregion formatFrameworksAndRuntimes\n }\n\n const publishCmds: (`dotnet publish \"${string}\"` | `dotnet publish \"${string}\" ${string}` | `dotnet msbuild \"${string}\" -t:PublishAll -p:Configuration=Release`)[] = [];\n /** convert {@link evaluatedPublishProjects} to sets of space-separated CLI args. */\n const argsSets = evaluatedPublishProjects.map(\n proj => getPublishArgsPermutations(proj),\n );\n for (const args of argsSets) {\n if (typeof args === 'string')\n throw new Error(`\\`args\\` should not be a string!`);\n for (const permutation of args) {\n if (typeof permutation === 'string' && permutation.length === 1)\n throw new Error('Something has gone terribly wrong. A `dotnet publish` argument set was split to single characters!');\n if (/\".+\" -t:PublishAll -p:Configuration=Release/.test(permutation))\n publishCmds.push(`dotnet msbuild ${permutation as `\"${string}\" -t:PublishAll -p:Configuration=Release`}`);\n else\n publishCmds.push(`dotnet publish ${permutation}`);\n }\n }\n\n // For each argSet, create a new exec command. Then, join all commands with ' && ' so they are executed serially, synchronously.\n // e.g. `dotnet publish project.csproj --runtime win7-x86 --framework net6.0 && dotnet publish project.csproj --runtime win-x64 --framework net8.0\n return publishCmds.join(' && ');\n }\n\n /**\n * @param projectsToPackAndPush a string[] or {@link NugetRegistryInfo}[].\n * If a string[], the string must be the platform-dependent (not file://),\n * full path(s) to one or more projects with the .NET \"Pack\" MSBuild target.\n * See {@link https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-pack}\n * for command line usage.\n * @returns one or more command line strings joined with ' && '.\n * Each command line comprises the `dotnet pack` command, a project file path,\n * and a hardcoded output path (`--output ${cwd()}/publish`)\n */\n async function formatDotnetPack(\n projectsToPackAndPush: string[] | NugetRegistryInfo[],\n ): Promise<string | undefined> {\n if (projectsToPackAndPush.length === 0)\n return undefined;\n return await Promise.all(\n projectsToPackAndPush.map(async (proj) => {\n if (proj instanceof NugetRegistryInfo)\n return proj;\n\n const msbpArr: MSBuildProject[] = await Promise.all(await MSBuildProject.PackableProjectsToMSBuildProjects([proj]));\n if (msbpArr.length === 0 || msbpArr[0] === undefined) {\n throw new Error('This should be impossible!');\n }\n const msbp: MSBuildProject = msbpArr[0];\n\n evaluatedProjects.push(msbp);\n\n return new NugetRegistryInfo({ project: msbp });\n }),\n ).then((nriArray: NugetRegistryInfo[]): string => {\n return nriArray\n .map((nri: NugetRegistryInfo): string =>\n nri.GetPackCommand(NugetRegistryInfo.PackPackagesOptionsType.from({})),\n ).join(' && ');\n });\n }\n}\n\n/**\n * Prepare the CLI command to push NuGet packages. This should added to the `publishCmd` option of `@semantic-release/exec`\n *\n * Ensure your verifyConditionsCmd is set to prevent releases failing due to bad tokens or packages!\n * See {@link NugetRegistryInfo#PackDummyPackage}, {@link NugetRegistryInfo#GetPushDummyCommand}\n * @param registryInfos an array of {@link NugetRegistryInfo} (or derived classes) instances.\n * @param packageOutputPath Default: `${cwd()}/publish`.\\\n * The directory at which dotnet outputs the given projects' packages. Passed to\n * `dotnet pack` via the `--output` argument.\n * @returns a string of `dotnet pack` and `dotnet push` commands, joined by ' && '.\n */\nexport function configureDotnetNugetPush(\n registryInfos: NugetRegistryInfo[],\n // Explicit type required by JSR\n // eslint-disable-next-line @typescript-eslint/no-inferrable-types\n packageOutputPath: string = `${cwd()}/publish`,\n): string {\n if (registryInfos.some(registry => registry.source.trim() === ''))\n throw new Error('The URL for one of the provided NuGet registries was empty or whitespace.');\n\n const packCmds = registryInfos.map(\n (nri): string =>\n nri.GetPackCommand(\n { output: packageOutputPath },\n true,\n true,\n ),\n );\n\n const pushCmds = registryInfos.map(nri => nri.GetPushCommand({ root: packageOutputPath }, true, true));\n\n return [...packCmds, ...pushCmds].join(' && ');\n}\n\n/**\n * You should try {@link ../../dotnet/SignAfterPack.targets}!.\n * @param opts A {@link DotnetNugetSignOptions} object to be deconstructed and\n * passed to `dotnet nuget sign` as args.\n * @returns `dotnet nuget sign {...}`\n */\nfunction formatDotnetNugetSign(\n opts: typeof DotnetNugetSignOptions.inferIn | undefined,\n): string | undefined {\n if (opts === undefined)\n return undefined;\n\n const validOpts = DotnetNugetSignOptions.from(opts);\n const args: ['--timestamper', typeof validOpts.timestamper, '-o', string, ...string[]] = [\n '--timestamper', validOpts.timestamper,\n '-o', validOpts.output ?? ourDefaultPubDir,\n ];\n if (validOpts.certificatePassword)\n args.push('---certificate-password', validOpts.certificatePassword);\n if (validOpts.hashAlgorithm)\n args.push('--hash-algorithm', validOpts.hashAlgorithm);\n if (validOpts.overwrite)\n args.push('--overwrite');\n if (validOpts.timestampHashAlgorithm)\n args.push('--timestamp-hash-algorithm', validOpts.timestampHashAlgorithm);\n if (validOpts.verbosity)\n args.push('-v', validOpts.verbosity);\n\n if ('certificatePath' in validOpts)\n args.push('--certificate-path', validOpts.certificatePath);\n else if ('certificateStoreName' in validOpts) {\n SetSubjectNameOrFingerprint();\n args.push('--certificate-store-name', validOpts.certificateStoreName);\n }\n else if ('certificateStoreLocation' in validOpts) {\n SetSubjectNameOrFingerprint();\n args.push('--certificate-store-location', validOpts.certificateStoreLocation);\n }\n else throw new Error('No code signing certificate was specified!');\n\n return `dotnet nuget sign ${args.join(' ')} `;\n\n // eslint-disable-next-line jsdoc/require-jsdoc\n function SetSubjectNameOrFingerprint() {\n if ('certificateSubjectName' in validOpts)\n args.push('--certificate-subject-name', validOpts.certificateSubjectName);\n\n else if ('certificateFingerprint' in validOpts)\n args.push('--certificate-fingerprint', validOpts.certificateFingerprint);\n else throw new Error('If certificateStoreName or certificateStoreLocation is set, either certificateSubjectName or certificateFingerprint must also be set!');\n }\n}\n\nconst DotnetNugetSignOptions: Type<\n {\n timestamper: Default<string, 'https://rfc3161.ai.moda/'>;\n certificatePassword?: string | undefined;\n hashAlgorithm?: string | undefined;\n output?: string | undefined;\n overwrite?: true | undefined;\n timestampHashAlgorithm?: string | undefined;\n verbosity?: 'q' | 'quiet' | 'm' | 'minimal' | 'n' | 'normal' | 'd' | 'detailed' | 'diag' | 'diagnostic';\n } & ({\n certificatePath: string;\n certificateSubjectName: string;\n } | {\n certificatePath: string;\n certificateFingerprint: string;\n } | {\n certificateStoreName: string;\n certificateSubjectName: string;\n } | {\n certificateStoreName: string;\n certificateFingerprint: string;\n } | {\n certificateStoreLocation: string;\n certificateSubjectName: string;\n } | {\n certificateStoreLocation: string;\n certificateFingerprint: string;\n })> = type({\n /**\n * Password for the certificate, if needed. This option can be used to specify\n * the password for the certificate. The command will throw an error message\n * if certificate is password protected but password is not provided as input.\n */\n 'certificatePassword?': 'string',\n /**\n * Hash algorithm to be used to sign the package. Defaults to SHA256.\n */\n 'hashAlgorithm?': 'string | \"SHA256\"',\n /**\n * Directory where the signed package(s) should be saved. By default the\n * original package is overwritten by the signed package.\n */\n 'output?': 'string',\n /**\n * Switch to indicate if the current signature should be overwritten. By\n * default the command will fail if the package already has a signature.\n */\n 'overwrite?': 'true',\n /**\n * URL to an RFC 3161 timestamping server.\n */\n timestamper: 'string = \"https://rfc3161.ai.moda/\"',\n /**\n * Hash algorithm to be used to sign the package. Defaults to SHA256.\n */\n 'timestampHashAlgorithm?': 'string | \"SHA256\"',\n /**\n * Set the verbosity level of the command. Allowed values are q[uiet],\n * m[inimal], n[ormal], d[etailed], and diag[nostic].\n */\n 'verbosity?': '\"q\"|\"quiet\"|\"m\"|\"minimal\"|\"n\"|\"normal\"|\"d\"|\"detailed\"|\"diag\"|\"diagnostic\"',\n}).and(\n type({\n /**\n * File path to the certificate to be used while signing the package.\n */\n certificatePath: 'string',\n }).or(\n type({\n /**\n * Name of the X.509 certificate store to use to search for the\n * certificate. Defaults to \"My\", the X.509 certificate store for personal\n * certificates.\n *\n * This option should be used when specifying the certificate via\n * --certificate-subject-name or --certificate-fingerprint options.\n */\n certificateStoreName: 'string',\n }).or({\n /**\n * Name of the X.509 certificate store use to search for the\n * certificate. Defaults to \"CurrentUser\", the X.509 certificate store\n * used by the current user.\n *\n * This option should be used when specifying the certificate via\n * --certificate-subject-name or --certificate-fingerprint options.\n */\n certificateStoreLocation: 'string',\n }),\n ).and(\n type({\n /**\n * Subject name of the certificate used to search a local certificate\n * store for the certificate. The search is a case-insensitive string\n * comparison using the supplied value, which will find all certificates\n * with the subject name containing that string, regardless of other\n * subject values. The certificate store can be specified by\n * --certificate-store-name and --certificate-store-location options.\n */\n certificateSubjectName: 'string',\n }).or({\n /**\n * SHA-256, SHA-384 or SHA-512 fingerprint of the certificate used to\n * search a local certificate store for the certificate. The certificate\n * store can be specified by --certificate-store-name and\n * --certificate-store-location options.\n */\n certificateFingerprint: 'string',\n }),\n ),\n);\n"],"mappings":";;;;;;;AASA,MAAM,mBAAmB,KAAK,KAAK,KAAK,UAAU;;;;;;;;;;;;;;;;;;AAmBlD,eAAsB,oBACpB,mBACA,uBACA,qBACiB;CACjB,MAAM,oBAAsC,EAAE;AAG9C,MAAK,MAAM,KAAK,kBAAkB,QAAO,MAAK,aAAa,eAAe,CACxE,mBAAkB,KAAK,EAAE;AAE3B,KAAI,sBACF,MAAK,MAAM,KAAK,sBAAsB,QAAO,MAAK,aAAa,kBAAkB,CAC/E,mBAAkB,KAAK,EAAE,QAAQ;AAQrC,QAAO;EAJ0B,MAAM,oBAAoB,kBAAkB;EACnC,MAAM,iBAAiB,yBAAyB,EAAE,CAAC;EAC9C,sBAAsB,oBAAoB;EAOxF,CACE,QAAO,MAAK,MAAM,KAAA,EAAU,CAC5B,KAAK,OAAO;;;;;;;;;;;;;;CAef,eAAe,oBACb,mBACiB;AAQjB,MAAI,CAAC,MAAM,QAAQ,kBAAkB,IAAI,kBAAkB,WAAW,EACpE,OAAM,IAAI,MACR,8BAA8B,OAAO,kBAAkB,6EACxD;EAIH,MAAM,2BAA6C,MAAM,QAAQ,IAC/D,kBAAkB,IAAI,OAAO,SAAkC;AAC7D,OAAI,gBAAgB,eAClB,QAAO;GAGT,MAAM,mBAAmB,kBAAkB,QAAO,MAChD,EAAE,WAAW,2BAA2BA,yBAAM,YAAY,KAAK,CAChE;AAID,OAAI,iBAAiB,WAAW,GAAG;IACjC,MAAM,QAAQ,MAAM,eAAe,SAAS;KAC1C,UAAU;KACV,aAAa,eAAe;KAC5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A,KAAK,EASH,wBAAwB,UACzB,CAAC,CAAC,GAAG,EAOJ,wBAAwB,UACzB,CAAC,CACH,CACF"}
|
package/mjs/dotnet/index.mjs
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { MSBuildProjectProperties } from "./MSBuildProjectProperties.mjs";
|
|
2
|
+
import { NPPGetterNames, NugetProjectProperties } from "./NugetProjectProperties.mjs";
|
|
3
|
+
import { EvaluationOptions, MSBuildEvaluationOutput, MSBuildProject, _InternalMSBuildEvaluationTypes, catchCsc2012, catchEBUSY } from "./MSBuildProject.mjs";
|
|
4
|
+
import { NRIOpts, NRIOptsBase, NugetRegistryInfo, getGithubOutput, getGithubOutputSync } from "./NugetRegistryInfo.mjs";
|
|
5
|
+
import { configureDotnetNugetPush, configurePrepareCmd } from "./helpers.mjs";
|
|
6
|
+
import { DefaultGithubTokenEnvVars, GHNRIOpts, GithubNugetRegistryInfo } from "./GithubNugetRegistryInfo.mjs";
|
|
7
|
+
import { GLNRIOpts, GitlabNugetRegistryInfo } from "./GitlabNugetRegistryInfo.mjs";
|
|
8
|
+
import "./IsNextVersionAlreadyPublished.cli.mjs";
|
|
9
|
+
export { DefaultGithubTokenEnvVars, EvaluationOptions, GHNRIOpts, GLNRIOpts, GithubNugetRegistryInfo, GitlabNugetRegistryInfo, MSBuildEvaluationOutput, MSBuildProject, MSBuildProjectProperties, NPPGetterNames, NRIOpts, NRIOptsBase, NugetProjectProperties, NugetRegistryInfo, _InternalMSBuildEvaluationTypes, catchCsc2012, catchEBUSY, configureDotnetNugetPush, configurePrepareCmd, getGithubOutput, getGithubOutputSync };
|
package/mjs/dotnet.mjs
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { MSBuildProjectProperties } from "./dotnet/MSBuildProjectProperties.mjs";
|
|
2
|
+
import { NPPGetterNames, NugetProjectProperties } from "./dotnet/NugetProjectProperties.mjs";
|
|
3
|
+
import { EvaluationOptions, MSBuildEvaluationOutput, MSBuildProject, _InternalMSBuildEvaluationTypes, catchCsc2012, catchEBUSY } from "./dotnet/MSBuildProject.mjs";
|
|
4
|
+
import { NRIOpts, NRIOptsBase, NugetRegistryInfo, getGithubOutput, getGithubOutputSync } from "./dotnet/NugetRegistryInfo.mjs";
|
|
5
|
+
import { configureDotnetNugetPush, configurePrepareCmd } from "./dotnet/helpers.mjs";
|
|
6
|
+
import { DefaultGithubTokenEnvVars, GHNRIOpts, GithubNugetRegistryInfo } from "./dotnet/GithubNugetRegistryInfo.mjs";
|
|
7
|
+
import { GLNRIOpts, GitlabNugetRegistryInfo } from "./dotnet/GitlabNugetRegistryInfo.mjs";
|
|
8
|
+
import "./dotnet/index.mjs";
|
|
9
|
+
export { DefaultGithubTokenEnvVars, EvaluationOptions, GHNRIOpts, GLNRIOpts, GithubNugetRegistryInfo, GitlabNugetRegistryInfo, MSBuildEvaluationOutput, MSBuildProject, MSBuildProjectProperties, NPPGetterNames, NRIOpts, NRIOptsBase, NugetProjectProperties, NugetRegistryInfo, _InternalMSBuildEvaluationTypes, catchCsc2012, catchEBUSY, configureDotnetNugetPush, configurePrepareCmd, getGithubOutput, getGithubOutputSync };
|
package/mjs/eslintConfig.mjs
CHANGED
|
@@ -1,2 +1,98 @@
|
|
|
1
|
-
import
|
|
1
|
+
import eslint from "@eslint/js";
|
|
2
|
+
import { defineConfig, globalIgnores } from "eslint/config";
|
|
3
|
+
import "eslint";
|
|
4
|
+
import stylistic from "@stylistic/eslint-plugin";
|
|
5
|
+
import json from "@eslint/json";
|
|
6
|
+
import globals from "globals/globals.json" with { type: "json" };
|
|
7
|
+
import tseslint from "typescript-eslint";
|
|
8
|
+
//#region src/eslintConfig.ts
|
|
9
|
+
const globalIgnores$1 = globalIgnores([
|
|
10
|
+
"_tsout/**/*",
|
|
11
|
+
"_tsout/*",
|
|
12
|
+
"_tsout/",
|
|
13
|
+
"cjs/**/*",
|
|
14
|
+
"cjs/*/*",
|
|
15
|
+
"cjs/*",
|
|
16
|
+
"mjs/**/*",
|
|
17
|
+
"mjs/*",
|
|
18
|
+
"mjs/",
|
|
19
|
+
"node_modules/**/*",
|
|
20
|
+
"**/node_modules/**/*",
|
|
21
|
+
"**/*.tsbuildinfo",
|
|
22
|
+
"**/bin/**/*",
|
|
23
|
+
"**/obj/**/*",
|
|
24
|
+
".pnp.cjs",
|
|
25
|
+
".pnp.loader.mjs",
|
|
26
|
+
".yarn/sdks/**"
|
|
27
|
+
]);
|
|
28
|
+
const stylisticWarn = stylistic.configs.customize({
|
|
29
|
+
quoteProps: "as-needed",
|
|
30
|
+
semi: true,
|
|
31
|
+
indent: 2,
|
|
32
|
+
severity: "warn"
|
|
33
|
+
});
|
|
34
|
+
stylisticWarn.rules ??= {};
|
|
35
|
+
stylisticWarn.rules["@stylistic/no-extra-parens"] = [
|
|
36
|
+
"warn",
|
|
37
|
+
"all",
|
|
38
|
+
{
|
|
39
|
+
allowParensAfterCommentPattern: "@type|@satisfies",
|
|
40
|
+
nestedBinaryExpressions: false
|
|
41
|
+
}
|
|
42
|
+
];
|
|
43
|
+
stylisticWarn.rules["@stylistic/semi"] = [
|
|
44
|
+
"warn",
|
|
45
|
+
"always",
|
|
46
|
+
{
|
|
47
|
+
omitLastInOneLineBlock: false,
|
|
48
|
+
omitLastInOneLineClassBody: false
|
|
49
|
+
}
|
|
50
|
+
];
|
|
51
|
+
const config = defineConfig({
|
|
52
|
+
...json.configs.recommended,
|
|
53
|
+
name: "JSON Recommended",
|
|
54
|
+
files: ["**/*.json"],
|
|
55
|
+
ignores: ["**/.vscode/*.json"],
|
|
56
|
+
language: "json/json"
|
|
57
|
+
}, {
|
|
58
|
+
name: "JSON - Allow empty keys in package-lock.json",
|
|
59
|
+
files: ["**/package-lock.json"],
|
|
60
|
+
rules: { "json/no-empty-keys": "off" }
|
|
61
|
+
}, {
|
|
62
|
+
...json.configs.recommended,
|
|
63
|
+
name: "JSONC Recommended",
|
|
64
|
+
files: ["**/*.jsonc", "**/.vscode/*.json"],
|
|
65
|
+
language: "json/jsonc"
|
|
66
|
+
}, {
|
|
67
|
+
...json.configs.recommended,
|
|
68
|
+
name: "JSON5 Recommended",
|
|
69
|
+
files: ["**/*.json5"],
|
|
70
|
+
language: "json/json5"
|
|
71
|
+
}, {
|
|
72
|
+
name: "TSJS",
|
|
73
|
+
extends: [
|
|
74
|
+
eslint.configs.recommended,
|
|
75
|
+
...tseslint.configs.strictTypeChecked,
|
|
76
|
+
...tseslint.configs.stylisticTypeChecked,
|
|
77
|
+
stylisticWarn
|
|
78
|
+
],
|
|
79
|
+
files: [
|
|
80
|
+
"**/*.ts",
|
|
81
|
+
"**/*.cts",
|
|
82
|
+
"**/*.mts",
|
|
83
|
+
"**/*.js",
|
|
84
|
+
"**/*.cjs",
|
|
85
|
+
"**/*.mjs",
|
|
86
|
+
"**/*.jsx",
|
|
87
|
+
"**/*.tsx"
|
|
88
|
+
],
|
|
89
|
+
ignores: globalIgnores$1.ignores,
|
|
90
|
+
languageOptions: {
|
|
91
|
+
parserOptions: { projectService: true },
|
|
92
|
+
globals: globals.node
|
|
93
|
+
}
|
|
94
|
+
}, globalIgnores$1);
|
|
95
|
+
//#endregion
|
|
96
|
+
export { config as default };
|
|
97
|
+
|
|
2
98
|
//# sourceMappingURL=eslintConfig.mjs.map
|
package/mjs/eslintConfig.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslintConfig.mjs","names":["globalIgnores","setGlobalIgnores"],"sources":["../src/eslintConfig.ts"],"sourcesContent":["import eslint from '@eslint/js';\nimport { defineConfig, globalIgnores as setGlobalIgnores } from 'eslint/config';\nimport { type Linter } from 'eslint';\nimport stylistic, { type RuleOptions } from '@stylistic/eslint-plugin';\nimport json from '@eslint/json';\nimport globals from 'globals/globals.json' with { type: 'json' };\nimport tseslint from 'typescript-eslint';\n\n// https://eslint.org/docs/latest/use/configure/migration-guide#using-eslintrc-configs-in-flat-config\n// https://www.google.com/search?q=javascript+recurse+through+object+and+remove+undefined+properties\n\nconst globalIgnores: ReturnType<typeof setGlobalIgnores> = setGlobalIgnores([\n '_tsout/**/*',\n '_tsout/*',\n '_tsout/',\n 'cjs/**/*',\n 'cjs/*/*',\n 'cjs/*',\n 'mjs/**/*',\n 'mjs/*',\n 'mjs/',\n 'node_modules/**/*',\n '**/node_modules/**/*',\n '**/*.tsbuildinfo',\n '**/bin/**/*',\n '**/obj/**/*',\n '.pnp.cjs',\n '.pnp.loader.mjs',\n '.yarn/sdks/**',\n]);\n\nconst stylisticWarn: Linter.Config = stylistic.configs.customize({\n quoteProps: 'as-needed',\n semi: true,\n indent: 2,\n severity: 'warn',\n});\nstylisticWarn.rules ??= {};\n\nstylisticWarn.rules['@stylistic/no-extra-parens'] = [\n 'warn',\n 'all',\n {\n allowParensAfterCommentPattern: '@type|@satisfies',\n nestedBinaryExpressions: false,\n },\n] satisfies Linter.RuleEntry<RuleOptions['@stylistic/no-extra-parens']>;\n\nstylisticWarn.rules['@stylistic/semi'] = [\n 'warn',\n 'always',\n {\n omitLastInOneLineBlock: false,\n omitLastInOneLineClassBody: false,\n },\n] satisfies Linter.RuleEntry<RuleOptions['@stylistic/semi']>;\n\nconst config: ReturnType<typeof defineConfig> = defineConfig(\n { ...json.configs.recommended, name: 'JSON Recommended', files: ['**/*.json'], ignores: ['**/.vscode/*.json'], language: 'json/json' },\n { name: 'JSON - Allow empty keys in package-lock.json', files: ['**/package-lock.json'], rules: { 'json/no-empty-keys': 'off' } },\n { ...json.configs.recommended, name: 'JSONC Recommended', files: ['**/*.jsonc', '**/.vscode/*.json'], language: 'json/jsonc' },\n { ...json.configs.recommended, name: 'JSON5 Recommended', files: ['**/*.json5'], language: 'json/json5' },\n {\n name: 'TSJS',\n extends: [\n eslint.configs.recommended,\n ...tseslint.configs.strictTypeChecked,\n ...tseslint.configs.stylisticTypeChecked,\n stylisticWarn,\n ],\n files: [\n '**/*.ts',\n '**/*.cts',\n '**/*.mts',\n '**/*.js',\n '**/*.cjs',\n '**/*.mjs',\n '**/*.jsx',\n '**/*.tsx',\n ],\n ignores: globalIgnores.ignores,\n languageOptions: {\n parserOptions: {\n projectService: true,\n },\n globals: globals.node,\n },\n },\n globalIgnores,\n);\nexport default config;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"eslintConfig.mjs","names":["globalIgnores","setGlobalIgnores"],"sources":["../src/eslintConfig.ts"],"sourcesContent":["import eslint from '@eslint/js';\nimport { defineConfig, globalIgnores as setGlobalIgnores } from 'eslint/config';\nimport { type Linter } from 'eslint';\nimport stylistic, { type RuleOptions } from '@stylistic/eslint-plugin';\nimport json from '@eslint/json';\nimport globals from 'globals/globals.json' with { type: 'json' };\nimport tseslint from 'typescript-eslint';\n\n// https://eslint.org/docs/latest/use/configure/migration-guide#using-eslintrc-configs-in-flat-config\n// https://www.google.com/search?q=javascript+recurse+through+object+and+remove+undefined+properties\n\nconst globalIgnores: ReturnType<typeof setGlobalIgnores> = setGlobalIgnores([\n '_tsout/**/*',\n '_tsout/*',\n '_tsout/',\n 'cjs/**/*',\n 'cjs/*/*',\n 'cjs/*',\n 'mjs/**/*',\n 'mjs/*',\n 'mjs/',\n 'node_modules/**/*',\n '**/node_modules/**/*',\n '**/*.tsbuildinfo',\n '**/bin/**/*',\n '**/obj/**/*',\n '.pnp.cjs',\n '.pnp.loader.mjs',\n '.yarn/sdks/**',\n]);\n\nconst stylisticWarn: Linter.Config = stylistic.configs.customize({\n quoteProps: 'as-needed',\n semi: true,\n indent: 2,\n severity: 'warn',\n});\nstylisticWarn.rules ??= {};\n\nstylisticWarn.rules['@stylistic/no-extra-parens'] = [\n 'warn',\n 'all',\n {\n allowParensAfterCommentPattern: '@type|@satisfies',\n nestedBinaryExpressions: false,\n },\n] satisfies Linter.RuleEntry<RuleOptions['@stylistic/no-extra-parens']>;\n\nstylisticWarn.rules['@stylistic/semi'] = [\n 'warn',\n 'always',\n {\n omitLastInOneLineBlock: false,\n omitLastInOneLineClassBody: false,\n },\n] satisfies Linter.RuleEntry<RuleOptions['@stylistic/semi']>;\n\nconst config: ReturnType<typeof defineConfig> = defineConfig(\n { ...json.configs.recommended, name: 'JSON Recommended', files: ['**/*.json'], ignores: ['**/.vscode/*.json'], language: 'json/json' },\n { name: 'JSON - Allow empty keys in package-lock.json', files: ['**/package-lock.json'], rules: { 'json/no-empty-keys': 'off' } },\n { ...json.configs.recommended, name: 'JSONC Recommended', files: ['**/*.jsonc', '**/.vscode/*.json'], language: 'json/jsonc' },\n { ...json.configs.recommended, name: 'JSON5 Recommended', files: ['**/*.json5'], language: 'json/json5' },\n {\n name: 'TSJS',\n extends: [\n eslint.configs.recommended,\n ...tseslint.configs.strictTypeChecked,\n ...tseslint.configs.stylisticTypeChecked,\n stylisticWarn,\n ],\n files: [\n '**/*.ts',\n '**/*.cts',\n '**/*.mts',\n '**/*.js',\n '**/*.cjs',\n '**/*.mjs',\n '**/*.jsx',\n '**/*.tsx',\n ],\n ignores: globalIgnores.ignores,\n languageOptions: {\n parserOptions: {\n projectService: true,\n },\n globals: globals.node,\n },\n },\n globalIgnores,\n);\nexport default config;\n"],"mappings":";;;;;;;;AAWA,MAAMA,kBAAqDC,cAAiB;CAC1E;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;AAEF,MAAM,gBAA+B,UAAU,QAAQ,UAAU;CAC/D,YAAY;CACZ,MAAM;CACN,QAAQ;CACR,UAAU;CACX,CAAC;AACF,cAAc,UAAU,EAAE;AAE1B,cAAc,MAAM,gCAAgC;CAClD;CACA;CACA;EACE,gCAAgC;EAChC,yBAAyB;EAC1B;CACF;AAED,cAAc,MAAM,qBAAqB;CACvC;CACA;CACA;EACE,wBAAwB;EACxB,4BAA4B;EAC7B;CACF;AAED,MAAM,SAA0C,aAC9C;CAAE,GAAG,KAAK,QAAQ;CAAa,MAAM;CAAoB,OAAO,CAAC,YAAY;CAAE,SAAS,CAAC,oBAAoB;CAAE,UAAU;CAAa,EACtI;CAAE,MAAM;CAAgD,OAAO,CAAC,uBAAuB;CAAE,OAAO,EAAE,sBAAsB,OAAO;CAAE,EACjI;CAAE,GAAG,KAAK,QAAQ;CAAa,MAAM;CAAqB,OAAO,CAAC,cAAc,oBAAoB;CAAE,UAAU;CAAc,EAC9H;CAAE,GAAG,KAAK,QAAQ;CAAa,MAAM;CAAqB,OAAO,CAAC,aAAa;CAAE,UAAU;CAAc,EACzG;CACE,MAAM;CACN,SAAS;EACP,OAAO,QAAQ;EACf,GAAG,SAAS,QAAQ;EACpB,GAAG,SAAS,QAAQ;EACpB;EACD;CACD,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD;CACD,SAASD,gBAAc;CACvB,iBAAiB;EACf,eAAe,EACb,gBAAgB,MACjB;EACD,SAAS,QAAQ;EAClB;CACF,EACDA,gBACD"}
|
package/mjs/index.mjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{baseConfig
|
|
1
|
+
import { baseConfig } from "./semanticReleaseConfig.mjs";
|
|
2
|
+
export { baseConfig as default };
|
package/mjs/insertPlugins.mjs
CHANGED
|
@@ -1,2 +1,36 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/insertPlugins.ts
|
|
2
|
+
/**
|
|
3
|
+
* @param plugins {@link SemanticReleaseOptions.plugins}
|
|
4
|
+
* @param afterPluginsIDs The `string` IDs of plugins that the {@link insertPluginIDs} must follow.
|
|
5
|
+
* @param insertPluginIDs The `string` IDs of plugins to insert into a copy of the {@link plugins} array.
|
|
6
|
+
* @param beforePluginsIDs The `string` IDs of plugins that the {@link insertPluginIDs} must precede.
|
|
7
|
+
* @returns
|
|
8
|
+
* A modified copy of {@link plugins} with the given plugins inserted
|
|
9
|
+
* before {@link beforePluginsIDs} and after {@link afterPluginsIDs}.
|
|
10
|
+
*
|
|
11
|
+
* Inserted plugins will be a `[string, {}]` tuple.
|
|
12
|
+
* @throws {ReferenceError} This should never occur. One or more of the
|
|
13
|
+
* {@link afterPluginsIDs} had been found in {@link plugins}, but a `.find` call
|
|
14
|
+
* to get the highest index of the found plugins had returned `undefined`
|
|
15
|
+
* @throws {AggregateError} One or more error occurred when inserting plugins: `insertPlugin was instructed to insert one or more plugins after [${afterPluginsIDs.map(v => '"' + v + '"').join(', ')}] and before [${beforePluginsIDs.map(v => `"${v}"`).join(', ')}], but ${JSON.stringify(pluginIDs[indexOfLastAfter])} comes after ${JSON.stringify(pluginIDs[index])}!`
|
|
16
|
+
*/
|
|
17
|
+
function insertPlugin(plugins, afterPluginsIDs, insertPluginIDs, beforePluginsIDs) {
|
|
18
|
+
const pluginIDs = plugins.map((v) => typeof v === "string" ? v : v[0]);
|
|
19
|
+
const indexOfLastAfter = afterPluginsIDs.filter((v) => pluginIDs.includes(v)).map((v) => pluginIDs.indexOf(v)).sort().find((_v, i, obj) => i === obj.length - 1);
|
|
20
|
+
if (void 0 === indexOfLastAfter) throw new ReferenceError("An attempt to get the last element of an array returned undefined.");
|
|
21
|
+
const indicesOfBefore = beforePluginsIDs.filter((v) => pluginIDs.includes(v)).map((v) => pluginIDs.indexOf(v)).sort();
|
|
22
|
+
const errors = [];
|
|
23
|
+
for (const index of indicesOfBefore) if (index <= indexOfLastAfter) errors.push(/* @__PURE__ */ new Error(`insertPlugin was instructed to insert one or more plugins after [${afterPluginsIDs.map((v) => "\"" + v + "\"").join(", ")}] and before [${beforePluginsIDs.map((v) => `"${v}"`).join(", ")}], but ${JSON.stringify(pluginIDs[indexOfLastAfter])} comes after ${JSON.stringify(pluginIDs[index])}!`));
|
|
24
|
+
if (errors.length > 0) throw new AggregateError(errors, "One or more errors occurred while inserting plugin configs into the Semantic Release config!");
|
|
25
|
+
const beforeInsert = plugins.slice(0, indexOfLastAfter + 1);
|
|
26
|
+
const afterInsert = plugins.slice(indexOfLastAfter + 1, plugins.length + 1);
|
|
27
|
+
return [
|
|
28
|
+
...beforeInsert,
|
|
29
|
+
...insertPluginIDs.map((id) => [id, {}]),
|
|
30
|
+
...afterInsert
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { insertPlugin };
|
|
35
|
+
|
|
2
36
|
//# sourceMappingURL=insertPlugins.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insertPlugins.mjs","names":[],"sources":["../src/insertPlugins.ts"],"sourcesContent":["import type {\n PluginSpec,\n Options as SemanticReleaseOptions,\n} from 'semantic-release';\n\n/**\n * @since 3.0.0\n * @deprecated EXPERIMENTAL\n */\ninterface PluginInsertRuleSet {\n Id: string;\n BeforeIds: string[];\n AfterIds: string[];\n}\n\n/**\n * [W.I.P. STUB]\n *\n * Given an array of {@link PluginInsertRuleSet}s, insert plugins into a\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/Window/structuredClone structured clone}\n * (i.e. deep-copy) of the {@link plugins} array, sort the plugin entries, and\n * return the modified array copy.\n * @todo implement\n * @param plugins Your {@link SemanticReleaseOptions.plugins} array.\n * @param inserts An array of {@link PluginInsertRuleSet}s.\n *\n * If a plugin is already in the plugins array, inserting is skipped. The\n * existing entry is sorted according to its ruleset.\n *\n * If any rulesets conflict, an error will be thrown.\n * - error: A must precede B; B must precede A.\n * - pass: C must precede D and E; D must precede E and follow B. Add ruleset\n * interface: {Id:string, BeforeIds:string[], AfterIds:string[] }\n * @returns A deep-cloned, modified copy of {@link plugins} with plugins\n * inserted and sorted where needed.\n * @since 3.0.0\n * @deprecated EXPERIMENTAL\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\ndeclare function insertAndSortPlugins(\n plugins: Exclude<SemanticReleaseOptions['plugins'], undefined>,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n inserts: PluginInsertRuleSet[],\n): PluginSpec[];\n\n/**\n * @param plugins {@link SemanticReleaseOptions.plugins}\n * @param afterPluginsIDs The `string` IDs of plugins that the {@link insertPluginIDs} must follow.\n * @param insertPluginIDs The `string` IDs of plugins to insert into a copy of the {@link plugins} array.\n * @param beforePluginsIDs The `string` IDs of plugins that the {@link insertPluginIDs} must precede.\n * @returns\n * A modified copy of {@link plugins} with the given plugins inserted\n * before {@link beforePluginsIDs} and after {@link afterPluginsIDs}.\n *\n * Inserted plugins will be a `[string, {}]` tuple.\n * @throws {ReferenceError} This should never occur. One or more of the\n * {@link afterPluginsIDs} had been found in {@link plugins}, but a `.find` call\n * to get the highest index of the found plugins had returned `undefined`\n * @throws {AggregateError} One or more error occurred when inserting plugins: `insertPlugin was instructed to insert one or more plugins after [${afterPluginsIDs.map(v => '\"' + v + '\"').join(', ')}] and before [${beforePluginsIDs.map(v => `\"${v}\"`).join(', ')}], but ${JSON.stringify(pluginIDs[indexOfLastAfter])} comes after ${JSON.stringify(pluginIDs[index])}!`\n */\nexport function insertPlugin(\n plugins: Exclude<PluginSpec, string>[],\n afterPluginsIDs: string[],\n insertPluginIDs: string[],\n beforePluginsIDs: string[],\n): Exclude<PluginSpec, string>[] {\n const pluginIDs = plugins.map(v =>\n typeof v === 'string' ? v : v[0],\n );\n\n // if any beforePluginIDs are ordered before the last afterPlugin, throw. Impossible to sort.\n\n const indexOfLastAfter = afterPluginsIDs\n .filter(v => pluginIDs.includes(v))\n .map(v => pluginIDs.indexOf(v))\n .sort()\n .find((_v, i, obj) => i === obj.length - 1);\n if (undefined === indexOfLastAfter)\n throw new ReferenceError(\n 'An attempt to get the last element of an array returned undefined.',\n );\n\n const indicesOfBefore = beforePluginsIDs\n .filter(v => pluginIDs.includes(v))\n .map(v => pluginIDs.indexOf(v))\n .sort();\n\n // This for-of collects *all* sorting errors. The resulting AggregateError\n // notifies the API user of *all* errors in the order rather than just the\n // first error encountered.\n const errors: Error[] = [];\n for (const index of indicesOfBefore) {\n if (index <= indexOfLastAfter) {\n errors.push(\n new Error(\n `insertPlugin was instructed to insert one or more plugins after [${afterPluginsIDs.map(v => '\"' + v + '\"').join(', ')}] and before [${beforePluginsIDs.map(v => `\"${v}\"`).join(', ')}], but ${JSON.stringify(pluginIDs[indexOfLastAfter])} comes after ${JSON.stringify(pluginIDs[index])}!`,\n ),\n );\n }\n }\n if (errors.length > 0)\n throw new AggregateError(errors, 'One or more errors occurred while inserting plugin configs into the Semantic Release config!');\n\n // insert plugin(s)\n\n const beforeInsert = plugins.slice(0, indexOfLastAfter + 1);\n const afterInsert = plugins.slice(indexOfLastAfter + 1, plugins.length + 1);\n\n return [\n ...beforeInsert,\n ...insertPluginIDs.map(id =>\n [id, {}] as [string, unknown],\n ),\n ...afterInsert,\n ];\n}\n"],"mappings":"AA4DA,SAAgB,
|
|
1
|
+
{"version":3,"file":"insertPlugins.mjs","names":[],"sources":["../src/insertPlugins.ts"],"sourcesContent":["import type {\n PluginSpec,\n Options as SemanticReleaseOptions,\n} from 'semantic-release';\n\n/**\n * @since 3.0.0\n * @deprecated EXPERIMENTAL\n */\ninterface PluginInsertRuleSet {\n Id: string;\n BeforeIds: string[];\n AfterIds: string[];\n}\n\n/**\n * [W.I.P. STUB]\n *\n * Given an array of {@link PluginInsertRuleSet}s, insert plugins into a\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/Window/structuredClone structured clone}\n * (i.e. deep-copy) of the {@link plugins} array, sort the plugin entries, and\n * return the modified array copy.\n * @todo implement\n * @param plugins Your {@link SemanticReleaseOptions.plugins} array.\n * @param inserts An array of {@link PluginInsertRuleSet}s.\n *\n * If a plugin is already in the plugins array, inserting is skipped. The\n * existing entry is sorted according to its ruleset.\n *\n * If any rulesets conflict, an error will be thrown.\n * - error: A must precede B; B must precede A.\n * - pass: C must precede D and E; D must precede E and follow B. Add ruleset\n * interface: {Id:string, BeforeIds:string[], AfterIds:string[] }\n * @returns A deep-cloned, modified copy of {@link plugins} with plugins\n * inserted and sorted where needed.\n * @since 3.0.0\n * @deprecated EXPERIMENTAL\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\ndeclare function insertAndSortPlugins(\n plugins: Exclude<SemanticReleaseOptions['plugins'], undefined>,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n inserts: PluginInsertRuleSet[],\n): PluginSpec[];\n\n/**\n * @param plugins {@link SemanticReleaseOptions.plugins}\n * @param afterPluginsIDs The `string` IDs of plugins that the {@link insertPluginIDs} must follow.\n * @param insertPluginIDs The `string` IDs of plugins to insert into a copy of the {@link plugins} array.\n * @param beforePluginsIDs The `string` IDs of plugins that the {@link insertPluginIDs} must precede.\n * @returns\n * A modified copy of {@link plugins} with the given plugins inserted\n * before {@link beforePluginsIDs} and after {@link afterPluginsIDs}.\n *\n * Inserted plugins will be a `[string, {}]` tuple.\n * @throws {ReferenceError} This should never occur. One or more of the\n * {@link afterPluginsIDs} had been found in {@link plugins}, but a `.find` call\n * to get the highest index of the found plugins had returned `undefined`\n * @throws {AggregateError} One or more error occurred when inserting plugins: `insertPlugin was instructed to insert one or more plugins after [${afterPluginsIDs.map(v => '\"' + v + '\"').join(', ')}] and before [${beforePluginsIDs.map(v => `\"${v}\"`).join(', ')}], but ${JSON.stringify(pluginIDs[indexOfLastAfter])} comes after ${JSON.stringify(pluginIDs[index])}!`\n */\nexport function insertPlugin(\n plugins: Exclude<PluginSpec, string>[],\n afterPluginsIDs: string[],\n insertPluginIDs: string[],\n beforePluginsIDs: string[],\n): Exclude<PluginSpec, string>[] {\n const pluginIDs = plugins.map(v =>\n typeof v === 'string' ? v : v[0],\n );\n\n // if any beforePluginIDs are ordered before the last afterPlugin, throw. Impossible to sort.\n\n const indexOfLastAfter = afterPluginsIDs\n .filter(v => pluginIDs.includes(v))\n .map(v => pluginIDs.indexOf(v))\n .sort()\n .find((_v, i, obj) => i === obj.length - 1);\n if (undefined === indexOfLastAfter)\n throw new ReferenceError(\n 'An attempt to get the last element of an array returned undefined.',\n );\n\n const indicesOfBefore = beforePluginsIDs\n .filter(v => pluginIDs.includes(v))\n .map(v => pluginIDs.indexOf(v))\n .sort();\n\n // This for-of collects *all* sorting errors. The resulting AggregateError\n // notifies the API user of *all* errors in the order rather than just the\n // first error encountered.\n const errors: Error[] = [];\n for (const index of indicesOfBefore) {\n if (index <= indexOfLastAfter) {\n errors.push(\n new Error(\n `insertPlugin was instructed to insert one or more plugins after [${afterPluginsIDs.map(v => '\"' + v + '\"').join(', ')}] and before [${beforePluginsIDs.map(v => `\"${v}\"`).join(', ')}], but ${JSON.stringify(pluginIDs[indexOfLastAfter])} comes after ${JSON.stringify(pluginIDs[index])}!`,\n ),\n );\n }\n }\n if (errors.length > 0)\n throw new AggregateError(errors, 'One or more errors occurred while inserting plugin configs into the Semantic Release config!');\n\n // insert plugin(s)\n\n const beforeInsert = plugins.slice(0, indexOfLastAfter + 1);\n const afterInsert = plugins.slice(indexOfLastAfter + 1, plugins.length + 1);\n\n return [\n ...beforeInsert,\n ...insertPluginIDs.map(id =>\n [id, {}] as [string, unknown],\n ),\n ...afterInsert,\n ];\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA4DA,SAAgB,aACd,SACA,iBACA,iBACA,kBAC+B;CAC/B,MAAM,YAAY,QAAQ,KAAI,MAC5B,OAAO,MAAM,WAAW,IAAI,EAAE,GAC/B;CAID,MAAM,mBAAmB,gBACtB,QAAO,MAAK,UAAU,SAAS,EAAE,CAAC,CAClC,KAAI,MAAK,UAAU,QAAQ,EAAE,CAAC,CAC9B,MAAM,CACN,MAAM,IAAI,GAAG,QAAQ,MAAM,IAAI,SAAS,EAAE;AAC7C,KAAI,KAAA,MAAc,iBAChB,OAAM,IAAI,eACR,qEACD;CAEH,MAAM,kBAAkB,iBACrB,QAAO,MAAK,UAAU,SAAS,EAAE,CAAC,CAClC,KAAI,MAAK,UAAU,QAAQ,EAAE,CAAC,CAC9B,MAAM;CAKT,MAAM,SAAkB,EAAE;AAC1B,MAAK,MAAM,SAAS,gBAClB,KAAI,SAAS,iBACX,QAAO,qBACL,IAAI,MACF,oEAAoE,gBAAgB,KAAI,MAAK,OAAM,IAAI,KAAI,CAAC,KAAK,KAAK,CAAC,gBAAgB,iBAAiB,KAAI,MAAK,IAAI,EAAE,GAAG,CAAC,KAAK,KAAK,CAAC,SAAS,KAAK,UAAU,UAAU,kBAAkB,CAAC,eAAe,KAAK,UAAU,UAAU,OAAO,CAAC,GAC5R,CACF;AAGL,KAAI,OAAO,SAAS,EAClB,OAAM,IAAI,eAAe,QAAQ,+FAA+F;CAIlI,MAAM,eAAe,QAAQ,MAAM,GAAG,mBAAmB,EAAE;CAC3D,MAAM,cAAc,QAAQ,MAAM,mBAAmB,GAAG,QAAQ,SAAS,EAAE;AAE3E,QAAO;EACL,GAAG;EACH,GAAG,gBAAgB,KAAI,OACrB,CAAC,IAAI,EAAE,CAAC,CACT;EACD,GAAG;EACJ"}
|
|
@@ -1,2 +1,64 @@
|
|
|
1
|
-
import{DefaultOptions
|
|
1
|
+
import { DefaultOptions } from "./setupGitPluginSpec.default.mjs";
|
|
2
|
+
//#region src/semanticReleaseConfig.ts
|
|
3
|
+
/**
|
|
4
|
+
* @satisfies { Readonly<PluginSpec[]> }
|
|
5
|
+
*/
|
|
6
|
+
const defaultPlugins = Object.freeze([
|
|
7
|
+
"@semantic-release/commit-analyzer",
|
|
8
|
+
"@semantic-release/release-notes-generator",
|
|
9
|
+
"@semantic-release/npm",
|
|
10
|
+
"@semantic-release/github"
|
|
11
|
+
]);
|
|
12
|
+
/**
|
|
13
|
+
* The base configuration for various Semantic Release scenarios.
|
|
14
|
+
* - Prefers preset "conventionalcommits"
|
|
15
|
+
* (Conventional-Changelog-ConventionalCommits).
|
|
16
|
+
* - Creates tags and release commits on "main" branch, pre-releases on
|
|
17
|
+
* "develop" branch in "develop" channel.
|
|
18
|
+
* - Creates GitHub Releases.
|
|
19
|
+
* - Exports the following variables as GitHub Actions outputs:
|
|
20
|
+
* - "new-release-published": "true" | "false"
|
|
21
|
+
* - "new-release-version" : string
|
|
22
|
+
* - "new-release-git-tag" : string
|
|
23
|
+
* - includes default plugins (except `@semantic-release/npm`) and more
|
|
24
|
+
* - `@semantic-release/commit-analyzer`
|
|
25
|
+
* - semantic-release-export-data
|
|
26
|
+
* - `@semantic-release/release-notes-generator`
|
|
27
|
+
* - `@semantic-release/changelog`
|
|
28
|
+
* - `@semantic-release/git`
|
|
29
|
+
* - add modified CHANGELOG.md in release commit
|
|
30
|
+
* - `@semantic-release/exec`
|
|
31
|
+
* - does nothing by default. Included for convenience.
|
|
32
|
+
* - `@semantic-release/github`
|
|
33
|
+
* - uploads all files from `./publish/*`. This is non-recursive.
|
|
34
|
+
* - adds a list of links to related release pages (e.g. the release's page on npmjs.com)
|
|
35
|
+
*
|
|
36
|
+
* (OPTIONAL) update static Version strings before Git plugin
|
|
37
|
+
* - https://github.com/jpoehnelt/semantic-release-replace-plugin
|
|
38
|
+
* - https://github.com/droidsolutions/semantic-release-update-file
|
|
39
|
+
* @satisfies {Options}
|
|
40
|
+
*/
|
|
41
|
+
const baseConfig = {
|
|
42
|
+
preset: "conventionalcommits",
|
|
43
|
+
branches: ["main", {
|
|
44
|
+
name: "develop",
|
|
45
|
+
channel: "develop",
|
|
46
|
+
prerelease: true
|
|
47
|
+
}],
|
|
48
|
+
plugins: [
|
|
49
|
+
["@semantic-release/commit-analyzer", {}],
|
|
50
|
+
["semantic-release-export-data", {}],
|
|
51
|
+
["@semantic-release/release-notes-generator", {}],
|
|
52
|
+
["@semantic-release/changelog", {}],
|
|
53
|
+
["@semantic-release/git", DefaultOptions],
|
|
54
|
+
["@semantic-release/exec", {}],
|
|
55
|
+
["@semantic-release/github", {
|
|
56
|
+
addReleases: "bottom",
|
|
57
|
+
assets: ["./publish/*", "!./publish/.gitkeep"]
|
|
58
|
+
}]
|
|
59
|
+
]
|
|
60
|
+
};
|
|
61
|
+
//#endregion
|
|
62
|
+
export { baseConfig, defaultPlugins };
|
|
63
|
+
|
|
2
64
|
//# sourceMappingURL=semanticReleaseConfig.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"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 * Requireable npm package with a custom conventional-changelog preset.\n */\n config?: string | undefined;\n /**\n * Additional `conventional-changelog-parser` options that will overwrite ones loaded by `preset` or `config`.\n */\n parserOpts: object;\n /**\n * Additional `conventional-changelog-writer` options that will overwrite ones loaded by `preset` or `config`.\n */\n writerOpts: object;\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":"
|
|
1
|
+
{"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 * Requireable npm package with a custom conventional-changelog preset.\n */\n config?: string | undefined;\n /**\n * Additional `conventional-changelog-parser` options that will overwrite ones loaded by `preset` or `config`.\n */\n parserOpts: object;\n /**\n * Additional `conventional-changelog-writer` options that will overwrite ones loaded by `preset` or `config`.\n */\n writerOpts: object;\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":";;;;;AAgDA,MAAa,iBAKT,OAAO,OAAO;CAChB;CACA;CACA;CACA;CACD,CAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DX,MAAa,aAvDO;CAElB,QAAQ;CACR,UAAU,CACR,QACA;EAAE,MAAM;EAAW,SAAS;EAAW,YAAY;EAAM,CAC1D;CACD,SAAS;EACP,CAAC,qCAAqC,EAAE,CAAC;EACzC,CAAC,gCAAgC,EAAE,CAAC;EACpC,CAAC,6CAA6C,EAAE,CAAC;EACjD,CAAC,+BAA+B,EAAE,CAAC;EACnC,CAAC,yBAAyB,eAAe;EACzC,CAAC,0BAA0B,EAAE,CAAC;EAC9B,CAAC,4BAA4B;GAAE,aAAa;GAAU,QAAQ,CAAC,eAAe,sBAAsB;GAAE,CAAC;EACxG;CASF"}
|