Skip to content

Commit cd201d4

Browse files
committed
refactor: consolidate gui package boundaries and release v0.0.10
1 parent c692ff3 commit cd201d4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+502
-1983
lines changed

PUBLISHING.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99

1010
The `publish-package.yml` workflow publishes `@srl-labs/clab-ui` to GitHub Packages.
1111

12-
Wrapper packages in this workspace (`@srl-labs/clab-ui-core`, `@srl-labs/clab-ui-explorer`,
13-
`@srl-labs/clab-ui-inspect`, `@srl-labs/containerlab-gui`) are compatibility layers for local
14-
development and are not published as standalone deliverables in this flow.
12+
No wrapper packages are published separately; consume core/explorer/inspect APIs from
13+
`@srl-labs/clab-ui` subpath exports.
1514

1615
## Local publish (manual)
1716

README.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
Workspace for shared containerlab UI packages.
44

5+
## Setup
6+
7+
Run dependency installation from the workspace root:
8+
9+
```bash
10+
cd /home/flschwar/projects/clab/containerlab-gui
11+
npm install
12+
```
13+
514
## Active development flow
615

716
- `npm run dev`: run the standalone browser harness from `dev/`
@@ -24,14 +33,13 @@ The main published package is:
2433

2534
- `@srl-labs/clab-ui`
2635

27-
Compatibility wrapper packages in this repo:
28-
29-
- `@srl-labs/clab-ui-core`
30-
- `@srl-labs/clab-ui-explorer`
31-
- `@srl-labs/clab-ui-inspect`
32-
- `@srl-labs/containerlab-gui`
36+
Import API surfaces directly from subpaths:
3337

34-
These wrappers are for internal/workspace compatibility and re-export canonical implementations from `@srl-labs/clab-ui`.
38+
- `@srl-labs/clab-ui/core`
39+
- `@srl-labs/clab-ui/explorer`
40+
- `@srl-labs/clab-ui/inspect`
41+
- `@srl-labs/clab-ui/theme`
42+
- `@srl-labs/clab-ui/services`
3543

3644
Host adapter packages:
3745

dev/main.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { createRoot, type Root as ReactRoot } from "react-dom/client";
44
import { ThemeProvider } from "@mui/material/styles";
55
import CssBaseline from "@mui/material/CssBaseline";
66
import { App } from "@webview/App";
7-
import type { CustomNodeTemplate, CustomIconInfo, SchemaData } from "@srl-labs/clab-ui-core";
7+
import type { CustomNodeTemplate, CustomIconInfo, SchemaData } from "@srl-labs/clab-ui/core";
88
import "@webview/styles/global.css";
99
import EditorWorker from "monaco-editor/esm/vs/editor/editor.worker?worker";
1010
import JsonWorker from "monaco-editor/esm/vs/language/json/json.worker?worker";
@@ -18,7 +18,7 @@ import {
1818
EXPORT_COMMANDS,
1919
MSG_SVG_EXPORT_RESULT,
2020
parseSchemaData
21-
} from "@srl-labs/clab-ui-core";
21+
} from "@srl-labs/clab-ui/core";
2222

2323
import { DevStateManager } from "./mock/DevState";
2424
import { DevSettingsOverlay } from "./components/DevSettingsOverlay";
@@ -30,12 +30,12 @@ import {
3030
type ExplorerActionInvocation,
3131
type ExplorerSnapshotOptions,
3232
type ExplorerSnapshotProviders
33-
} from "@srl-labs/clab-ui-explorer";
33+
} from "@srl-labs/clab-ui/explorer";
3434
import type {
3535
ExplorerIncomingMessage,
3636
ExplorerOutgoingMessage,
3737
ExplorerUiState
38-
} from "@srl-labs/clab-ui-explorer";
38+
} from "@srl-labs/clab-ui/explorer";
3939
import { installInMemoryApi } from "./mock/inMemoryApi";
4040
import { loadDevSession, saveDevSession } from "./mock/devSession";
4141

dev/mock/DevState.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Clipboard is handled locally by useUnifiedClipboard (React refs).
1111
*/
1212

13-
import type { CustomNodeTemplate } from "@srl-labs/clab-ui-core";
13+
import type { CustomNodeTemplate } from "@srl-labs/clab-ui/core";
1414

1515
// ============================================================================
1616
// Types

dev/mock/devSession.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { CustomNodeTemplate } from "@srl-labs/clab-ui-core";
1+
import type { CustomNodeTemplate } from "@srl-labs/clab-ui/core";
22

33
const DEV_SESSION_STORAGE_KEY = "containerlab-gui.dev.session.v1";
44

dev/mock/inMemoryApi.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type {
55
TopologyHostCommand,
66
TopologyHostResponseMessage,
77
TopologySnapshot
8-
} from "@srl-labs/clab-ui-core";
8+
} from "@srl-labs/clab-ui/core";
99

