create-ncblock 0.0.9 → 0.0.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-ncblock",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "description": "Create a Notion custom view block project.",
5
5
  "type": "module",
6
6
  "bin": {
package/scripts/init.ts CHANGED
@@ -36,6 +36,9 @@ function detectPM(): string {
36
36
  return "pnpm"
37
37
  }
38
38
 
39
+ const NOTION_ID_RE =
40
+ /^[a-f0-9]{32}$|^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/
41
+
39
42
  function parseArgs(argv: string[]) {
40
43
  const args: Record<string, string | boolean> = {}
41
44
  const positional: string[] = []
@@ -59,7 +62,11 @@ function parseArgs(argv: string[]) {
59
62
  } else if (arg === "--collection") {
60
63
  args.collection = argv[++i]
61
64
  } else if (!arg.startsWith("-")) {
62
- positional.push(arg)
65
+ if (NOTION_ID_RE.test(arg)) {
66
+ args.blockId = arg
67
+ } else {
68
+ positional.push(arg)
69
+ }
63
70
  }
64
71
  i++
65
72
  }
@@ -518,8 +525,9 @@ async function main() {
518
525
  step("Installed dependencies")
519
526
 
520
527
  // Ask for a collection URL / block ID to populate custom_blocks.json.
521
- // Default to BLOCK_ID env var if set (the deploy flow already provides it).
522
- const blockOrCollectionDefault = process.env.BLOCK_ID || "skip"
528
+ // Default to positional block ID, then BLOCK_ID env var.
529
+ const blockOrCollectionDefault =
530
+ (args.blockId as string | undefined) || process.env.BLOCK_ID || "skip"
523
531
  const blockOrCollectionId = (
524
532
  await ask(
525
533
  "Database URL/ID (enter to skip):",
@@ -544,7 +552,7 @@ async function main() {
544
552
  }
545
553
  }
546
554
 
547
- const blockId = process.env.BLOCK_ID
555
+ const blockId = (args.blockId as string | undefined) || process.env.BLOCK_ID
548
556
  const envName = process.env.ENV
549
557
  const deployCommand =
550
558
  blockId && envName
package/sdk-version.json CHANGED
@@ -1 +1 @@
1
- {"version":"0.0.10"}
1
+ {"version":"0.0.11"}