@notionhq/custom-blocks-dev-shell 0.0.8 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/cli.js CHANGED
@@ -1,37 +1,15 @@
1
1
  #!/usr/bin/env node
2
- import { spawnSync } from "node:child_process"
3
- import { createRequire } from "node:module"
4
- import { dirname, resolve } from "node:path"
5
- import { fileURLToPath } from "node:url"
6
-
7
- const require = createRequire(import.meta.url)
8
- let tsxBin
9
2
  try {
10
- const tsxPkg = require.resolve("tsx/package.json")
11
- tsxBin = resolve(dirname(tsxPkg), "dist/cli.mjs")
12
- } catch {
13
- process.stderr.write(
14
- "✗ Could not locate the bundled tsx runtime. Reinstall the dev shell package.\n",
15
- )
16
- process.exit(1)
3
+ await import(new URL("../dist-cli/main.js", import.meta.url))
4
+ } catch (error) {
5
+ if (
6
+ error?.code === "ERR_MODULE_NOT_FOUND" &&
7
+ String(error?.message).includes("dist-cli")
8
+ ) {
9
+ process.stderr.write(
10
+ "✗ Could not locate the built CLI. Reinstall the dev shell package.\n",
11
+ )
12
+ process.exit(1)
13
+ }
14
+ throw error
17
15
  }
18
-
19
- const entryPath = resolve(
20
- dirname(fileURLToPath(import.meta.url)),
21
- "..",
22
- "cli",
23
- "main.ts",
24
- )
25
- const result = spawnSync(
26
- process.execPath,
27
- [tsxBin, entryPath, ...process.argv.slice(2)],
28
- {
29
- stdio: "inherit",
30
- env: process.env,
31
- },
32
- )
33
-
34
- if (result.error) {
35
- process.stderr.write(`✗ Failed to start the dev shell: ${result.error}\n`)
36
- }
37
- process.exit(result.status ?? 1)