@lerna/publish
Version:
Publish packages in the current project
112 lines (111 loc) • 4.58 kB
JavaScript
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);
var log_packed_exports = {};
__export(log_packed_exports, {
logPacked: () => logPacked
});
module.exports = __toCommonJS(log_packed_exports);
var import_byte_size = __toESM(require("byte-size"));
var import_columnify = __toESM(require("columnify"));
var import_npmlog = __toESM(require("npmlog"));
var import_has_unicode = __toESM(require("has-unicode"));
const hasUnicode = (0, import_has_unicode.default)();
function logPacked(tarball) {
import_npmlog.default.notice("");
import_npmlog.default.notice("", `${hasUnicode ? "\u{1F4E6} " : "package:"} ${tarball.name}@${tarball.version}`);
if (tarball.files && tarball.files.length) {
import_npmlog.default.notice("=== Tarball Contents ===");
import_npmlog.default.notice(
"",
(0, import_columnify.default)(
tarball.files.map((f) => {
const bytes = (0, import_byte_size.default)(f.size);
return {
path: f.path,
size: `${bytes.value}${bytes.unit}`
};
}),
{
// TODO: refactor based on TS feedback
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
include: ["size", "path"],
showHeaders: false
}
)
);
}
if (tarball.bundled && tarball.bundled.length) {
import_npmlog.default.notice("=== Bundled Dependencies ===");
tarball.bundled.forEach((name) => import_npmlog.default.notice("", name));
}
import_npmlog.default.notice("=== Tarball Details ===");
import_npmlog.default.notice(
"",
(0, import_columnify.default)(
[
{ name: "name:", value: tarball.name },
{ name: "version:", value: tarball.version },
tarball.filename && { name: "filename:", value: tarball.filename },
tarball.size && { name: "package size:", value: (0, import_byte_size.default)(tarball.size) },
tarball.unpackedSize && { name: "unpacked size:", value: (0, import_byte_size.default)(tarball.unpackedSize) },
tarball.shasum && { name: "shasum:", value: tarball.shasum },
tarball.integrity && { name: "integrity:", value: elideIntegrity(tarball.integrity) },
tarball.bundled && tarball.bundled.length && {
name: "bundled deps:",
value: tarball.bundled.length
},
tarball.bundled && tarball.bundled.length && {
name: "bundled files:",
value: tarball.entryCount - tarball.files.length
},
tarball.bundled && tarball.bundled.length && {
name: "own files:",
value: tarball.files.length
},
tarball.entryCount && { name: "total files:", value: tarball.entryCount }
].filter((x) => x),
{
// TODO: refactor based on TS feedback
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
include: ["name", "value"],
showHeaders: false
}
)
);
import_npmlog.default.notice("", "");
}
function elideIntegrity(integrity) {
const str = integrity.toString();
return `${str.substr(0, 20)}[...]${str.substr(80)}`;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
logPacked
});