Skip to content

Commit 0040e17

Browse files
authored
fix(cpa): adjust template file location detection (#7507)
Adjust template file location detection. This was causing issues when run with `pnpm create` because it is not run from a `dist` directory. ``` ┌ create-payload-app │ ◇ ────────────────────────────────────────────╮ │ │ │ Welcome to Payload. Let's create a project! │ │ │ ├───────────────────────────────────────────────╯ │ ▲ Payload installation detected in current project. │ ◇ Upgrade Payload in this project? │ Yes │ ◇ Using pnpm. │ │ ◇ Updating 7 Payload packages to v3.0.0-beta.73... │ │ - payload │ - @payloadcms/db-mongodb │ - @payloadcms/db-postgres │ - @payloadcms/next │ - @payloadcms/richtext-lexical │ - @payloadcms/richtext-slate │ - @payloadcms/ui │ ◇ Payload packages updated successfully. │ ◇ Updating Payload Next.js files... │ ■ ENOENT: no such file or directory, copyfile '/Users/elliot/Library/pnpm/store/v3/tmp/dlx-99797/node_modules/.pnpm/create-payload-app@3.0.0-beta.73/templates/blank-3.0/src/app/(payload)' -> '/Users/elliot/dev/payload-3.0-demo/src/app/(payload)' ```
1 parent 1ebd54b commit 0040e17

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/create-payload-app/src/lib/update-payload-in-project.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,11 @@ export async function updatePayloadInProject(
7474
info('Payload packages updated successfully.')
7575

7676
info(`Updating Payload Next.js files...`)
77-
const templateFilesPath = dirname.endsWith('dist')
78-
? path.resolve(dirname, '../..', 'dist/template')
79-
: path.resolve(dirname, '../../../../templates/blank-3.0')
77+
78+
const templateFilesPath =
79+
process.env.JEST_WORKER_ID !== undefined
80+
? path.resolve(dirname, '../../../../templates/blank-3.0')
81+
: path.resolve(dirname, '../..', 'dist/template')
8082

8183
const templateSrcDir = path.resolve(templateFilesPath, 'src/app/(payload)')
8284

0 commit comments

Comments
 (0)