1010
import datacenterYaml from "../topologies-original/datacenter.clab.yml?raw";
1111
import datacenterAnnotations from "../topologies-original/datacenter.clab.yml.annotations.json?raw";

dev/mockData.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Mock data for standalone development of React TopoViewer.
33
*/
44

5-
import type { CustomIconInfo, CustomNodeTemplate } from "@srl-labs/clab-ui-core";
5+
import type { CustomIconInfo, CustomNodeTemplate } from "@srl-labs/clab-ui/core";
66

77
/**
88
* Sample custom node templates (from VS Code settings)

dev/tsconfig.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
"./**/*.tsx",
1111
"../src/reactTopoViewer/**/*.ts",
1212
"../src/reactTopoViewer/**/*.tsx",
13-
"../src/webviews/**/*.ts",
14-
"../src/webviews/**/*.tsx",
1513
"../packages/**/*.ts",
1614
"../packages/**/*.tsx"
1715
]

dev/vite.config.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,9 @@ export default defineConfig({
1515
react: path.resolve(nodeModules, "react"),
1616
"react-dom": path.resolve(nodeModules, "react-dom"),
1717
"@webview": path.resolve(__dirname, "../packages/ui/src"),
18-
"@webviews": path.resolve(__dirname, "../src/webviews"),
19-
"@shared": path.resolve(__dirname, "../packages/core/src"),
20-
"@srl-labs/clab-ui-core": path.resolve(__dirname, "../packages/core/src"),
18+
"@webviews": path.resolve(__dirname, "../packages/ui/src/webviews"),
19+
"@shared": path.resolve(__dirname, "../packages/ui/src/core"),
2120
"@srl-labs/clab-ui": path.resolve(__dirname, "../packages/ui/src"),
22-
"@srl-labs/clab-ui-explorer": path.resolve(__dirname, "../packages/explorer/src"),
23-
"@srl-labs/clab-ui-inspect": path.resolve(__dirname, "../packages/inspect/src"),
2421
"@srl-labs/clab-host-contract": path.resolve(__dirname, "../packages/host-contract/src"),
2522
"@srl-labs/clab-adapter-api": path.resolve(__dirname, "../packages/adapter-api/src"),
2623
"@srl-labs/clab-adapter-memory": path.resolve(__dirname, "../packages/adapter-memory/src"),

esbuild.config.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@ const path = require("path");
33
const fs = require("fs");
44
const { execSync } = require("child_process");
55

6+
function resolvePackageFile(specifier) {
7+
try {
8+
return require.resolve(specifier, {
9+
paths: [__dirname, path.join(__dirname, "packages/ui")]
10+
});
11+
} catch {
12+
return null;
13+
}
14+
}
15+
616
const WEBVIEW_ASSET_MANIFEST = {
717
reactTopoViewerWebview: "reactTopoViewerWebview.js",
818
reactTopoViewerStyles: "reactTopoViewerStyles.css",
@@ -60,7 +70,8 @@ async function copyFonts() {
6070
}
6171

6272
async function copyMapLibreWorker() {
63-
const srcPath = path.join(__dirname, "node_modules/maplibre-gl/dist/maplibre-gl-csp-worker.js");
73+
const srcPath = resolvePackageFile("maplibre-gl/dist/maplibre-gl-csp-worker.js");
74+
if (!srcPath) return;
6475
const destPath = path.join(__dirname, "dist/maplibre-gl-csp-worker.js");
6576
if (!fs.existsSync(srcPath)) return;
6677
await fs.promises.copyFile(srcPath, destPath);
@@ -125,19 +136,19 @@ async function build() {
125136
outfile: "dist/containerlabExplorerView.js"
126137
},
127138
{
128-
entryPoints: ["src/webviews/welcome/welcomePage.webview.tsx"],
139+
entryPoints: ["packages/ui/src/webviews/welcome/welcomePage.webview.tsx"],
129140
outfile: "dist/welcomePageWebview.js"
130141
},
131142
{
132143
entryPoints: ["packages/ui/src/inspect/entry.tsx"],
133144
outfile: "dist/inspectWebview.js"
134145
},
135146
{
136-
entryPoints: ["src/webviews/nodeImpairments/nodeImpairments.webview.tsx"],
147+
entryPoints: ["packages/ui/src/webviews/nodeImpairments/nodeImpairments.webview.tsx"],
137148
outfile: "dist/nodeImpairmentsWebview.js"
138149
},
139150
{
140-
entryPoints: ["src/webviews/wiresharkVnc/wiresharkVnc.webview.tsx"],
151+
entryPoints: ["packages/ui/src/webviews/wiresharkVnc/wiresharkVnc.webview.tsx"],
141152
outfile: "dist/wiresharkVncWebview.js"
142153
}
143154
].map((build) =>

0 commit comments

Comments
 (0)