Skip to content

Commit 05207c1

Browse files
committed
chore: fix CLI so it doesn't terminate immediately
1 parent a1bc8ba commit 05207c1

File tree

7 files changed

+16
-11
lines changed

7 files changed

+16
-11
lines changed

apps/demo/moon.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ tasks:
1010
command: email preview emails
1111
options:
1212
cache: false
13+
persistent: true

packages/create-mail/moon.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ tasks:
99
build:
1010
command: echo "Build Complete ✓"
1111
inputs:
12+
- cli.js
1213
- generators
1314
- src
1415
- package.json

packages/jsx-email/cli.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ Please upgrade Node.js to a supported version: ${engines}\n`);
2222
};
2323

2424
(async () => {
25-
await checkEngine();
26-
const { run } = await import('./dist/cli/index.js');
27-
return run();
28-
})()
29-
.then(() => process.exit(0))
30-
.catch((error) => {
25+
try {
26+
await checkEngine();
27+
const { run } = await import('./dist/cli/index.js');
28+
return run();
29+
} catch (error) {
3130
danger(error);
3231
process.exit(1);
33-
});
32+
}
33+
})();

packages/jsx-email/moon.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@ tasks:
1515
- ~:copy.preview
1616
- ~:copy.templates
1717
inputs:
18+
- cli.js
19+
- generators
1820
- src
1921
- package.json
22+
- tsconfig.json
2023
options:
2124
cache: false
2225
outputStyle: 'stream'

packages/jsx-email/src/cli/commands/preview.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ const buildDeployable = async ({ argv, targetPath }: PreviewCommonParams) => {
8686
const getConfig = async ({ argv, targetPath }: PreviewCommonParams) => {
8787
const buildPath = await getTempPath('preview');
8888
const root = JSX_DEV_LOCAL
89-
? fileURLToPath(import.meta.resolve('../../../../../../apps/preview/app'))
90-
: fileURLToPath(import.meta.resolve('../../../preview'));
89+
? fileURLToPath(import.meta.resolve('../../../../../apps/preview/app'))
90+
: fileURLToPath(import.meta.resolve('../../preview'));
9191
const { basePath = '/', host = false, port = 55420 } = argv;
9292

9393
if (JSX_DEV_LOCAL)

packages/jsx-email/src/log.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,3 @@ export const getPluginLog = (name: string) =>
55
getLog({ brand: 'jsx-email', name: chalk`{bold ∵ ${name}}` } as any);
66

77
export const log = getLog({ brand: 'jsx-email' } as any);
8-
9-
log.info('test');

test/smoke/moon.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ tasks:
2222
command: playwright test -x --config playwright.dev.ts
2323
deps:
2424
- ~:install
25+
env:
26+
JSX_DEV_LOCAL: 'true'
2527
options:
2628
cache: false
2729
outputStyle: 'stream'

0 commit comments

Comments
 (0)