Skip to content

Commit b73e92b

Browse files
authored
fix: ensure @electric-sql/start entrypoint is correct (#3642)
1 parent de50cb8 commit b73e92b

File tree

5 files changed

+15
-10
lines changed

5 files changed

+15
-10
lines changed

.changeset/gold-schools-explain.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@electric-sql/start': patch
3+
---
4+
5+
fix: made sure executable runs

packages/start/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"type": "module",
66
"main": "./dist/index.js",
77
"bin": {
8-
"start": "./dist/cli.js"
8+
"start": "./dist/bin.js"
99
},
1010
"exports": {
1111
"./package.json": "./package.json",
@@ -19,7 +19,7 @@
1919
"scripts": {
2020
"build": "shx rm -rf dist && tsup",
2121
"prepack": "pnpm build",
22-
"dev": "pnpm run build && node dist/cli.js",
22+
"dev": "pnpm run build && node dist/bin.js",
2323
"format": "eslint . --fix",
2424
"stylecheck": "eslint . --quiet",
2525
"test": "pnpm exec vitest",

packages/start/src/bin.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { main } from './cli.js'
2+
3+
main().catch((error) => {
4+
console.error(`Unexpected error:`, error)
5+
process.exit(1)
6+
})

packages/start/src/cli.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env node
22

33
import { execSync } from 'child_process'
4+
import { realpathSync } from 'fs'
45
import { provisionElectricResources } from './electric-api.js'
56
import { setupTemplate } from './template-setup.js'
67
import { join } from 'path'
@@ -98,11 +99,4 @@ async function main() {
9899
}
99100
}
100101

101-
if (import.meta.url === `file://${process.argv[1]}`) {
102-
main().catch((error) => {
103-
console.error(`Unexpected error:`, error)
104-
process.exit(1)
105-
})
106-
}
107-
108102
export { main }

packages/start/tsup.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default defineConfig((options) => {
55
const commonOptions: Partial<Options> = {
66
entry: {
77
index: `src/index.ts`,
8-
cli: `src/cli.ts`,
8+
bin: `src/bin.ts`,
99
},
1010
tsconfig: `./tsconfig.build.json`,
1111
sourcemap: true,

0 commit comments

Comments
 (0)