diff --git a/automation/utils/bin/rui-include-oss-in-artifact.ts b/automation/utils/bin/rui-include-oss-in-artifact.ts index 693d5416f5..c325e80b14 100755 --- a/automation/utils/bin/rui-include-oss-in-artifact.ts +++ b/automation/utils/bin/rui-include-oss-in-artifact.ts @@ -54,7 +54,7 @@ async function main(): Promise { if (!htmlAsset) { console.log(chalk.yellow("โš ๏ธ No HTML file found in release - nothing to include")); console.log(chalk.gray(" Skipping MPK modification\n")); - process.exit(0); + return; } console.log(chalk.green(`โœ… Found HTML: ${htmlAsset.name}`)); @@ -80,8 +80,8 @@ async function main(): Promise { await includeReadmeOssIntoMpk(htmlPath, mpkPath); console.log(chalk.green("โœ… Merge completed")); - // Step 5: Remove old assets, upload patched MPK - console.log(chalk.blue("\n๐Ÿ”„ Replacing MPK asset in release...")); + // Step 5: Remove old assets and upload patched MPK + console.log(chalk.blue("\n๐Ÿ”„ Replacing assets in release...")); console.log(chalk.gray(` โ†’ Deleting old MPK asset...`)); await gh.deleteReleaseAsset(mpkAsset.id); @@ -93,16 +93,23 @@ async function main(): Promise { const newAsset = await gh.uploadReleaseAsset(releaseId, mpkPath, mpkAsset.name); console.log(chalk.green(`โœ… Successfully replaced MPK asset (ID: ${newAsset.id})`)); - console.log(chalk.bold.green(`\n๐ŸŽ‰ Process completed successfully!\n`)); + + // Summary + console.log(chalk.bold.green(`\n๐ŸŽ‰ Process completed successfully!`)); + console.log(chalk.gray(` Release: ${releaseTag}`)); + console.log(chalk.gray(` MPK: ${mpkAsset.name} (with embedded READMEOSS)\n`)); } finally { - // Step 8: Cleanup temp files + // Cleanup temp files console.log(chalk.gray("๐Ÿงน Cleaning up temporary files...")); await rm("-rf", tmpFolder); } } -main().catch(error => { - console.error(chalk.red(`\nโŒ Error: ${error.message}\n`)); - console.error(error); +main().catch((error: unknown) => { + const message = error instanceof Error ? error.message : String(error); + console.error(chalk.red(`\nโŒ Error: ${message}\n`)); + if (error instanceof Error && error.stack) { + console.error(chalk.gray(error.stack)); + } process.exit(1); }); diff --git a/automation/utils/src/oss-clearance.ts b/automation/utils/src/oss-clearance.ts index 334e3de166..c60d49360a 100644 --- a/automation/utils/src/oss-clearance.ts +++ b/automation/utils/src/oss-clearance.ts @@ -5,17 +5,6 @@ import { mkdtemp, stat } from "node:fs/promises"; import { chmod, cp, exec, mkdir, mv, rm, unzip, zip } from "./shell"; import chalk from "chalk"; -export function findOssReadme(packageRoot: string, widgetName: string, version: string): string | undefined { - const readmeossPattern = `**/*${widgetName}__${version}__READMEOSS_*.html`; - - console.info(`Looking for READMEOSS file matching pattern: ${readmeossPattern}`); - - // Use glob to find files matching the pattern in package root - const matchingFiles = globSync(readmeossPattern, { cwd: packageRoot, absolute: true, ignore: "**/dist/**" }); - - return matchingFiles[0]; -} - export function findAllReadmeOssLocally(): string[] { const readmeossPattern = join("**", `*__*__READMEOSS_*.html`); const path1 = join(homedir(), "Downloads"); @@ -90,5 +79,7 @@ export async function includeReadmeOssIntoMpk(readmeOssPath: string, mpkPath: st // zip it back await zip(unzipTarget, mpkPath); + + // remove tmp folder rm("-rf", unzipTarget); } diff --git a/automation/utils/src/steps.ts b/automation/utils/src/steps.ts index baf9dfba6a..f63667d7d2 100644 --- a/automation/utils/src/steps.ts +++ b/automation/utils/src/steps.ts @@ -14,7 +14,6 @@ import { ModuleInfo, PackageInfo, WidgetInfo } from "./package-info"; import { addFilesToPackageXml, PackageType } from "./package-xml"; import { chmod, cp, ensureFileExists, exec, find, mkdir, popd, pushd, rm, unzip, zip } from "./shell"; import chalk from "chalk"; -import { findOssReadme } from "./oss-clearance"; type Step = (params: { info: Info; config: Config }) => Promise; @@ -197,44 +196,6 @@ export async function addWidgetsToMpk({ config }: ModuleStepParams): Promise { - logStep("Add READMEOSS to mpk"); - - // Check that READMEOSS file exists in package root and find it by name pattern - const packageRoot = config.paths.package; - const widgetName = info.mxpackage.name; - const version = info.version.format(); - - // We'll search for files matching the name and version, ignoring timestamp - const readmeossFile = findOssReadme(packageRoot, widgetName, version); - - if (!readmeossFile) { - console.warn(`โš ๏ธ READMEOSS file not found for ${widgetName} version ${version}.`); - console.warn(` Skipping READMEOSS addition to mpk.`); - return; - } - - console.info(`Found READMEOSS file: ${parse(readmeossFile).base}`); - - const mpk = config.output.files.modulePackage; - const mpkEntry = parse(mpk); - const target = join(mpkEntry.dir, "tmp"); - - rm("-rf", target); - - console.info("Unzip module mpk"); - await unzip(mpk, target); - chmod("-R", "a+rw", target); - - console.info(`Add READMEOSS file to ${mpkEntry.base}`); - // Copy the READMEOSS file to the target directory - cp(readmeossFile, target); - - console.info("Create module zip archive"); - await zip(target, mpk); - rm("-rf", target); -} - export async function moveModuleToDist({ info, config }: ModuleStepParams): Promise { logStep("Move module to dist"); @@ -244,15 +205,6 @@ export async function moveModuleToDist({ info, config }: ModuleStepParams): Prom mkdir("-p", join(paths.dist, info.version.format())); // Can't use mv because of https://github.com/shelljs/shelljs/issues/878 cp(output.files.modulePackage, output.files.mpk); - - // Prepare OSS clearance folder structure - const ossClearanceFolder = join(paths.dist, "SBOM_GENERATOR", `${info.mxpackage.name} ${info.version.format()}`); - mkdir("-p", ossClearanceFolder); - - // Copy module package to OSS clearance folder - console.info(`Copying module package to OSS clearance folder: ${ossClearanceFolder}`); - cp(output.files.modulePackage, join(ossClearanceFolder, `${info.mxpackage.name} ${info.version.format()}.mpk`)); - rm(output.files.modulePackage); } diff --git a/packages/modules/calendar/scripts/release.ts b/packages/modules/calendar/scripts/release.ts index 6472347c37..d8ff81f729 100644 --- a/packages/modules/calendar/scripts/release.ts +++ b/packages/modules/calendar/scripts/release.ts @@ -1,7 +1,6 @@ #!/usr/bin/env ts-node-script import { - addREADMEOSSToMpk, addWidgetsToMpk, cloneTestProject, copyModuleLicense, @@ -24,7 +23,6 @@ async function main(): Promise { copyWidgetsToProject, createModuleMpk, addWidgetsToMpk, - addREADMEOSSToMpk, moveModuleToDist ] }); diff --git a/packages/modules/data-widgets/scripts/release.ts b/packages/modules/data-widgets/scripts/release.ts index d492e8ef22..bc29ec0a2c 100755 --- a/packages/modules/data-widgets/scripts/release.ts +++ b/packages/modules/data-widgets/scripts/release.ts @@ -1,7 +1,6 @@ #!/usr/bin/env ts-node-script import { - addREADMEOSSToMpk, addWidgetsToMpk, cloneTestProject, copyActionsFiles, @@ -31,7 +30,6 @@ async function main(): Promise { copyModuleLicense, createModuleMpk, addWidgetsToMpk, - addREADMEOSSToMpk, moveModuleToDist ] }); diff --git a/packages/modules/file-uploader/scripts/release.ts b/packages/modules/file-uploader/scripts/release.ts index 6472347c37..d8ff81f729 100755 --- a/packages/modules/file-uploader/scripts/release.ts +++ b/packages/modules/file-uploader/scripts/release.ts @@ -1,7 +1,6 @@ #!/usr/bin/env ts-node-script import { - addREADMEOSSToMpk, addWidgetsToMpk, cloneTestProject, copyModuleLicense, @@ -24,7 +23,6 @@ async function main(): Promise { copyWidgetsToProject, createModuleMpk, addWidgetsToMpk, - addREADMEOSSToMpk, moveModuleToDist ] }); diff --git a/packages/modules/google-tag/scripts/release.ts b/packages/modules/google-tag/scripts/release.ts index 1a82a431e9..99a1db7ec4 100755 --- a/packages/modules/google-tag/scripts/release.ts +++ b/packages/modules/google-tag/scripts/release.ts @@ -1,7 +1,6 @@ #!/usr/bin/env ts-node-script import { - addREADMEOSSToMpk, addWidgetsToMpk, cloneTestProject, copyActionsFiles, @@ -24,7 +23,6 @@ async function main(): Promise { writeVersionAndLicenseToJSActions, createModuleMpk, addWidgetsToMpk, - addREADMEOSSToMpk, moveModuleToDist ] }); diff --git a/packages/modules/web-actions/scripts/release.ts b/packages/modules/web-actions/scripts/release.ts index add9c8eaeb..da45ccaeca 100755 --- a/packages/modules/web-actions/scripts/release.ts +++ b/packages/modules/web-actions/scripts/release.ts @@ -1,5 +1,4 @@ import { - addREADMEOSSToMpk, cloneTestProject, copyActionsFiles, createModuleMpk, @@ -30,7 +29,6 @@ async function main(): Promise { copyThemesourceToProject, writeVersionAndLicenseToJSActions, createModuleMpk, - addREADMEOSSToMpk, moveModuleToDist ] });