UNPKG

@eljs/release

Version:
66 lines (64 loc) 2.47 kB
var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/internal/plugins/github.ts var github_exports = {}; __export(github_exports, { default: () => github_default }); module.exports = __toCommonJS(github_exports); var import_utils = require("@eljs/utils"); var import_new_github_release_url = __toESM(require("new-github-release-url")); var import_open = __toESM(require("open")); var github_default = (api) => { api.describe({ enable() { return (0, import_utils.getGitUrlSync)(api.cwd).includes("github"); } }); api.onRelease(async ({ version, isPrerelease, changelog }) => { var _a; if (!api.config.github.release || !changelog) { return; } const gitUrl = await (0, import_utils.getGitUrl)(api.cwd, true); if (!gitUrl) { return; } const repoUrl = (_a = (0, import_utils.gitUrlAnalysis)(gitUrl)) == null ? void 0 : _a.href; if (!repoUrl) { return; } const url = await (0, import_new_github_release_url.default)({ repoUrl, tag: `v${version}`, body: changelog, isPrerelease }); await (0, import_open.default)(url); }); };