@notionhq/custom-blocks-dev-shell 0.1.0 → 0.1.2
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/README.md +11 -0
- package/bin/cli.js +12 -34
- package/dist/assets/index-B1zP6MFl.js +9 -0
- package/dist/index.html +1 -1
- package/{cli/block-server.ts → dist-cli/block-server.js} +27 -54
- package/dist-cli/data-sources.js +107 -0
- package/dist-cli/main.js +247 -0
- package/dist-cli/serve-ui.js +81 -0
- package/dist-cli/worker-manifest.js +118 -0
- package/docs/data-sources.md +72 -0
- package/package.json +5 -4
- package/cli/main.ts +0 -293
- package/cli/serve-ui.ts +0 -100
- package/cli/worker-manifest.ts +0 -196
- package/dist/assets/index-BCi_w7Gk.js +0 -9
package/README.md
CHANGED
|
@@ -23,6 +23,17 @@ Options:
|
|
|
23
23
|
- `--block-base-port <port>` — first port handed to the per-block dev servers
|
|
24
24
|
(default 9876; blocks count up from there).
|
|
25
25
|
|
|
26
|
+
## Data sources
|
|
27
|
+
|
|
28
|
+
The shell reads local data sources from the worker's `src/data/*.json` — one
|
|
29
|
+
source per file: `{ type: "worker", key, name, icon?, schema, rows }`, where
|
|
30
|
+
`schema` maps property keys to `{ name, type }` and each row carries a unique
|
|
31
|
+
string `id` plus values under the schema's keys. The format is documented in
|
|
32
|
+
full in [`docs/data-sources.md`](docs/data-sources.md), which ships with this
|
|
33
|
+
package. Files are validated at spin-up, and
|
|
34
|
+
a malformed file fails with the file and problem named. The shell shows
|
|
35
|
+
exactly the sources in `src/data/` — none yet means an empty DATA sidebar.
|
|
36
|
+
|
|
26
37
|
## Requirements
|
|
27
38
|
|
|
28
39
|
- Node.js >= 20.19 (per Vite's own minimum for dev servers).
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
)
|
|
16
|
-
|
|
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)
|