storyshelf 0.7.0 → 0.8.0
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/dist/client.js +1 -2
- package/dist/commands/build.js +2 -4
- package/dist/commands/connection.js +1 -2
- package/dist/commands/create.js +1 -2
- package/dist/commands/dedup.js +2 -4
- package/dist/commands/default.js +1 -2
- package/dist/commands/doctor.js +2 -4
- package/dist/commands/file-by-file.js +2 -4
- package/dist/commands/init.js +1 -2
- package/dist/commands/mcp/init.js +2 -4
- package/dist/commands/mcp/scaffold.js +2 -3
- package/dist/commands/mcp/serve.js +2 -4
- package/dist/commands/package-usage.js +2 -4
- package/dist/commands/protect-github.js +1 -2
- package/dist/commands/protect-gitlab.js +1 -2
- package/dist/commands/protect-types.js +1 -2
- package/dist/commands/protect.js +1 -2
- package/dist/commands/purge.js +1 -2
- package/dist/commands/retry.js +1 -2
- package/dist/commands/server/docker.js +1 -2
- package/dist/commands/server/init.js +13 -17
- package/dist/commands/server/prompts.js +1 -14
- package/dist/commands/server/serve.js +2 -4
- package/dist/commands/server/terraform-aws.js +541 -51
- package/dist/commands/server/terraform-azure.js +10 -11
- package/dist/commands/server/terraform-gcp.js +8 -9
- package/dist/commands/shared/detect-adapters.js +2 -4
- package/dist/commands/shared/scaffold.js +2 -4
- package/dist/commands/storybook-build.js +2 -4
- package/dist/commands/upload.js +8 -5
- package/dist/commands/whoami.js +1 -2
- package/dist/config.js +4 -7
- package/dist/index.js +1 -2
- package/dist/is-main.js +2 -4
- package/dist/output.js +1 -2
- package/package.json +5 -5
package/dist/client.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import "node:path";
|
|
3
3
|
import "node:url";
|
|
4
4
|
import.meta.url;
|
|
5
|
-
|
|
5
|
+
// src/client.ts
|
|
6
6
|
/**
|
|
7
7
|
* Create a typed API client for a StoryShelf server.
|
|
8
8
|
*
|
|
@@ -138,5 +138,4 @@ function createProjectsApi(baseUrl, authHeaders, requestHeaders) {
|
|
|
138
138
|
admin: createAdminApi(baseUrl, requestHeaders)
|
|
139
139
|
};
|
|
140
140
|
}
|
|
141
|
-
//#endregion
|
|
142
141
|
export { RequestError, createClient };
|
package/dist/commands/build.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "node:path";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
3
|
import "node:url";
|
|
4
4
|
import.meta.url;
|
|
5
5
|
import { loadStorybookConfig } from "../config.js";
|
|
6
6
|
import { printLine } from "../output.js";
|
|
7
7
|
import { assertBuildOutput, ensureBuildDir } from "./storybook-build.js";
|
|
8
|
-
|
|
9
|
-
//#region src/commands/build.ts
|
|
8
|
+
// src/commands/build.ts
|
|
10
9
|
/**
|
|
11
10
|
* Build a Storybook directory without uploading, using the same
|
|
12
11
|
* buildDir/buildCommand/buildScriptName resolution as `upload`.
|
|
@@ -27,5 +26,4 @@ async function runBuild(options) {
|
|
|
27
26
|
await assertBuildOutput(cwd, buildDir);
|
|
28
27
|
printLine(`Build ready: ${resolve(cwd, buildDir)}`);
|
|
29
28
|
}
|
|
30
|
-
//#endregion
|
|
31
29
|
export { runBuild };
|
|
@@ -3,7 +3,7 @@ import "node:path";
|
|
|
3
3
|
import "node:url";
|
|
4
4
|
import.meta.url;
|
|
5
5
|
import { loadStorybookConfig } from "../config.js";
|
|
6
|
-
|
|
6
|
+
// src/commands/connection.ts
|
|
7
7
|
/**
|
|
8
8
|
* Resolve url/slug/token as flags > config file > env, throwing on the first
|
|
9
9
|
* missing value (same messages as `upload`).
|
|
@@ -25,5 +25,4 @@ function assertConnectionFields(fields) {
|
|
|
25
25
|
if (!fields.slug) throw new Error("--slug is required (or .storybook/storyshelf.json / STORYSHELF_SLUG)");
|
|
26
26
|
if (!fields.token) throw new Error("--token is required (or STORYSHELF_TOKEN env)");
|
|
27
27
|
}
|
|
28
|
-
//#endregion
|
|
29
28
|
export { resolveConnection };
|
package/dist/commands/create.js
CHANGED
|
@@ -5,7 +5,7 @@ import.meta.url;
|
|
|
5
5
|
import { assertStorybookMain, detectGitDefaultBranch, detectGitRepository, detectPackageName, detectStorybookMeta, writeStorybookConfig } from "../config.js";
|
|
6
6
|
import { printError, printLine } from "../output.js";
|
|
7
7
|
import { createClient } from "../client.js";
|
|
8
|
-
|
|
8
|
+
// src/commands/create.ts
|
|
9
9
|
async function readCreateInputs(options, cwd) {
|
|
10
10
|
const name = (options.name === "" ? void 0 : options.name) ?? await detectPackageName(cwd);
|
|
11
11
|
return {
|
|
@@ -61,5 +61,4 @@ async function runCreate(options) {
|
|
|
61
61
|
}
|
|
62
62
|
await executeCreate(inputs.url, inputs.token, buildCreatePayload(inputs.name, inputs), cwd);
|
|
63
63
|
}
|
|
64
|
-
//#endregion
|
|
65
64
|
export { runCreate };
|
package/dist/commands/dedup.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "node:path";
|
|
2
|
+
import { join, relative, resolve } from "node:path";
|
|
3
3
|
import "node:url";
|
|
4
4
|
import.meta.url;
|
|
5
5
|
import { readFile, readdir, stat } from "node:fs/promises";
|
|
6
|
-
import { join, relative, resolve } from "node:path";
|
|
7
6
|
import { createHash } from "node:crypto";
|
|
8
|
-
|
|
7
|
+
// src/commands/dedup.ts
|
|
9
8
|
async function walkFiles(cwd, buildDir) {
|
|
10
9
|
const root = resolve(cwd, buildDir);
|
|
11
10
|
const files = [];
|
|
@@ -36,5 +35,4 @@ async function hashFiles(cwd, buildDir, files) {
|
|
|
36
35
|
}
|
|
37
36
|
return results;
|
|
38
37
|
}
|
|
39
|
-
//#endregion
|
|
40
38
|
export { hashFiles, walkFiles };
|
package/dist/commands/default.js
CHANGED
|
@@ -5,7 +5,7 @@ import.meta.url;
|
|
|
5
5
|
import { loadStorybookConfig } from "../config.js";
|
|
6
6
|
import { printError } from "../output.js";
|
|
7
7
|
import { runUpload } from "./upload.js";
|
|
8
|
-
|
|
8
|
+
// src/commands/default.ts
|
|
9
9
|
/** Print an error and mark the process as failed. */
|
|
10
10
|
function handleError(error) {
|
|
11
11
|
printError(error instanceof Error ? error.message : String(error));
|
|
@@ -46,5 +46,4 @@ async function runDefaultCommand(program) {
|
|
|
46
46
|
}
|
|
47
47
|
await runUpload(options).catch(handleError);
|
|
48
48
|
}
|
|
49
|
-
//#endregion
|
|
50
49
|
export { handleError, runDefaultCommand };
|
package/dist/commands/doctor.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "node:path";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
3
|
import "node:url";
|
|
4
4
|
import.meta.url;
|
|
5
5
|
import { findStorybookMain, loadStorybookConfig } from "../config.js";
|
|
@@ -8,9 +8,8 @@ import { needsBuild, resolveBuildCommand } from "./storybook-build.js";
|
|
|
8
8
|
import { createClient } from "../client.js";
|
|
9
9
|
import { resolveConnection } from "./connection.js";
|
|
10
10
|
import { access, readdir } from "node:fs/promises";
|
|
11
|
-
import { resolve } from "node:path";
|
|
12
11
|
import { gitRepoStatus } from "@storyshelf/affected";
|
|
13
|
-
|
|
12
|
+
// src/commands/doctor.ts
|
|
14
13
|
function mark(status) {
|
|
15
14
|
if (status === "pass") return "✓";
|
|
16
15
|
return status === "warn" ? "!" : "✗";
|
|
@@ -146,5 +145,4 @@ function reportChecks(checks) {
|
|
|
146
145
|
for (const check of checks) printLine(`${mark(check.status)} ${check.message}`);
|
|
147
146
|
if (checks.some((check) => check.status === "fail")) process.exitCode = 1;
|
|
148
147
|
}
|
|
149
|
-
//#endregion
|
|
150
148
|
export { runDoctor };
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "node:path";
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
3
|
import "node:url";
|
|
4
4
|
import.meta.url;
|
|
5
5
|
import { RequestError } from "../client.js";
|
|
6
6
|
import { hashFiles, walkFiles } from "./dedup.js";
|
|
7
7
|
import { readFile } from "node:fs/promises";
|
|
8
|
-
|
|
9
|
-
//#region src/commands/file-by-file.ts
|
|
8
|
+
// src/commands/file-by-file.ts
|
|
10
9
|
/**
|
|
11
10
|
* File-by-file upload (`/dedup`, `/content`, `/manifest`): stores a build's files content-addressed
|
|
12
11
|
* and needs no zip extraction on the server, so it publishes on any host, serverless included.
|
|
@@ -70,5 +69,4 @@ async function sendBatch(client, target, batch) {
|
|
|
70
69
|
})));
|
|
71
70
|
await client.projects.builds.uploadContent(target.slug, target.buildId, files);
|
|
72
71
|
}
|
|
73
|
-
//#endregion
|
|
74
72
|
export { isOverInlineLimit, uploadFileByFile };
|
package/dist/commands/init.js
CHANGED
|
@@ -6,7 +6,7 @@ import { assertStorybookMain, detectStorybookMeta, loadStorybookConfig, writeSto
|
|
|
6
6
|
import { printError, printLine } from "../output.js";
|
|
7
7
|
import { createClient } from "../client.js";
|
|
8
8
|
import prompts from "prompts";
|
|
9
|
-
|
|
9
|
+
// src/commands/init.ts
|
|
10
10
|
/** Human description of the detected Storybook (framework, addons, path). */
|
|
11
11
|
function describeMeta(meta) {
|
|
12
12
|
const hintParts = [];
|
|
@@ -193,5 +193,4 @@ async function runInit(options) {
|
|
|
193
193
|
if (!answers) return;
|
|
194
194
|
await finalizeInit(answers, cwd, options);
|
|
195
195
|
}
|
|
196
|
-
//#endregion
|
|
197
196
|
export { runInit };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "node:path";
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
3
|
import "node:url";
|
|
4
4
|
import.meta.url;
|
|
5
5
|
import { detectPackageRunner, installCommand } from "../../config.js";
|
|
@@ -8,9 +8,8 @@ import { PROJECT_PROMPTS } from "../server/prompts.js";
|
|
|
8
8
|
import { SCAFFOLD_DEV_DEPENDENCIES, generateTsconfig, writeScaffoldFile } from "../shared/scaffold.js";
|
|
9
9
|
import { MCP_ENTRY, generateMcpClientConfig, generateMcpDockerfile, generateMcpEntry, generateMcpEnvExample, generateMcpPackageJson } from "./scaffold.js";
|
|
10
10
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
11
|
-
import { join, resolve } from "node:path";
|
|
12
11
|
import prompts from "prompts";
|
|
13
|
-
|
|
12
|
+
// src/commands/mcp/init.ts
|
|
14
13
|
const MCP_PROMPTS = [
|
|
15
14
|
{
|
|
16
15
|
type: "select",
|
|
@@ -81,5 +80,4 @@ function printNextSteps(answers, outDir, install) {
|
|
|
81
80
|
printLine(` npx storyshelf mcp serve --dir .`);
|
|
82
81
|
printLine(`\n.mcp.json is a ready client config for Claude Code (copy to your repo root).`);
|
|
83
82
|
}
|
|
84
|
-
//#endregion
|
|
85
83
|
export { runMcpInit };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import "node:path";
|
|
3
3
|
import "node:url";
|
|
4
4
|
import.meta.url;
|
|
5
|
-
|
|
5
|
+
// src/commands/mcp/scaffold.ts
|
|
6
6
|
/** Entry file of a scaffolded MCP project. */
|
|
7
7
|
const MCP_ENTRY = "src/index.ts";
|
|
8
8
|
/** `src/index.ts`: stdio runs the package bin on import; http mounts the handler on `/mcp`. */
|
|
@@ -39,7 +39,7 @@ function generateMcpPackageJson(answers, devDependencies) {
|
|
|
39
39
|
start: `node ${MCP_ENTRY}`,
|
|
40
40
|
typecheck: "tsc"
|
|
41
41
|
},
|
|
42
|
-
dependencies: { "@storyshelf/mcp": "0.
|
|
42
|
+
dependencies: { "@storyshelf/mcp": "0.8.0" },
|
|
43
43
|
devDependencies
|
|
44
44
|
}, null, 2);
|
|
45
45
|
}
|
|
@@ -88,5 +88,4 @@ function generateMcpDockerfile() {
|
|
|
88
88
|
""
|
|
89
89
|
].join("\n");
|
|
90
90
|
}
|
|
91
|
-
//#endregion
|
|
92
91
|
export { MCP_ENTRY, generateMcpClientConfig, generateMcpDockerfile, generateMcpEntry, generateMcpEnvExample, generateMcpPackageJson };
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "node:path";
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
3
|
import "node:url";
|
|
4
4
|
import.meta.url;
|
|
5
5
|
import { detectPackageRunner, installCommand } from "../../config.js";
|
|
6
6
|
import { printError } from "../../output.js";
|
|
7
7
|
import { defaultSpawnProcess } from "../server/serve.js";
|
|
8
8
|
import { access } from "node:fs/promises";
|
|
9
|
-
|
|
10
|
-
//#region src/commands/mcp/serve.ts
|
|
9
|
+
// src/commands/mcp/serve.ts
|
|
11
10
|
const MCP_CANDIDATES = [
|
|
12
11
|
"src/index.ts",
|
|
13
12
|
"src/index.js",
|
|
@@ -57,5 +56,4 @@ async function warnIfUninstalled(dir) {
|
|
|
57
56
|
printError(`Warning: no node_modules in ${dir} — run "${installCommand(runner)}" there first.`);
|
|
58
57
|
}
|
|
59
58
|
}
|
|
60
|
-
//#endregion
|
|
61
59
|
export { resolveMcpFile, runMcpServe };
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "node:path";
|
|
2
|
+
import { dirname, join, relative, resolve, sep } from "node:path";
|
|
3
3
|
import "node:url";
|
|
4
4
|
import.meta.url;
|
|
5
5
|
import { existsSync } from "node:fs";
|
|
6
6
|
import { readFile, realpath } from "node:fs/promises";
|
|
7
|
-
import { dirname, join, relative, resolve, sep } from "node:path";
|
|
8
7
|
import { extractPackageUsage, loadDepGraph, loadStoryImportPaths, statsPathFor } from "@storyshelf/affected";
|
|
9
|
-
|
|
8
|
+
// src/commands/package-usage.ts
|
|
10
9
|
/** Dependency sections of `package.json` whose packages are tracked. */
|
|
11
10
|
const DEPENDENCY_FIELDS = [
|
|
12
11
|
"dependencies",
|
|
@@ -82,5 +81,4 @@ async function collectPackageUsage(options) {
|
|
|
82
81
|
version: resolved.get(usage.packageName)?.version ?? null
|
|
83
82
|
}));
|
|
84
83
|
}
|
|
85
|
-
//#endregion
|
|
86
84
|
export { collectPackageUsage };
|
|
@@ -3,7 +3,7 @@ import "node:path";
|
|
|
3
3
|
import "node:url";
|
|
4
4
|
import.meta.url;
|
|
5
5
|
import { HostError, hostJson } from "./protect-types.js";
|
|
6
|
-
|
|
6
|
+
// src/commands/protect-github.ts
|
|
7
7
|
/** GitHub: the required status checks of a branch protection rule (REST API, admin token). */
|
|
8
8
|
const API = "https://api.github.com";
|
|
9
9
|
/** The GitHub adapter for `owner/repo`. */
|
|
@@ -105,5 +105,4 @@ async function createRule(ctx, base, target) {
|
|
|
105
105
|
});
|
|
106
106
|
return `Created a rule on ${target.branch} requiring ${target.checks.join(", ")}.`;
|
|
107
107
|
}
|
|
108
|
-
//#endregion
|
|
109
108
|
export { githubProtection };
|
|
@@ -3,7 +3,7 @@ import "node:path";
|
|
|
3
3
|
import "node:url";
|
|
4
4
|
import.meta.url;
|
|
5
5
|
import { HostError, hostJson } from "./protect-types.js";
|
|
6
|
-
|
|
6
|
+
// src/commands/protect-gitlab.ts
|
|
7
7
|
/**
|
|
8
8
|
* GitLab: statuses a build posts join the commit's pipeline, so the merge gate is the project's
|
|
9
9
|
* "pipelines must succeed" setting (`only_allow_merge_if_pipeline_succeeds`). GitLab has no
|
|
@@ -65,5 +65,4 @@ async function isProtected(ctx, branch) {
|
|
|
65
65
|
throw error;
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
//#endregion
|
|
69
68
|
export { gitlabProtection };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import "node:path";
|
|
3
3
|
import "node:url";
|
|
4
4
|
import.meta.url;
|
|
5
|
-
|
|
5
|
+
// src/commands/protect-types.ts
|
|
6
6
|
/** An HTTP failure of a host API call, with the status for callers that branch on 404. */
|
|
7
7
|
var HostError = class extends Error {
|
|
8
8
|
name = "HostError";
|
|
@@ -26,5 +26,4 @@ async function hostJson(fetchImpl, url, init) {
|
|
|
26
26
|
if (!response.ok) throw new HostError(response.status, `${String(response.status)} from ${new URL(url).pathname}: ${text.slice(0, 200)}`);
|
|
27
27
|
return text === "" ? {} : JSON.parse(text);
|
|
28
28
|
}
|
|
29
|
-
//#endregion
|
|
30
29
|
export { HostError, hostJson };
|
package/dist/commands/protect.js
CHANGED
|
@@ -5,7 +5,7 @@ import.meta.url;
|
|
|
5
5
|
import { printError, printLine } from "../output.js";
|
|
6
6
|
import { githubProtection } from "./protect-github.js";
|
|
7
7
|
import { gitlabProtection } from "./protect-gitlab.js";
|
|
8
|
-
|
|
8
|
+
// src/commands/protect.ts
|
|
9
9
|
/** The check names a merge must wait for: the channel's gate status. */
|
|
10
10
|
function requiredChecks(prefix, gate) {
|
|
11
11
|
return [`${prefix}/${gate}`];
|
|
@@ -47,5 +47,4 @@ function adapterFor(options) {
|
|
|
47
47
|
if (options.provider === "gitlab") return gitlabProtection(options.repo, options.host ?? "https://gitlab.com", fetchImpl);
|
|
48
48
|
throw new Error(`Unknown provider "${options.provider}": use github or gitlab`);
|
|
49
49
|
}
|
|
50
|
-
//#endregion
|
|
51
50
|
export { requiredChecks, runProtect };
|
package/dist/commands/purge.js
CHANGED
|
@@ -4,7 +4,7 @@ import "node:url";
|
|
|
4
4
|
import.meta.url;
|
|
5
5
|
import { printLine } from "../output.js";
|
|
6
6
|
import { createClient } from "../client.js";
|
|
7
|
-
|
|
7
|
+
// src/commands/purge.ts
|
|
8
8
|
/**
|
|
9
9
|
* Purge expired builds on a StoryShelf server.
|
|
10
10
|
*
|
|
@@ -15,5 +15,4 @@ async function runPurge(options) {
|
|
|
15
15
|
const resultData = await createClient(options.url, token).projects.admin.purge({});
|
|
16
16
|
printLine(`Removed ${resultData.removedBuilds} build(s) and ${resultData.removedFiles ?? 0} file(s)`);
|
|
17
17
|
}
|
|
18
|
-
//#endregion
|
|
19
18
|
export { runPurge };
|
package/dist/commands/retry.js
CHANGED
|
@@ -4,7 +4,7 @@ import "node:url";
|
|
|
4
4
|
import.meta.url;
|
|
5
5
|
import { printLine } from "../output.js";
|
|
6
6
|
import { createClient } from "../client.js";
|
|
7
|
-
|
|
7
|
+
// src/commands/retry.ts
|
|
8
8
|
/**
|
|
9
9
|
* Retry a failed or cancelled StoryShelf build.
|
|
10
10
|
*
|
|
@@ -15,5 +15,4 @@ async function runRetry(options) {
|
|
|
15
15
|
const buildData = await createClient(options.url, token).projects.builds.retry(options.slug, options.buildId);
|
|
16
16
|
printLine(`Build ${buildData.id} queued for retry`);
|
|
17
17
|
}
|
|
18
|
-
//#endregion
|
|
19
18
|
export { runRetry };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import "node:path";
|
|
3
3
|
import "node:url";
|
|
4
4
|
import.meta.url;
|
|
5
|
-
|
|
5
|
+
// src/commands/server/docker.ts
|
|
6
6
|
/** Playwright base image: its bundled browsers must match the `playwright-core` pin. */
|
|
7
7
|
const PLAYWRIGHT_IMAGE = "mcr.microsoft.com/playwright:v1.63.0-noble";
|
|
8
8
|
/**
|
|
@@ -87,5 +87,4 @@ function composeLines(database) {
|
|
|
87
87
|
function generateComposeYaml(database = "sqlite") {
|
|
88
88
|
return composeLines(database).join("\n");
|
|
89
89
|
}
|
|
90
|
-
//#endregion
|
|
91
90
|
export { generateComposeYaml, generateDockerfile, generateDockerignore };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "node:path";
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
3
|
import "node:url";
|
|
4
4
|
import.meta.url;
|
|
5
5
|
import { detectPackageRunner, installCommand, startCommand } from "../../config.js";
|
|
@@ -12,9 +12,8 @@ import { generateAwsTerraformFiles } from "./terraform-aws.js";
|
|
|
12
12
|
import { generateAzureTerraformFiles } from "./terraform-azure.js";
|
|
13
13
|
import { generateGcpTerraformFiles } from "./terraform-gcp.js";
|
|
14
14
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
15
|
-
import { join, resolve } from "node:path";
|
|
16
15
|
import prompts from "prompts";
|
|
17
|
-
|
|
16
|
+
// src/commands/server/init.ts
|
|
18
17
|
/** DB peer SDK pins (must match db-* peerDependencies). */
|
|
19
18
|
const LIBSQL_CLIENT_SDK = "^0.15.0";
|
|
20
19
|
const BETTER_SQLITE3_SDK = "^12.0.0";
|
|
@@ -234,12 +233,12 @@ function generateServer(answers) {
|
|
|
234
233
|
function buildDeps(answers) {
|
|
235
234
|
const deps = {
|
|
236
235
|
"@hono/node-server": "^1.17.0",
|
|
237
|
-
"@storyshelf/app": "0.
|
|
238
|
-
[DB_PACKAGE[answers.database]]: "0.
|
|
236
|
+
"@storyshelf/app": "0.8.0",
|
|
237
|
+
[DB_PACKAGE[answers.database]]: "0.8.0"
|
|
239
238
|
};
|
|
240
239
|
if (wantsObservability(answers)) {
|
|
241
|
-
deps["@storyshelf/core"] = "0.
|
|
242
|
-
deps["@storyshelf/observability"] = "0.
|
|
240
|
+
deps["@storyshelf/core"] = "0.8.0";
|
|
241
|
+
deps["@storyshelf/observability"] = "0.8.0";
|
|
243
242
|
}
|
|
244
243
|
if (answers.database === "turso") deps["@libsql/client"] = LIBSQL_CLIENT_SDK;
|
|
245
244
|
if (answers.database === "better-sqlite3") deps["better-sqlite3"] = BETTER_SQLITE3_SDK;
|
|
@@ -250,14 +249,14 @@ function buildDeps(answers) {
|
|
|
250
249
|
if (answers.database === "mysql") deps["mysql2"] = MYSQL2_SDK;
|
|
251
250
|
if (answers.database === "planetscale") deps["@planetscale/database"] = PLANETSCALE_SDK;
|
|
252
251
|
if (answers.database === "tidb") deps["@tidbcloud/serverless"] = TIDBCLOUD_SDK;
|
|
253
|
-
if (answers.storage !== "local") deps[STORAGE_PACKAGE[answers.storage]] = "0.
|
|
254
|
-
deps["@storyshelf/runner-playwright"] = "0.
|
|
255
|
-
if (answers.auth !== "none") deps[AUTH_PACKAGE[answers.auth] ?? ""] = "0.
|
|
256
|
-
if (wantsGit(answers)) deps["@storyshelf/notify-git"] = "0.
|
|
257
|
-
if (wantsDesign(answers)) deps["@storyshelf/design-figma"] = "0.
|
|
252
|
+
if (answers.storage !== "local") deps[STORAGE_PACKAGE[answers.storage]] = "0.8.0";
|
|
253
|
+
deps["@storyshelf/runner-playwright"] = "0.8.0";
|
|
254
|
+
if (answers.auth !== "none") deps[AUTH_PACKAGE[answers.auth] ?? ""] = "0.8.0";
|
|
255
|
+
if (wantsGit(answers)) deps["@storyshelf/notify-git"] = "0.8.0";
|
|
256
|
+
if (wantsDesign(answers)) deps["@storyshelf/design-figma"] = "0.8.0";
|
|
258
257
|
if (wantsNotifications(answers)) {
|
|
259
|
-
deps["@storyshelf/notify-chat"] = "0.
|
|
260
|
-
deps["@storyshelf/notify-email"] = "0.
|
|
258
|
+
deps["@storyshelf/notify-chat"] = "0.8.0";
|
|
259
|
+
deps["@storyshelf/notify-email"] = "0.8.0";
|
|
261
260
|
deps["nodemailer"] = NODEMAILER_SDK;
|
|
262
261
|
}
|
|
263
262
|
return deps;
|
|
@@ -347,7 +346,6 @@ async function writeTerraformFiles(outDir, answers) {
|
|
|
347
346
|
const files = generateAwsTerraformFiles({
|
|
348
347
|
project: answers.name,
|
|
349
348
|
region: answers.awsRegion ?? "us-east-1",
|
|
350
|
-
dbEngine: answers.dbEngine ?? "rds",
|
|
351
349
|
...answers.domainName ? { domainName: answers.domainName } : {},
|
|
352
350
|
...answers.samlMetadataUrl ? { samlMetadataUrl: answers.samlMetadataUrl } : {}
|
|
353
351
|
});
|
|
@@ -470,7 +468,6 @@ async function runServerInit(_options) {
|
|
|
470
468
|
answers.docker = true;
|
|
471
469
|
const awsAnswers = await prompts(AWS_INFRA_PROMPTS) ?? {};
|
|
472
470
|
answers.awsRegion = awsAnswers["awsRegion"] ?? "us-east-1";
|
|
473
|
-
answers.dbEngine = awsAnswers["dbEngine"] ?? "rds";
|
|
474
471
|
answers.domainName = awsAnswers["domainName"] ?? void 0;
|
|
475
472
|
answers.samlMetadataUrl = awsAnswers["samlMetadataUrl"] ?? void 0;
|
|
476
473
|
}
|
|
@@ -498,5 +495,4 @@ async function runServerInit(_options) {
|
|
|
498
495
|
await writeFiles(outDir, answers);
|
|
499
496
|
printNextSteps(answers, await detectPackageRunner(process.cwd()));
|
|
500
497
|
}
|
|
501
|
-
//#endregion
|
|
502
498
|
export { runServerInit };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import "node:path";
|
|
3
3
|
import "node:url";
|
|
4
4
|
import.meta.url;
|
|
5
|
-
|
|
5
|
+
// src/commands/server/prompts.ts
|
|
6
6
|
const PROJECT_PROMPTS = [{
|
|
7
7
|
type: "text",
|
|
8
8
|
name: "name",
|
|
@@ -273,18 +273,6 @@ const AWS_INFRA_PROMPTS = [
|
|
|
273
273
|
message: "AWS region?",
|
|
274
274
|
initial: "us-east-1"
|
|
275
275
|
},
|
|
276
|
-
{
|
|
277
|
-
type: "select",
|
|
278
|
-
name: "dbEngine",
|
|
279
|
-
message: "Postgres engine?",
|
|
280
|
-
choices: [{
|
|
281
|
-
title: "RDS (VPC-isolated, battle-tested)",
|
|
282
|
-
value: "rds"
|
|
283
|
-
}, {
|
|
284
|
-
title: "Aurora DSQL (serverless)",
|
|
285
|
-
value: "dsql"
|
|
286
|
-
}]
|
|
287
|
-
},
|
|
288
276
|
{
|
|
289
277
|
type: "text",
|
|
290
278
|
name: "domainName",
|
|
@@ -298,5 +286,4 @@ const AWS_INFRA_PROMPTS = [
|
|
|
298
286
|
initial: ""
|
|
299
287
|
}
|
|
300
288
|
];
|
|
301
|
-
//#endregion
|
|
302
289
|
export { ADVANCED_ADAPTERS_PROMPT, ADVANCED_DATABASE_CHOICES, ADVANCED_STORAGE_CHOICES, AWS_INFRA_PROMPTS, AZURE_INFRA_PROMPTS, CURATED_DATABASE_CHOICES, CURATED_STORAGE_CHOICES, DEPLOY_TARGET_PROMPT, GCP_INFRA_PROMPTS, PROJECT_PROMPTS, databaseChoices, localInfraPrompts, storageChoices };
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "node:path";
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
3
|
import "node:url";
|
|
4
4
|
import.meta.url;
|
|
5
5
|
import { detectPackageRunner, installCommand } from "../../config.js";
|
|
6
6
|
import { printLine } from "../../output.js";
|
|
7
7
|
import { spawn } from "node:child_process";
|
|
8
8
|
import { access } from "node:fs/promises";
|
|
9
|
-
|
|
10
|
-
//#region src/commands/server/serve.ts
|
|
9
|
+
// src/commands/server/serve.ts
|
|
11
10
|
/** Server entry filenames tried in order. */
|
|
12
11
|
const SERVER_CANDIDATES = [
|
|
13
12
|
"src/index.ts",
|
|
@@ -122,5 +121,4 @@ function childEnv(options) {
|
|
|
122
121
|
if (options.port !== void 0) env["PORT"] = options.port;
|
|
123
122
|
return env;
|
|
124
123
|
}
|
|
125
|
-
//#endregion
|
|
126
124
|
export { defaultSpawnProcess, resolveServerFile, runServerServe };
|