@secondlayer/cli 3.5.5 → 3.5.6

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 CHANGED
@@ -27,6 +27,11 @@ sl subgraphs deploy subgraphs/my-contract.ts --start-block <recent-block>
27
27
  sl subgraphs query my-contract <table> --sort _block_height --order desc
28
28
  ```
29
29
 
30
+ `sl subgraphs scaffold` writes the definition file, creates or updates
31
+ `package.json`, and runs `bun install` by default so the generated import is
32
+ deployable immediately. Pass `--no-install` to skip the install and run
33
+ `bun install` manually in the output directory.
34
+
30
35
  Then wire a receiver:
31
36
 
32
37
  ```bash
@@ -128,7 +133,7 @@ invocation. No long-lived key on disk.
128
133
  | `sl subgraphs stop <name>` | Pause processing |
129
134
  | `sl subgraphs gaps <name>` | List missing block ranges |
130
135
  | `sl subgraphs delete <name>` | Drop the subgraph + its schema |
131
- | `sl subgraphs scaffold <SP...::contract>` | Generate a starter subgraph from a deployed contract |
136
+ | `sl subgraphs scaffold <SP...::contract> [-o <path>] [--no-install]` | Generate a starter subgraph from a deployed contract, write/amend `package.json`, and install dependencies unless skipped |
132
137
  | `sl subgraphs generate <name>` | Regenerate TS types for an existing subgraph |
133
138
 
134
139
  ### Local dev + OSS
package/dist/cli.js CHANGED
@@ -26406,7 +26406,7 @@ var require_cross_spawn = __commonJS((exports, module) => {
26406
26406
  var cp = __require("child_process");
26407
26407
  var parse2 = require_parse3();
26408
26408
  var enoent = require_enoent();
26409
- function spawn(command, args, options3) {
26409
+ function spawn2(command, args, options3) {
26410
26410
  const parsed = parse2(command, args, options3);
26411
26411
  const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
26412
26412
  enoent.hookChildProcess(spawned, parsed);
@@ -26418,8 +26418,8 @@ var require_cross_spawn = __commonJS((exports, module) => {
26418
26418
  result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
26419
26419
  return result;
26420
26420
  }
26421
- module.exports = spawn;
26422
- module.exports.spawn = spawn;
26421
+ module.exports = spawn2;
26422
+ module.exports.spawn = spawn2;
26423
26423
  module.exports.sync = spawnSync;
26424
26424
  module.exports._parse = parse2;
26425
26425
  module.exports._enoent = enoent;
@@ -31750,7 +31750,7 @@ var init_promise = __esm(() => {
31750
31750
 
31751
31751
  // ../../node_modules/execa/lib/methods/main-async.js
31752
31752
  import { setMaxListeners } from "node:events";
31753
- import { spawn } from "node:child_process";
31753
+ import { spawn as spawn2 } from "node:child_process";
31754
31754
  var execaCoreAsync = (rawFile, rawArguments, rawOptions, createNested) => {
31755
31755
  const { file, commandArguments, command, escapedCommand, startTime, verboseInfo, options: options3, fileDescriptors } = handleAsyncArguments(rawFile, rawArguments, rawOptions);
31756
31756
  const { subprocess, promise } = spawnSubprocessAsync({
@@ -31795,7 +31795,7 @@ var execaCoreAsync = (rawFile, rawArguments, rawOptions, createNested) => {
31795
31795
  }, spawnSubprocessAsync = ({ file, commandArguments, options: options3, startTime, verboseInfo, command, escapedCommand, fileDescriptors }) => {
31796
31796
  let subprocess;
31797
31797
  try {
31798
- subprocess = spawn(...concatenateShell(file, commandArguments, options3));
31798
+ subprocess = spawn2(...concatenateShell(file, commandArguments, options3));
31799
31799
  } catch (error2) {
31800
31800
  return handleEarlyError({
31801
31801
  error: error2,
@@ -32439,7 +32439,7 @@ var {
32439
32439
  // package.json
32440
32440
  var package_default = {
32441
32441
  name: "@secondlayer/cli",
32442
- version: "3.5.5",
32442
+ version: "3.5.6",
32443
32443
  description: "CLI for subgraphs and blockchain indexing on Stacks",
32444
32444
  type: "module",
32445
32445
  bin: {
@@ -34315,6 +34315,7 @@ async function resyncDatabase(skipConfirm, backfill) {
34315
34315
  }
34316
34316
  }
34317
34317
  // src/commands/subgraphs.ts
34318
+ import { spawn } from "node:child_process";
34318
34319
  import {
34319
34320
  existsSync as existsSync3,
34320
34321
  mkdirSync as mkdirSync2,
@@ -34638,15 +34639,24 @@ function ensureScaffoldPackageJson(dir) {
34638
34639
  `, "utf8");
34639
34640
  }
34640
34641
  async function runBunInstall(dir) {
34641
- const proc = Bun.spawn(["bun", "install"], {
34642
- cwd: dir,
34643
- stdout: "inherit",
34644
- stderr: "inherit"
34642
+ await new Promise((resolvePromise, reject) => {
34643
+ const proc = spawn("bun", ["install"], {
34644
+ cwd: dir,
34645
+ stdio: "inherit"
34646
+ });
34647
+ proc.on("error", reject);
34648
+ proc.on("close", (exitCode, signal) => {
34649
+ if (exitCode === 0) {
34650
+ resolvePromise();
34651
+ return;
34652
+ }
34653
+ if (exitCode !== null) {
34654
+ reject(new Error(`bun install exited with code ${exitCode}`));
34655
+ return;
34656
+ }
34657
+ reject(new Error(`bun install exited with signal ${signal}`));
34658
+ });
34645
34659
  });
34646
- const exitCode = await proc.exited;
34647
- if (exitCode !== 0) {
34648
- throw new Error(`bun install exited with code ${exitCode}`);
34649
- }
34650
34660
  }
34651
34661
  async function installScaffoldDependencies(dir, options2 = {}) {
34652
34662
  if (options2.install === false)
@@ -36628,5 +36638,5 @@ registerLocalCommand(program);
36628
36638
  registerAccountCommand(program);
36629
36639
  program.parse();
36630
36640
 
36631
- //# debugId=3944D78DF47F7DD164756E2164756E21
36641
+ //# debugId=CA129D1D7E8ADE9A64756E2164756E21
36632
36642
  //# sourceMappingURL=cli.js.map