Skip to content

Commit 0590906

Browse files
committed
build: compile as esm
1 parent 3bc46f7 commit 0590906

3 files changed

Lines changed: 4 additions & 14 deletions

File tree

src/cli/index.spec.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,14 @@ describe('cli/index', () => {
1414
});
1515

1616
test('works', async () => {
17-
const wait = new Promise<void>((resolve) =>
18-
mocks.main.mockImplementationOnce(() => resolve()),
19-
);
2017
await import('./index.ts');
21-
await wait;
2218
expect(mocks.main).toHaveBeenCalledTimes(1);
2319
expect(globalThis).not.toHaveProperty('__bundlerPathsOverrides');
2420
});
2521

2622
test('uses sea', async () => {
2723
mocks.isSea.mockReturnValue(true);
28-
const wait = new Promise<void>((resolve) =>
29-
mocks.main.mockImplementationOnce(() => resolve()),
30-
);
3124
await import('./index.ts');
32-
await wait;
3325
expect(mocks.main).toHaveBeenCalledTimes(1);
3426
expect(globalThis).toHaveProperty('__bundlerPathsOverrides', {
3527
'pino-pretty': './pino-pretty.js',

src/cli/index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,5 @@ if (isSea()) {
1616
});
1717
}
1818

19-
void (async () => {
20-
const m = await import('./main.ts');
21-
await m.main();
22-
})();
19+
const m = await import('./main.ts');
20+
await m.main();

tools/build.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const bundle = await rolldown({
5757
});
5858

5959
shell.echo('Writing containerbase-cli bundle ...');
60-
await bundle.write({ dir: 'dist/app', format: 'commonjs', cleanDir: true });
60+
await bundle.write({ dir: 'dist/app', format: 'esm', cleanDir: true });
6161

6262
await fs.writeFile(
6363
'./dist/package.json',
@@ -66,7 +66,7 @@ await fs.writeFile(
6666
name: 'containerbase-cli',
6767
version,
6868
private: true,
69-
type: 'commonjs',
69+
type: 'module',
7070
bin: {
7171
'containerbase-cli': './app/containerbase-cli.js',
7272
},

0 commit comments

Comments
 (0)