dslinter 0.1.0 → 0.1.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.
- package/CHANGELOG.md +4 -0
- package/bin/lib/dev-banner.mjs +6 -3
- package/bin/lib/dev-banner.test.mjs +19 -3
- package/bin/modes/dev.mjs +19 -7
- package/dashboard-dist/assets/index-B6zsYv3h.js +206 -0
- package/dashboard-dist/assets/index-BhDQfrwA.css +1 -0
- package/dashboard-dist/index.html +2 -2
- package/index.cjs +52 -52
- package/package.json +6 -6
- package/src/components/ComponentInspectPane.tsx +178 -0
- package/src/components/DashboardCommandPalette.tsx +1 -15
- package/src/components/GovernancePane.tsx +3 -3
- package/src/components/Sidebar.tsx +4 -8
- package/src/dashboard/ComponentCatalog.tsx +41 -68
- package/src/dashboard/ComponentPropUsageDetail.tsx +90 -0
- package/src/dashboard/DashboardBody.tsx +3 -3
- package/src/index.ts +7 -0
- package/src/playground/buildPlaygroundEntriesFromReport.test.ts +53 -0
- package/src/playground/buildPlaygroundEntriesFromReport.ts +349 -0
- package/src/report/findingsForComponent.ts +24 -0
- package/src/shell/DashboardLayout.tsx +40 -37
- package/src/shell/hashRoute.test.ts +41 -0
- package/src/shell/hashRoute.ts +2 -1
- package/dashboard-dist/assets/index-Pc1to7nD.css +0 -1
- package/dashboard-dist/assets/index-YvDeIoPr.js +0 -205
package/CHANGELOG.md
CHANGED
package/bin/lib/dev-banner.mjs
CHANGED
|
@@ -196,7 +196,10 @@ export function formatDevBanner(opts) {
|
|
|
196
196
|
plainWidths.push(14 + 2 + `${apiBase}/events`.length);
|
|
197
197
|
}
|
|
198
198
|
if (opts.pollMs) plainWidths.push(14 + 2 + `polling every ${opts.pollMs} ms`.length);
|
|
199
|
-
|
|
199
|
+
const footerPlain = opts.bundledUrl
|
|
200
|
+
? " Open the Bundled UI URL in your browser. Ctrl+C to stop."
|
|
201
|
+
: " Open the Dashboard URL in your browser. Ctrl+C to stop.";
|
|
202
|
+
plainWidths.push(visibleLength(footerPlain));
|
|
200
203
|
|
|
201
204
|
const contentWidth = Math.min(maxBox - 4, Math.max(...plainWidths, 40));
|
|
202
205
|
const totalWidth = contentWidth + 4;
|
|
@@ -213,7 +216,7 @@ export function formatDevBanner(opts) {
|
|
|
213
216
|
...row(color.label("Report file"), reportPlain, contentWidth, color.value),
|
|
214
217
|
);
|
|
215
218
|
styledRows.push("");
|
|
216
|
-
if (opts.dashboardUrl) {
|
|
219
|
+
if (opts.dashboardUrl && !opts.bundledUrl) {
|
|
217
220
|
styledRows.push(
|
|
218
221
|
...row(color.label("Dashboard"), opts.dashboardUrl, contentWidth, color.url),
|
|
219
222
|
);
|
|
@@ -251,7 +254,7 @@ export function formatDevBanner(opts) {
|
|
|
251
254
|
);
|
|
252
255
|
}
|
|
253
256
|
styledRows.push("");
|
|
254
|
-
styledRows.push(color.dim(
|
|
257
|
+
styledRows.push(color.dim(footerPlain));
|
|
255
258
|
|
|
256
259
|
return boxLines(styledRows, totalWidth).join("\n");
|
|
257
260
|
}
|
|
@@ -22,7 +22,7 @@ describe("shortenPath", () => {
|
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
describe("formatDevBanner", () => {
|
|
25
|
-
it("includes logo, scan path, report,
|
|
25
|
+
it("includes logo, scan path, report, bundled UI, and API URLs", () => {
|
|
26
26
|
const text = formatDevBanner({
|
|
27
27
|
scanPath: "/tmp/components",
|
|
28
28
|
reportPath: "/tmp/components/public/dslint-report.json",
|
|
@@ -36,11 +36,27 @@ describe("formatDevBanner", () => {
|
|
|
36
36
|
expect(text).toContain(LOGO[1]);
|
|
37
37
|
expect(text).toContain("Scan path");
|
|
38
38
|
expect(text).toContain("Report file");
|
|
39
|
-
expect(text).toContain("
|
|
40
|
-
expect(text).toContain("http://localhost:5173/");
|
|
39
|
+
expect(text).toContain("Bundled UI");
|
|
40
|
+
expect(text).not.toContain("http://localhost:5173/");
|
|
41
|
+
expect(text).not.toMatch(/\bDashboard\b/);
|
|
41
42
|
expect(text).toContain("7878");
|
|
42
43
|
expect(text).toContain("dslint-report.json");
|
|
43
44
|
expect(text).toContain("polling every 150 ms");
|
|
45
|
+
expect(text).toContain("Open the Bundled UI URL");
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it("shows dashboard URL when bundled UI is not served", () => {
|
|
49
|
+
const text = formatDevBanner({
|
|
50
|
+
scanPath: "/tmp/components",
|
|
51
|
+
reportPath: "/tmp/components/public/dslint-report.json",
|
|
52
|
+
apiPort: 7878,
|
|
53
|
+
apiAvailable: true,
|
|
54
|
+
dashboardUrl: "http://localhost:5173/",
|
|
55
|
+
pollMs: 150,
|
|
56
|
+
});
|
|
57
|
+
expect(text).toContain("Dashboard");
|
|
58
|
+
expect(text).toContain("http://localhost:5173/");
|
|
59
|
+
expect(text).toContain("Open the Dashboard URL");
|
|
44
60
|
});
|
|
45
61
|
|
|
46
62
|
it("marks API unavailable when port is busy", () => {
|
package/bin/modes/dev.mjs
CHANGED
|
@@ -152,11 +152,17 @@ export async function runDevMode({ scanPath, outputPath, scannerArgs, servePort
|
|
|
152
152
|
{
|
|
153
153
|
cwd: embedRoot,
|
|
154
154
|
stdio: "inherit",
|
|
155
|
-
env: {
|
|
155
|
+
env: {
|
|
156
|
+
...process.env,
|
|
157
|
+
DSLINT_SERVE_PORT: String(port),
|
|
158
|
+
DSLINT_SCAN_ROOT: scanAbs,
|
|
159
|
+
},
|
|
156
160
|
},
|
|
157
161
|
);
|
|
158
162
|
children.push(vite);
|
|
159
|
-
printDevBanner(
|
|
163
|
+
printDevBanner(
|
|
164
|
+
attachBundledStatic ? bannerBase : { ...bannerBase, dashboardUrl },
|
|
165
|
+
);
|
|
160
166
|
|
|
161
167
|
vite.on("exit", (code, signal) => {
|
|
162
168
|
cleanup("SIGTERM");
|
|
@@ -183,11 +189,17 @@ export async function runDevMode({ scanPath, outputPath, scannerArgs, servePort
|
|
|
183
189
|
{
|
|
184
190
|
cwd: consumerViteRoot,
|
|
185
191
|
stdio: "inherit",
|
|
186
|
-
env: {
|
|
192
|
+
env: {
|
|
193
|
+
...process.env,
|
|
194
|
+
DSLINT_SERVE_PORT: String(port),
|
|
195
|
+
DSLINT_SCAN_ROOT: scanAbs,
|
|
196
|
+
},
|
|
187
197
|
},
|
|
188
198
|
);
|
|
189
199
|
children.push(vite);
|
|
190
|
-
printDevBanner(
|
|
200
|
+
printDevBanner(
|
|
201
|
+
attachBundledStatic ? bannerBase : { ...bannerBase, dashboardUrl },
|
|
202
|
+
);
|
|
191
203
|
|
|
192
204
|
vite.on("exit", (code, signal) => {
|
|
193
205
|
cleanup("SIGTERM");
|
|
@@ -198,9 +210,9 @@ export async function runDevMode({ scanPath, outputPath, scannerArgs, servePort
|
|
|
198
210
|
}
|
|
199
211
|
|
|
200
212
|
if (bundledDist) {
|
|
201
|
-
const
|
|
202
|
-
printDevBanner(
|
|
203
|
-
maybeOpenBrowser(
|
|
213
|
+
const openUrl = bundledUrl ?? `http://127.0.0.1:${port}/`;
|
|
214
|
+
printDevBanner(bannerBase);
|
|
215
|
+
maybeOpenBrowser(openUrl);
|
|
204
216
|
scanner.on("exit", (code) => process.exit(code ?? 0));
|
|
205
217
|
return;
|
|
206
218
|
}
|