@spencer-kit/coder-studio 0.3.1 → 0.3.2
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/CHANGELOG.md +6 -0
- package/README.md +14 -79
- package/dist/esm/bin.mjs +592 -287
- package/dist/esm/bin.mjs.map +4 -4
- package/dist/esm/server-runner.mjs +450 -168
- package/dist/esm/server-runner.mjs.map +4 -4
- package/dist/web/assets/index-BjrMfcUG.js +111 -0
- package/dist/web/assets/index-BjrMfcUG.js.map +1 -0
- package/dist/web/assets/index-mL_Aq31j.css +1 -0
- package/dist/web/favicon.ico +0 -0
- package/dist/web/favicon.png +0 -0
- package/dist/web/favicon.svg +19 -0
- package/dist/web/index.html +4 -4
- package/package.json +2 -2
- package/src/browser.test.ts +50 -0
- package/src/browser.ts +1 -0
- package/src/cli.ts +3 -11
- package/src/package-manifest.test.ts +14 -0
- package/src/package-manifest.ts +28 -0
- package/src/pm2-control.test.ts +89 -1
- package/src/pm2-control.ts +99 -57
- package/src/server-control.test.ts +19 -0
- package/src/server-control.ts +1 -1
- package/src/server-runner.test.ts +14 -0
- package/src/server-runner.ts +2 -0
- package/dist/web/assets/index-A-2YPePM.js +0 -111
- package/dist/web/assets/index-A-2YPePM.js.map +0 -1
- package/dist/web/assets/index-BLMivSS1.css +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { fileURLToPath } from "url";
|
|
2
2
|
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
3
|
+
import { getCliVersion } from "./package-manifest.js";
|
|
3
4
|
|
|
4
5
|
const { createServer, readCliConfig, hasWebAssets, getStaticAssetsDir } = vi.hoisted(() => ({
|
|
5
6
|
createServer: vi.fn(),
|
|
@@ -29,6 +30,17 @@ describe("server-runner", () => {
|
|
|
29
30
|
vi.clearAllMocks();
|
|
30
31
|
});
|
|
31
32
|
|
|
33
|
+
it("includes the CLI package version in the server config", () => {
|
|
34
|
+
readCliConfig.mockReturnValue(null);
|
|
35
|
+
hasWebAssets.mockReturnValue(true);
|
|
36
|
+
getStaticAssetsDir.mockReturnValue("/tmp/web");
|
|
37
|
+
|
|
38
|
+
expect(buildServerConfig()).toMatchObject({
|
|
39
|
+
appVersion: getCliVersion(import.meta.url),
|
|
40
|
+
webRoot: "/tmp/web",
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
32
44
|
it("ignores ephemeral port zero from saved cli config", () => {
|
|
33
45
|
readCliConfig.mockReturnValue({
|
|
34
46
|
host: "127.0.0.1",
|
|
@@ -40,6 +52,7 @@ describe("server-runner", () => {
|
|
|
40
52
|
getStaticAssetsDir.mockReturnValue("/tmp/web");
|
|
41
53
|
|
|
42
54
|
expect(buildServerConfig()).toEqual({
|
|
55
|
+
appVersion: getCliVersion(import.meta.url),
|
|
43
56
|
host: "127.0.0.1",
|
|
44
57
|
dataDir: "/tmp/cs-data/coder-studio.db",
|
|
45
58
|
auth: {
|
|
@@ -67,6 +80,7 @@ describe("server-runner", () => {
|
|
|
67
80
|
const runningServer = await startServer();
|
|
68
81
|
|
|
69
82
|
expect(createServer).toHaveBeenCalledWith({
|
|
83
|
+
appVersion: getCliVersion(import.meta.url),
|
|
70
84
|
host: "127.0.0.1",
|
|
71
85
|
port: 4173,
|
|
72
86
|
webRoot: "/tmp/web",
|
package/src/server-runner.ts
CHANGED
|
@@ -3,12 +3,14 @@ import { fileURLToPath } from "url";
|
|
|
3
3
|
import { readCliConfig } from "./config-store.js";
|
|
4
4
|
import { getStaticAssetsDir, hasWebAssets } from "./embed.js";
|
|
5
5
|
import { assertSupportedNodeVersion } from "./node-version.js";
|
|
6
|
+
import { getCliVersion } from "./package-manifest.js";
|
|
6
7
|
|
|
7
8
|
const MISSING_WEB_ASSETS_WARNING = "Warning: Web assets not found. Frontend will not be available.";
|
|
8
9
|
|
|
9
10
|
export const buildServerConfig = (): Partial<ServerConfig> => {
|
|
10
11
|
const savedConfig = readCliConfig();
|
|
11
12
|
const config: Partial<ServerConfig> = {
|
|
13
|
+
appVersion: getCliVersion(import.meta.url),
|
|
12
14
|
...(savedConfig?.host !== undefined ? { host: savedConfig.host } : {}),
|
|
13
15
|
...(savedConfig?.port !== undefined && savedConfig.port > 0 ? { port: savedConfig.port } : {}),
|
|
14
16
|
...(savedConfig?.dataDir !== undefined ? { dataDir: savedConfig.dataDir } : {}),
|