@@ -12,6 +12,7 @@ const __dirname = path.dirname(__filename);
1212 const packageDir = path . resolve ( __dirname , ".." ) ;
1313 const rootDir = path . resolve ( packageDir , "../.." ) ;
1414
15+ // TODO: could swap this with `pnpm m ls --json --depth=-1`
1516 const mudPackageNames = await ( async ( ) => {
1617 const files = await glob ( "packages/*/package.json" , { cwd : rootDir } ) ;
1718 const packages = await Promise . all (
@@ -36,16 +37,17 @@ const __dirname = path.dirname(__filename);
3637
3738 await fs . mkdir ( path . dirname ( destPath ) , { recursive : true } ) ;
3839
39- // Replace all MUD package links with mustache placeholder used by create-create-app
40- // that will be replaced with the latest MUD version number when the template is used.
4140 if ( / p a c k a g e \. j s o n $ / . test ( destPath ) ) {
42- const source = await fs . readFile ( sourcePath , "utf-8" ) ;
43- await fs . writeFile (
44- destPath ,
45- source . replace ( / " ( [ ^ " ] + ) " : \s * " ( l i n k | f i l e ) : [ ^ " ] + " / g, ( match , packageName ) =>
46- mudPackageNames . includes ( packageName ) ? `"${ packageName } ": "{{mud-version}}"` : match ,
47- ) ,
41+ let source = await fs . readFile ( sourcePath , "utf-8" ) ;
42+ // Replace all MUD package links with mustache placeholder used by create-create-app
43+ // that will be replaced with the latest MUD version number when the template is used.
44+ source = source . replace ( / " ( [ ^ " ] + ) " : \s * " ( l i n k | f i l e ) : [ ^ " ] + " / g, ( match , packageName ) =>
45+ mudPackageNames . includes ( packageName ) ? `"${ packageName } ": "{{mud-version}}"` : match ,
4846 ) ;
47+ const json = JSON . parse ( source ) ;
48+ // Strip out pnpm overrides
49+ delete json . pnpm ;
50+ await fs . writeFile ( destPath , JSON . stringify ( json , null , 2 ) + "\n" ) ;
4951 }
5052 // Replace template workspace root `tsconfig.json` files (which have paths relative to monorepo)
5153 // with one that inherits our base tsconfig.
0 commit comments