storyshelf 0.6.0 → 0.6.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.
@@ -229,7 +229,7 @@ function buildRouterLines(answers) {
229
229
  if (answers.queue === "memory") lines.push(` logger: shelfLogger,`, ` observability,`, ` config: {`, ` secret: process.env.SECRET,`, ` // Rotation: keep the old SECRET here until credentials are re-encrypted.`, ` previousSecret: process.env.SECRET_PREVIOUS || undefined,`, ` migrateCredentialsOnBoot: process.env.SECRET_MIGRATE === "true",`, ` scratchDir: dataDir,`, ` },`);
230
230
  else lines.push(` logger: shelfLogger,`, ` observability,`, ` config: {`, ` secret: process.env.SECRET,`, ` // Rotation: keep the old SECRET here until credentials are re-encrypted.`, ` previousSecret: process.env.SECRET_PREVIOUS || undefined,`, ` migrateCredentialsOnBoot: process.env.SECRET_MIGRATE === "true",`, ` },`);
231
231
  lines.push(`});`, ``, `await app.lifecycle.setup();`, `const logger = app.lifecycle.logger;`);
232
- if (answers.auth === "password") lines.push(``, `// Provision the env-driven local admin (AUTH_PASSWORD, at least 12 chars).`, `await ensurePasswordAdmin(database, {`, ` email: process.env.AUTH_EMAIL ?? "admin@local",`, ` password: process.env.AUTH_PASSWORD!,`, `});`);
232
+ if (answers.auth === "password") lines.push(``, `// Provision the env-driven local admin (AUTH_PASSWORD, at least 12 chars).`, `await ensurePasswordAdmin(database, {`, ` email: process.env.AUTH_EMAIL ?? "admin@example.com",`, ` password: process.env.AUTH_PASSWORD!,`, `});`);
233
233
  return lines;
234
234
  }
