@@ -14,6 +14,7 @@ import { ModuleInfo, PackageInfo, WidgetInfo } from "./package-info";
1414import { addFilesToPackageXml , PackageType } from "./package-xml" ;
1515import { chmod , cp , ensureFileExists , exec , find , mkdir , popd , pushd , rm , unzip , zip } from "./shell" ;
1616import chalk from "chalk" ;
17+ import { findOssReadme } from "./oss-readme" ;
1718
1819type Step < Info , Config > = ( params : { info : Info ; config : Config } ) => Promise < void > ;
1920
@@ -205,30 +206,17 @@ export async function addREADMEOSSToMpk({ config, info }: ModuleStepParams): Pro
205206 const version = info . version . format ( ) ;
206207
207208 // We'll search for files matching the name and version, ignoring timestamp
208- const readmeossPattern = `* ${ widgetName } __ ${ version } __READMEOSS_*.html` ;
209+ const readmeossFile = findOssReadme ( packageRoot , widgetName , version ) ;
209210
210- console . info ( `Looking for READMEOSS file matching pattern: ${ readmeossPattern } ` ) ;
211-
212- // Find files matching the pattern in package root
213- const matchingFiles = find ( packageRoot ) . filter ( file => {
214- const fileName = parse ( file ) . base ;
215- // Check if filename contains the widget name, version, and READMEOSS
216- return fileName . includes ( `${ widgetName } __${ version } __READMEOSS_` ) && fileName . endsWith ( ".html" ) ;
217- } ) ;
218-
219- if ( matchingFiles . length === 0 ) {
220- console . warn (
221- `⚠️ READMEOSS file not found for ${ widgetName } version ${ version } . Expected pattern: ${ readmeossPattern } `
222- ) ;
211+ if ( ! readmeossFile ) {
212+ console . warn ( `⚠️ READMEOSS file not found for ${ widgetName } version ${ version } .` ) ;
223213 console . warn ( ` Skipping READMEOSS addition to mpk.` ) ;
224214 return ;
225215 }
226216
227- const readmeossFile = matchingFiles [ 0 ] ;
228217 console . info ( `Found READMEOSS file: ${ parse ( readmeossFile ) . base } ` ) ;
229218
230219 const mpk = config . output . files . modulePackage ;
231- const widgets = await getMpkPaths ( config . dependencies ) ;
232220 const mpkEntry = parse ( mpk ) ;
233221 const target = join ( mpkEntry . dir , "tmp" ) ;
234222
0 commit comments