Skip to content

fix(create): ensure CKB binary and devnet config before generating scripts#419

Merged
RetricSu merged 3 commits intodevelopfrom
fix-issue-396
Mar 30, 2026
Merged

fix(create): ensure CKB binary and devnet config before generating scripts#419
RetricSu merged 3 commits intodevelopfrom
fix-issue-396

Conversation

@RetricSu
Copy link
Copy Markdown
Collaborator

Fixes #396

Problem

offckb create failed when user hasn't run offckb node first because:

  • CKB binary is not installed
  • Devnet config is not initialized

Both are required by genSystemScriptsJsonFile which executes ckb list-hashes.

Solution

Add pre-installation checks in create.ts:

  1. Import installCKBBinary, initChainIfNeeded, and readSettings
  2. Call installCKBBinary to download CKB binary if not exists
  3. Call initChainIfNeeded to initialize devnet config if not exists
  4. Both calls happen before genSystemScriptsJsonFile

Changes

  • src/cmd/create.ts: +3 lines (imports and function calls)

Testing

  • ✅ Fresh environment: CKB binary downloaded, system-scripts.json generated
  • ✅ Idempotency: No re-download when binary already exists

Verification

# Clean environment test
rm -rf ~/.offckb ./test-project
offckb create test-project --no-install --no-git
# Expected: Success, system-scripts.json exists

…ripts

Fix issue #396 where offckb create fails if user hasn't run offckb node first.

Changes:
- Add imports for installCKBBinary, initChainIfNeeded, readSettings
- Call installCKBBinary to download CKB binary if not exists
- Call initChainIfNeeded to initialize devnet config if not exists
- Both calls happen before genSystemScriptsJsonFile to ensure dependencies are ready

This makes offckb create self-sufficient and doesn't require prior offckb node execution.
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 30, 2026

✅ Changeset file detected.

@RetricSu RetricSu merged commit fb506f4 into develop Mar 30, 2026
7 checks passed
@RetricSu RetricSu deleted the fix-issue-396 branch March 30, 2026 03:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

offckb create failed if not starting the node?

1 participant