File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ import fs from 'fs/promises' ;
2+
3+ async function prepareTemplate ( ) {
4+ // Skip when not used as a template
5+ if ( process . env . VERCEL_PROJECT_ID === 'prj_6Km3AvCCo0QgJSoEb3cFQwwB9x0Y' ) {
6+ return ;
7+ }
8+
9+ // Read the package.json
10+ const packageJson = JSON . parse ( await fs . readFile ( './package.json' , 'utf8' ) ) ;
11+
12+ // Create a copy for the template
13+ const templatePackageJson = { ...packageJson } ;
14+
15+ // Replace workspace dependencies with real versions
16+ for ( const [ dep , version ] of Object . entries (
17+ templatePackageJson . dependencies || { } ,
18+ ) ) {
19+ if ( version . startsWith ( 'workspace:' ) ) {
20+ // Replace with the actual version you want
21+ templatePackageJson . dependencies [ dep ] = 'latest' ;
22+ }
23+ }
24+
25+ // Write the template package.json
26+ await fs . writeFile ( './package.json' , JSON . stringify ( templatePackageJson ) ) ;
27+ }
28+
29+ prepareTemplate ( ) ;
Original file line number Diff line number Diff line change 1+ {
2+ "installCommand" : " node scripts/replace-workspace-version.mjs && pnpm install"
3+ }
You can’t perform that action at this time.
0 commit comments