@@ -36,6 +36,10 @@ type TemplateVariations = {
36
36
envNames ?: {
37
37
dbUri : string
38
38
}
39
+ /**
40
+ * @default false
41
+ */
42
+ skipReadme ?: boolean
39
43
configureConfig ?: boolean
40
44
generateLockfile ?: boolean
41
45
}
@@ -92,6 +96,7 @@ async function main() {
92
96
// This will replace the process.env.DATABASE_URI to process.env.POSTGRES_URL
93
97
dbUri : 'POSTGRES_URL' ,
94
98
} ,
99
+ skipReadme : true ,
95
100
} ,
96
101
{
97
102
name : 'payload-postgres-template' ,
@@ -151,6 +156,7 @@ async function main() {
151
156
envNames,
152
157
sharp,
153
158
configureConfig,
159
+ skipReadme = false ,
154
160
} of variations ) {
155
161
header ( `Generating ${ name } ...` )
156
162
const destDir = path . join ( templatesDir , dirname )
@@ -160,6 +166,7 @@ async function main() {
160
166
'.next' ,
161
167
'.env$' ,
162
168
'pnpm-lock.yaml' ,
169
+ ...( skipReadme ? [ 'README.md' ] : [ '' ] ) ,
163
170
] )
164
171
165
172
log ( `Copied to ${ destDir } ` )
@@ -183,15 +190,26 @@ async function main() {
183
190
} )
184
191
}
185
192
186
- await generateReadme ( {
187
- destDir,
188
- data : {
189
- name,
190
- description : name , // TODO: Add descriptions
191
- attributes : { db, storage } ,
192
- ...( vercelDeployButtonLink && { vercelDeployButtonLink } ) ,
193
- } ,
194
- } )
193
+ if ( ! skipReadme ) {
194
+ await generateReadme ( {
195
+ destDir,
196
+ data : {
197
+ name,
198
+ description : name , // TODO: Add descriptions
199
+ attributes : { db, storage } ,
200
+ ...( vercelDeployButtonLink && { vercelDeployButtonLink } ) ,
201
+ } ,
202
+ } )
203
+ }
204
+
205
+ if ( generateLockfile ) {
206
+ log ( 'Generating pnpm-lock.yaml' )
207
+ execSyncSafe ( `pnpm install --ignore-workspace` , { cwd : destDir } )
208
+ } else {
209
+ log ( 'Installing dependencies without generating lockfile' )
210
+ execSyncSafe ( `pnpm install --ignore-workspace` , { cwd : destDir } )
211
+ await fs . rm ( `${ destDir } /pnpm-lock.yaml` , { force : true } )
212
+ }
195
213
196
214
// Copy in initial migration if db is postgres. This contains user and media.
197
215
if ( db === 'postgres' || db === 'vercel-postgres' ) {
@@ -214,17 +232,13 @@ async function main() {
214
232
cwd : destDir ,
215
233
env : {
216
234
...process . env ,
235
+ PAYLOAD_SECRET : 'asecretsolongnotevensantacouldguessit' ,
217
236
BLOB_READ_WRITE_TOKEN : 'vercel_blob_rw_TEST_asdf' ,
218
237
DATABASE_URI : 'postgres://localhost:5432/payloadtests' ,
219
238
} ,
220
239
} )
221
240
}
222
241
223
- if ( generateLockfile ) {
224
- log ( 'Generating pnpm-lock.yaml' )
225
- execSyncSafe ( `pnpm install --ignore-workspace` , { cwd : destDir } )
226
- }
227
-
228
242
// TODO: Email?
229
243
230
244
// TODO: Sharp?
@@ -302,7 +316,7 @@ function log(message: string) {
302
316
function execSyncSafe ( command : string , options ?: Parameters < typeof execSync > [ 1 ] ) {
303
317
try {
304
318
console . log ( `Executing: ${ command } ` )
305
- execSync ( command , options )
319
+ execSync ( command , { stdio : 'inherit' , ... options } )
306
320
} catch ( error ) {
307
321
if ( error instanceof Error ) {
308
322
const stderr = ( error as any ) . stderr ?. toString ( )
0 commit comments