@@ -109,3 +109,35 @@ describe('Node dependency version sync', () => {
109109 expect ( different , errorMessage ) . toHaveLength ( 0 )
110110 } )
111111} )
112+
113+ describe ( 'oclif manifest packaging' , ( ) => {
114+ test ( 'packages that ship oclif.manifest.json regenerate it in prepack' , async ( ) => {
115+ const packageJsonPaths = await glob ( 'packages/*/package.json' , { cwd : repoRoot , absolute : true } )
116+
117+ const missingManifestRefresh : string [ ] = [ ]
118+
119+ for ( const packageJsonPath of packageJsonPaths ) {
120+ const packageJson = JSON . parse ( await fs . readFile ( packageJsonPath , 'utf-8' ) ) as {
121+ files ?: string [ ]
122+ scripts ?: { prepack ?: string }
123+ }
124+
125+ const shipsOclifManifest = packageJson . files ?. some ( ( file ) =>
126+ file . replace ( / ^ \. ? \/ / , '' ) . endsWith ( 'oclif.manifest.json' ) ,
127+ )
128+ if ( ! shipsOclifManifest ) continue
129+ if ( ! / \b o c l i f \s + m a n i f e s t \b / . test ( packageJson . scripts ?. prepack ?? '' ) ) {
130+ missingManifestRefresh . push ( path . relative ( repoRoot , packageJsonPath ) )
131+ }
132+ }
133+
134+ expect (
135+ missingManifestRefresh ,
136+ [
137+ 'The following packages publish oclif.manifest.json without regenerating it in prepack:\n' ,
138+ ...missingManifestRefresh . map ( ( packageJsonPath ) => ` - ${ packageJsonPath } \n` ) ,
139+ '\nAdd `pnpm oclif manifest` to the package prepack script so snapshot/nightly versions do not ship stale manifests.' ,
140+ ] . join ( '' ) ,
141+ ) . toHaveLength ( 0 )
142+ } )
143+ } )
0 commit comments