@lerna/publish
Version:
Publish packages in the current project
41 lines (40 loc) • 1.64 kB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var apply_build_metadata_exports = {};
__export(apply_build_metadata_exports, {
applyBuildMetadata: () => applyBuildMetadata
});
module.exports = __toCommonJS(apply_build_metadata_exports);
var import_validation_error = require("../validation-error");
const BUILD_METADATA_REGEX = /^[0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*$/;
function applyBuildMetadata(version, buildMetadata) {
if (!buildMetadata) {
return version;
}
if (isValidBuildMetadata(buildMetadata)) {
return `${version}+${buildMetadata}`;
}
throw new import_validation_error.ValidationError("EBUILDMETADATA", "Build metadata does not satisfy SemVer specification.");
}
function isValidBuildMetadata(buildMetadata) {
return BUILD_METADATA_REGEX.test(buildMetadata);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
applyBuildMetadata
});