235
235
  function generateServer(answers) {
@@ -318,10 +318,10 @@ function generateWorkerFile(answers) {
318
318
  function buildDeps(answers) {
319
319
  const deps = {
320
320
  "@hono/node-server": "^1.17.0",
321
- "@storyshelf/core": "0.6.0",
322
- "@storyshelf/app": "0.6.0",
323
- "@storyshelf/observability": "0.6.0",
324
- [DB_PACKAGE[answers.database]]: "0.6.0"
321
+ "@storyshelf/core": "0.6.1",
322
+ "@storyshelf/app": "0.6.1",
323
+ "@storyshelf/observability": "0.6.1",
324
+ [DB_PACKAGE[answers.database]]: "0.6.1"
325
325
  };
326
326
  if (answers.database === "turso") deps["@libsql/client"] = LIBSQL_CLIENT_SDK;
327
327
  if (answers.database === "better-sqlite3") deps["better-sqlite3"] = BETTER_SQLITE3_SDK;
@@ -332,40 +332,40 @@ function buildDeps(answers) {
332
332
  if (answers.database === "mysql") deps["mysql2"] = MYSQL2_SDK;
333
333
  if (answers.database === "planetscale") deps["@planetscale/database"] = PLANETSCALE_SDK;
334
334
  if (answers.database === "tidb") deps["@tidbcloud/serverless"] = TIDBCLOUD_SDK;
335
- if (answers.storage !== "local") deps[STORAGE_PACKAGE[answers.storage]] = "0.6.0";
335
+ if (answers.storage !== "local") deps[STORAGE_PACKAGE[answers.storage]] = "0.6.1";
336
336
  if (answers.queue === "sqs" || answers.queue === "redis") {
337
337
  const queuePkg = answers.queue === "redis" ? "@storyshelf/queue-redis" : "@storyshelf/queue-sqs";
338
- deps[queuePkg] = "0.6.0";
338
+ deps[queuePkg] = "0.6.1";
339
339
  if (answers.includeWorker) {
340
- deps["@storyshelf/worker"] = "0.6.0";
341
- deps["@storyshelf/runner-playwright"] = "0.6.0";
340
+ deps["@storyshelf/worker"] = "0.6.1";
341
+ deps["@storyshelf/runner-playwright"] = "0.6.1";
342
342
  }
343
343
  } else if (answers.queue === "azure-storage-queues" || answers.queue === "azure-service-bus") {
344
- deps["@storyshelf/queue-azure"] = "0.6.0";
344
+ deps["@storyshelf/queue-azure"] = "0.6.1";
345
345
  const sdk = azureSdkDep(answers.queue);
346
346
  deps[sdk.name] = sdk.version;
347
347
  if (answers.includeWorker) {
348
- deps["@storyshelf/worker"] = "0.6.0";
349
- deps["@storyshelf/runner-playwright"] = "0.6.0";
348
+ deps["@storyshelf/worker"] = "0.6.1";
349
+ deps["@storyshelf/runner-playwright"] = "0.6.1";
350
350
  }
351
351
  } else if (answers.queue === "gcp-pubsub") {
352
- deps["@storyshelf/queue-gcp"] = "0.6.0";
352
+ deps["@storyshelf/queue-gcp"] = "0.6.1";
353
353
  deps["@google-cloud/pubsub"] = GCP_PUBSUB_SDK;
354
354
  if (answers.includeWorker) {
355
- deps["@storyshelf/worker"] = "0.6.0";
356
- deps["@storyshelf/runner-playwright"] = "0.6.0";
355
+ deps["@storyshelf/worker"] = "0.6.1";
356
+ deps["@storyshelf/runner-playwright"] = "0.6.1";
357
357
  }
358
- } else deps["@storyshelf/runner-playwright"] = "0.6.0";
359
- if (answers.auth !== "none") deps[AUTH_PACKAGE[answers.auth] ?? ""] = "0.6.0";
360
- if (answers.git !== "none") deps[GIT_PACKAGE[answers.git] ?? ""] = "0.6.0";
358
+ } else deps["@storyshelf/runner-playwright"] = "0.6.1";
359
+ if (answers.auth !== "none") deps[AUTH_PACKAGE[answers.auth] ?? ""] = "0.6.1";
360
+ if (answers.git !== "none") deps[GIT_PACKAGE[answers.git] ?? ""] = "0.6.1";
361
361
  if (wantsNotifications(answers)) {
362
- deps["@storyshelf/notify-chat"] = "0.6.0";
363
- deps["@storyshelf/notify-email"] = "0.6.0";
362
+ deps["@storyshelf/notify-chat"] = "0.6.1";
363
+ deps["@storyshelf/notify-email"] = "0.6.1";
364
364
  deps["nodemailer"] = NODEMAILER_SDK;
365
365
  }
366
366
  if (answers.queue !== "memory") {
367
367
  const queuePkg = QUEUE_PACKAGE[answers.queue];
368
- if (queuePkg) deps[queuePkg] = "0.6.0";
368
+ if (queuePkg) deps[queuePkg] = "0.6.1";
369
369
  }
370
370
  return deps;
371
371
  }
@@ -159,10 +159,10 @@ function generateWorker(answers) {
159
159
  }
160
160
  function buildDeps(answers) {
161
161
  const deps = {
162
- "@storyshelf/core": "0.6.0",
163
- "@storyshelf/worker": "0.6.0",
164
- "@storyshelf/runner-playwright": "0.6.0",
165
- [DB_PACKAGE[answers.database]]: "0.6.0"
162
+ "@storyshelf/core": "0.6.1",
163
+ "@storyshelf/worker": "0.6.1",
164
+ "@storyshelf/runner-playwright": "0.6.1",
165
+ [DB_PACKAGE[answers.database]]: "0.6.1"
166
166
  };
167
167
  if (answers.database === "turso") deps["@libsql/client"] = LIBSQL_CLIENT_SDK;
168
168
  if (answers.database === "better-sqlite3") deps["better-sqlite3"] = BETTER_SQLITE3_SDK;
@@ -173,9 +173,9 @@ function buildDeps(answers) {
173
173
  if (answers.database === "mysql") deps["mysql2"] = MYSQL2_SDK;
174
174
  if (answers.database === "planetscale") deps["@planetscale/database"] = PLANETSCALE_SDK;
175
175
  if (answers.database === "tidb") deps["@tidbcloud/serverless"] = TIDBCLOUD_SDK;
176
- if (answers.storage !== "local") deps[STORAGE_PACKAGE[answers.storage]] = "0.6.0";
176
+ if (answers.storage !== "local") deps[STORAGE_PACKAGE[answers.storage]] = "0.6.1";
177
177
  const qp = QUEUE_PACKAGE[answers.queue];
178
- if (qp) deps[qp] = "0.6.0";
178
+ if (qp) deps[qp] = "0.6.1";
179
179
  if (answers.queue === "azure-storage-queues") deps["@azure/storage-queue"] = AZURE_STORAGE_QUEUE_SDK;
180
180
  if (answers.queue === "azure-service-bus") deps["@azure/service-bus"] = AZURE_SERVICE_BUS_SDK;
181
181
  if (answers.queue === "gcp-pubsub") deps["@google-cloud/pubsub"] = GCP_PUBSUB_SDK;
package/dist/config.js CHANGED
@@ -2,11 +2,11 @@
2
2
  import "node:path";
3
3
  import "node:url";
4
4
  import.meta.url;
5
- import { fileURLToPath } from "node:url";
6
5
  import { dirname, join, relative, resolve, sep } from "node:path";
7
6
  import { execSync } from "node:child_process";
8
7
  import { existsSync } from "node:fs";
9
8
  import { access, mkdir, readFile, writeFile } from "node:fs/promises";
9
+ import { fileURLToPath } from "node:url";
10
10
  //#region src/config.ts
11
11
  /** Parse an unknown value into a `StorybookConfig`, or return the reason it is invalid. */
12
12
  function parseStorybookConfig(value) {
@@ -233,7 +233,7 @@ const SCHEMA_BASE_URL = "https://unpkg.com/storyshelf";
233
233
  const SCHEMA_PACKAGE_PATH = "schema/storyshelf-config.json";
234
234
  /** Running CLI version, or undefined in dev/test without the build define. */
235
235
  function cliVersion() {
236
- return "0.6.0";
236
+ return "0.6.1";
237
237
  }
238
238
  /**
239
239
  * Resolve the `$schema` value for a config file: a path relative to the
package/dist/index.js CHANGED
@@ -15,8 +15,8 @@ import { runServerServe } from "./commands/server/serve.js";
15
15
  import { runWhoami } from "./commands/whoami.js";
16
16
  import { runWorkerInit } from "./commands/worker/init.js";
17
17
  import { runWorkerServe } from "./commands/worker/serve.js";
18
+ import { isMainModule } from "./is-main.js";
18
19
  import { Command } from "commander";
19
- import { pathToFileURL } from "node:url";
20
20
  //#region src/index.ts
21
21
  /**
22
22
  * Build the StoryShelf CLI program with all subcommands registered.
@@ -85,7 +85,7 @@ function buildWhoamiCommand() {
85
85
  function buildRetryCommand() {
86
86
  return new Command("retry").description("Retry a failed StoryShelf build").requiredOption("--url <url>", "server base URL").requiredOption("--slug <slug>", "project slug").requiredOption("--build-id <id>", "build id").option("--token <token>", "CI token (or STORYSHELF_TOKEN env)").action(run(runRetry));
87
87
  }
88
- if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
88
+ if (isMainModule(import.meta.url, process.argv[1])) {
89
89
  const program = createProgram();
90
90
  if (process.argv.length <= 2) await runDefaultCommand(program);
91
91
  else program.parse(process.argv);
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env node
2
+ import "node:path";
3
+ import "node:url";
4
+ import.meta.url;
5
+ import { realpathSync } from "node:fs";
6
+ import { pathToFileURL } from "node:url";
7
+ //#region src/is-main.ts
8
+ /**
9
+ * Whether the module at `metaUrl` is the process entrypoint. Resolves symlinks
10
+ * in `argv[1]`: npm/npx launch bins through a `.bin/<name>` symlink, so a plain
11
+ * `pathToFileURL(argv[1])` comparison never matches and the CLI would exit
12
+ * silently without parsing its arguments.
13
+ */
14
+ function isMainModule(metaUrl, argv1) {
15
+ if (!argv1) return false;
16
+ try {
17
+ return metaUrl === pathToFileURL(realpathSync(argv1)).href;
18
+ } catch {
19
+ return metaUrl === pathToFileURL(argv1).href;
20
+ }
21
+ }
22
+ //#endregion
23
+ export { isMainModule };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "storyshelf",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "StoryShelf CLI: create projects, upload builds, purge, and retry from CI.",
5
5
  "keywords": [
6
6
  "ci",
@@ -50,7 +50,7 @@
50
50
  "prepublishOnly": "nub run build"
51
51
  },
52
52
  "dependencies": {
53
- "@storyshelf/affected": "0.6.0",
53
+ "@storyshelf/affected": "0.6.1",
54
54
  "archiver": "8.0.0",
55
55
  "commander": "^13.0.0",
56
56
  "hono": "^4.11.0",
@@ -58,7 +58,7 @@
58
58
  "prompts": "^2.4.2"
59
59
  },
60
60
  "devDependencies": {
61
- "@storyshelf/core": "0.6.0",
61
+ "@storyshelf/core": "0.6.1",
62
62
  "@types/node": "^26.0.0",
63
63
  "@types/picomatch": "^4.0.1",
64
64
  "@types/prompts": "^2.4.9",