@storm-software/build-tools
Version:
A comprehensive set of tools for building and managing projects within a Storm workspace. Includes builders such as rollup, rolldown, tsup, and unbuild, along with various utilities.
41 lines (34 loc) • 3.46 kB
JavaScript
;Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/utilities/get-file-banner.ts
var getFileBanner = (name, commentStart = "//") => {
let padding = "";
while (name.length + padding.length < 12) {
padding += " ";
}
let titleName = _nullishCoalesce(process.env.STORM_NAMESPACE, () => ( ""));
if (titleName) {
if (_optionalChain([titleName, 'optionalAccess', _ => _.startsWith, 'call', _2 => _2("@")])) {
titleName = titleName.slice(1);
}
titleName = (titleName.charAt(0).toUpperCase() + titleName.slice(1)).split("-").filter((word) => word && word.length > 0).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
}
return `
${commentStart} -------------------------------------------------------------------
${commentStart}
${commentStart} ${padding}Storm Software
${commentStart} \u26A1 ${titleName ? name ? `${titleName} - ` : titleName : ""}${name && name.length > 0 ? name.charAt(0).toUpperCase() + name.slice(1) : name}
${commentStart}
${commentStart} This code was released as part of the ${titleName ? `${titleName} ` : ""}project. ${titleName ? titleName : "This project"}
${commentStart} is maintained by Storm Software under the ${_optionalChain([(_nullishCoalesce(process.env.STORM_LICENSE, () => ( "Apache-2.0"))), 'optionalAccess', _3 => _3.toLowerCase, 'call', _4 => _4(), 'optionalAccess', _5 => _5.includes, 'call', _6 => _6("license")]) ? _nullishCoalesce(process.env.STORM_LICENSE, () => ( "Apache-2.0")) : `${_nullishCoalesce(process.env.STORM_LICENSE, () => ( "Apache-2.0"))} License`}, and is
${commentStart} free for commercial and private use. For more information, please visit
${commentStart} our licensing page.
${commentStart}
${commentStart} Website: ${_nullishCoalesce(process.env.STORM_HOMEPAGE, () => ( "https://stormsoftware.com"))}
${commentStart} Repository: ${_nullishCoalesce(process.env.STORM_REPOSITORY, () => ( "https://github.com/storm-software/storm-stack"))}
${commentStart} Documentation: https://docs.stormsoftware.com${_optionalChain([titleName, 'optionalAccess', _7 => _7.startsWith, 'call', _8 => _8("@")]) ? `/projects/${titleName.slice(1).trim().replaceAll(/\s+/g, "-").toLowerCase()}` : ""}
${commentStart} Contact: ${process.env.STORM_HOMEPAGE ? process.env.STORM_HOMEPAGE.endsWith("/") ? process.env.STORM_HOMEPAGE.slice(-1) : process.env.STORM_HOMEPAGE : "https://stormsoftware.com"}/contact
${commentStart} Licensing: ${process.env.STORM_HOMEPAGE ? process.env.STORM_HOMEPAGE.endsWith("/") ? process.env.STORM_HOMEPAGE.slice(-1) : process.env.STORM_HOMEPAGE : "https://stormsoftware.com"}/licensing
${commentStart}
${commentStart} -------------------------------------------------------------------
`;
};
exports.getFileBanner = getFileBanner;