Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle path with whitespaces in build cmd #11692

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changesets/11692.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Handle path with whitespaces in build cmd (#11692) by @callingmedic911

Fixes an edge case where if the path to the project has whitespaces, the build command would fail.
14 changes: 7 additions & 7 deletions packages/cli/src/commands/buildHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export const handler = async ({
const { cmd, args } = generatePrismaCommand(rwjsPaths.api.dbSchema)
return execa(cmd, args, {
stdio: verbose ? 'inherit' : 'pipe',
shell: true,
cwd: rwjsPaths.api.base,
})
},
Expand Down Expand Up @@ -103,12 +102,14 @@ export const handler = async ({
// so that users don't have to see it when this command is called with --verbose
process.env.VITE_CJS_IGNORE_WARNING = 'true'
await execa(
`node ${require.resolve(
'@redwoodjs/vite/bins/rw-vite-build.mjs',
)} --webDir="${rwjsPaths.web.base}" --verbose=${verbose}`,
'node',
[
require.resolve('@redwoodjs/vite/bins/rw-vite-build.mjs'),
`--webDir=${path.resolve(rwjsPaths.web.base)}`,
`--verbose=${verbose}`,
],
{
stdio: verbose ? 'inherit' : 'pipe',
shell: true,
// `cwd` is needed for yarn to find the rw-vite-build binary
// It won't change process.cwd for anything else here, in this
// process
Expand Down Expand Up @@ -146,9 +147,8 @@ export const handler = async ({

// Running a separate process here, otherwise it wouldn't pick up the
// generated Prisma Client due to require module caching
await execa('yarn rw prerender', {
await execa('yarn', ['rw', 'prerender'], {
stdio: 'inherit',
shell: true,
cwd: rwjsPaths.web.base,
})
}
Expand Down
8 changes: 6 additions & 2 deletions packages/cli/src/lib/generatePrismaClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ export const generatePrismaCommand = (schema) => {
}

return {
cmd: `node "${require.resolve('prisma/build/index.js')}"`,
args: ['generate', schema && `--schema="${schema}"`],
cmd: `node`,
args: [
require.resolve('prisma/build/index.js'),
'generate',
schema && `--schema=${schema}`,
],
}
}

Expand Down
Loading