@@ -83,15 +83,18 @@ const runPatchCheck = files.some(
8383 ( file ) =>
8484 file === "pnpm-workspace.yaml" ||
8585 file === "pnpm-lock.yaml" ||
86+ file === ".pnpmfile.cjs" ||
8687 file . startsWith ( "patches/" ) ||
88+ file . startsWith ( "apps/mobile/deps/" ) ||
8789 NodePath . basename ( file ) === "package.json" ,
8890) ;
8991
90- // The same fresh install Release Smoke runs: it copies the workspace
91- // manifests to a temp dir, deletes the lockfile, and installs with
92- // --lockfile-only. Copy the same files here (the mobile modules are mobile
93- // file: dependencies, not workspace packages) and skip the lockfile, so the
94- // working tree and its lockfile stay untouched.
92+ // Mirror Release Smoke's temp-copy install: copy the workspace manifests to
93+ // a temp dir, omit the lockfile, and install with --lockfile-only, so the
94+ // working tree and its lockfile stay untouched (the mobile modules are
95+ // mobile file: dependencies, not workspace packages). Local pnpm may resolve
96+ // from cached registry metadata, so this catches patches stranded by your
97+ // own change, not registry drift.
9598const checkPatches = ( ) : boolean => {
9699 const temp = NodeFS . mkdtempSync ( NodePath . join ( NodeOS . tmpdir ( ) , "t3-patch-check-" ) ) ;
97100 try {
@@ -110,22 +113,24 @@ const checkPatches = (): boolean => {
110113 if ( NodeFS . existsSync ( NodePath . join ( root , manifest ) ) ) copy ( manifest ) ;
111114 }
112115 }
113- for ( const dir of [ "apps/mobile/deps" , "patches" ] ) {
114- if ( NodeFS . existsSync ( NodePath . join ( root , dir ) ) ) copy ( dir ) ;
116+ for ( const extra of [ "apps/mobile/deps" , "patches" , ".pnpmfile.cjs "] ) {
117+ if ( NodeFS . existsSync ( NodePath . join ( root , extra ) ) ) copy ( extra ) ;
115118 }
116- const { status, stdout, stderr } = NodeChildProcess . spawnSync (
119+ const { status, stdout, stderr, error } = NodeChildProcess . spawnSync (
117120 "vp" ,
118121 [ "install" , "--lockfile-only" , "--ignore-scripts" ] ,
119122 { cwd : temp , encoding : "utf8" , maxBuffer : 64 * 1024 * 1024 } ,
120123 ) ;
121124 if ( status === 0 ) return true ;
122- console . log ( stdout ) ;
123- console . error ( stderr ) ;
124- if ( `${ stdout } ${ stderr } ` . includes ( "ERR_PNPM_UNUSED_PATCH" ) ) {
125+ if ( stdout ) console . log ( stdout ) ;
126+ if ( stderr ) console . error ( stderr ) ;
127+ if ( error ) console . error ( error . message ) ;
128+ if ( `${ stdout ?? "" } ${ stderr ?? "" } ` . includes ( "ERR_PNPM_UNUSED_PATCH" ) ) {
125129 console . error (
126130 "Unused dependency patches: remove each patch named above from " +
127131 "patchedDependencies in pnpm-workspace.yaml and from patches/, " +
128- "or update it to the version the install resolves." ,
132+ "update it to the version the install resolves, " +
133+ "or pin the dependency that pulls it in to the patched version." ,
129134 ) ;
130135 }
131136 return false ;
@@ -141,7 +146,7 @@ const graphql = ["apps/server", "packages/source-control-github"].filter((dir) =
141146
142147const filters = ( names : ReadonlyArray < string > ) => names . flatMap ( ( name ) => [ "--filter" , name ] ) ;
143148const steps = [
144- // First, so a stranded patch fails in seconds, before knip and typecheck .
149+ // Runs first; it takes about a second .
145150 runPatchCheck && { name : "unused patches" , run : checkPatches } ,
146151 present . length > 0 && {
147152 name : "format" ,
0 commit comments