Skip to content

Commit 4b9ccd1

Browse files
authored
fix(react-email): Extra Windows issues (#1485)
1 parent f7a6352 commit 4b9ccd1

File tree

2 files changed

+14
-20
lines changed

2 files changed

+14
-20
lines changed

packages/react-email/src/cli/commands/build.ts

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,10 @@ const buildPreviewApp = (absoluteDirectory: string) => {
2020
return new Promise<void>((resolve, reject) => {
2121
const nextBuild = spawn('npm', ['run', 'build'], {
2222
cwd: absoluteDirectory,
23+
shell: true,
2324
});
24-
25-
nextBuild.stdout.on('data', (msg: Buffer) => {
26-
process.stdout.write(msg);
27-
});
28-
nextBuild.stderr.on('data', (msg: Buffer) => {
29-
process.stderr.write(msg);
30-
});
25+
nextBuild.stdout.pipe(process.stdout);
26+
nextBuild.stderr.pipe(process.stderr);
3127

3228
nextBuild.on('close', (code) => {
3329
if (code === 0) {
@@ -190,11 +186,11 @@ const npmInstall = async (
190186
return new Promise<void>(async (resolve, reject) => {
191187
const childProc = spawn(packageManager, ['install', '--silent'], {
192188
cwd: builtPreviewAppPath,
189+
shell: true,
193190
});
194-
childProc.stderr.on('data', (chunk) => {
195-
process.stderr.write(chunk);
196-
});
197-
childProc.on('exit', (code) => {
191+
childProc.stdout.pipe(process.stdout);
192+
childProc.stderr.pipe(process.stderr);
193+
childProc.on('close', (code) => {
198194
if (code === 0) {
199195
resolve();
200196
} else {
@@ -240,9 +236,10 @@ export const build = async ({
240236
filter: (source: string) => {
241237
// do not copy the CLI files
242238
return (
243-
!source.includes('/cli/') &&
244-
!source.includes('/.next/') &&
245-
!/\/node_modules\/?$/.test(source)
239+
!/(\/|\\)cli(\/|\\)?/.test(source) &&
240+
!/(\/|\\)\.next(\/|\\)?/.test(source) &&
241+
!/(\/|\\)\.turbo(\/|\\)?/.test(source) &&
242+
!/(\/|\\)node_modules(\/|\\)?$/.test(source)
246243
);
247244
},
248245
});

packages/react-email/src/cli/commands/start.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,12 @@ export const start = async () => {
1717

1818
const nextStart = spawn('npm', ['start'], {
1919
cwd: builtPreviewPath,
20+
shell: true,
2021
});
2122

22-
nextStart.stdout.on('data', (msg) => {
23-
process.stdout.write(msg);
24-
});
23+
nextStart.stdout.pipe(process.stdout);
2524

26-
nextStart.stderr.on('data', (msg) => {
27-
process.stderr.write(msg);
28-
});
25+
nextStart.stderr.pipe(process.stderr);
2926
} catch (error) {
3027
console.log(error);
3128
process.exit(1);

0 commit comments

Comments
 (0)