@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
41 lines (40 loc) • 1.83 kB
JavaScript
import { getEnvVarValue } from "../utils/env.mjs";
import { NRIOptsBase, NugetRegistryInfo } from "./NugetRegistryInfo.mjs";
//#region src/dotnet/GithubNugetRegistryInfo.ts
const NUGET_PKG_GITHUB_COM = "https://nuget.pkg.github.com";
const DefaultGithubTokenEnvVars = Object.freeze(["GH_TOKEN", "GITHUB_TOKEN"]);
var GithubNugetRegistryInfo = class extends NugetRegistryInfo {
static NUGET_PKG_GITHUB_COM = "https://nuget.pkg.github.com";
/**
* Returns `https://nuget.pkg.github.com/${GITHUB_REPOSITORY_OWNER}/index.json`
* or (if GITHUB_REPOSITORY_OWNER is not defined in {@link process.env} nor
* {@link process.cwd() $CWD}/.env) `undefined`.
* @returns If GITHUB_REPOSITORY_OWNER is defined, returns the GitHub Package Repository URL endpoint for NuGet pushes (--source).\
* Otherwise, returns `undefined`
*/
static getNugetGitHubUrl() {
const owner = getEnvVarValue("GITHUB_REPOSITORY_OWNER");
return owner === void 0 ? void 0 : `${NUGET_PKG_GITHUB_COM}/${owner}/index.json`;
}
/**
* Creates an instance of GithubNugetRegistryInfo.
* @param opts The input type of {@link GHNRIOpts.from}
*/
constructor(opts) {
super(GHNRIOpts.from(opts));
}
};
const GHNRI = GithubNugetRegistryInfo;
/**
* The default value of {@link GHNRIOpts.t.source `source`} is dependent on
* {@link GHNRI.getNugetGitHubUrl} and will default to an empty string if the
* environment variable `GITHUB_REPOSITORY_OWNER` is undefined!
*/
const GHNRIOpts = NRIOptsBase.merge({
/** @see {@link GHNRI.getNugetGitHubUrl } */
source: NRIOptsBase.get("source").default(() => GHNRI.getNugetGitHubUrl() ?? ""),
tokenEnvVars: NRIOptsBase.get("tokenEnvVars").default(() => DefaultGithubTokenEnvVars)
});
//#endregion
export { DefaultGithubTokenEnvVars, GHNRIOpts, GithubNugetRegistryInfo };
//# sourceMappingURL=GithubNugetRegistryInfo.mjs.map