@glasshome/widget-cli 0.15.5 → 0.16.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glasshome/widget-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "CLI for creating and managing GlassHome widgets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@fontsource-variable/geist-mono": "^5.2.8",
|
|
48
48
|
"@glasshome/sync-layer": "0.11.5",
|
|
49
49
|
"@glasshome/widget-contract": "0.3.0",
|
|
50
|
-
"@glasshome/widget-sdk": "1.
|
|
50
|
+
"@glasshome/widget-sdk": "1.21.0",
|
|
51
51
|
"@iconify-json/lucide": "^1.2.0",
|
|
52
52
|
"@iconify-json/mdi": "^1.2.3",
|
|
53
53
|
"@iconify/utils": "^3.1.4",
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { afterEach, describe, expect, test } from "bun:test";
|
|
2
|
+
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { lintAndReport } from "./lint-source";
|
|
6
|
+
|
|
7
|
+
let root: string | undefined;
|
|
8
|
+
|
|
9
|
+
afterEach(() => {
|
|
10
|
+
if (root) rmSync(root, { recursive: true, force: true });
|
|
11
|
+
root = undefined;
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
describe("lintAndReport", () => {
|
|
15
|
+
test("a widget stylesheet reading the glass internals warns; the public contract does not", () => {
|
|
16
|
+
root = mkdtempSync(join(tmpdir(), "lint-source-"));
|
|
17
|
+
mkdirSync(join(root, "src", "neon"), { recursive: true });
|
|
18
|
+
writeFileSync(
|
|
19
|
+
join(root, "src", "neon", "neon.css"),
|
|
20
|
+
[
|
|
21
|
+
".key { box-shadow: var(--material-raised); background: var(--material-face); }",
|
|
22
|
+
".rim { box-shadow: var(--glass-rim-shine); }",
|
|
23
|
+
].join("\n"),
|
|
24
|
+
);
|
|
25
|
+
const findings = lintAndReport(root, ["neon"]);
|
|
26
|
+
expect(findings.map((f) => f.line)).toEqual([2]);
|
|
27
|
+
expect(findings[0]?.message).toContain("internal-material-vars");
|
|
28
|
+
});
|
|
29
|
+
});
|
package/src/utils/lint-source.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { deprecations, formatDeprecation } from "@glasshome/widget-sdk/deprecati
|
|
|
5
5
|
import { discoverWidgets } from "./manifest";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Source-level deprecation lint. Scans widget `.ts`/`.tsx` for deprecated API usage
|
|
8
|
+
* Source-level deprecation lint. Scans widget `.ts`/`.tsx`/`.css` for deprecated API usage
|
|
9
9
|
* (driven by the SDK deprecation registry) and direct `zod` imports, printing the
|
|
10
10
|
* removal timeline. Warnings only: never blocks a build until the deprecated path is
|
|
11
11
|
* actually removed (v2). Runs on `bun widget build` and `connect`.
|
|
@@ -18,7 +18,7 @@ export interface SourceLintFinding {
|
|
|
18
18
|
message: string;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
const SOURCE_EXTS = [".ts", ".tsx"];
|
|
21
|
+
const SOURCE_EXTS = [".ts", ".tsx", ".css"];
|
|
22
22
|
const ZOD_IMPORT = /\bfrom\s+["']zod["']/;
|
|
23
23
|
const ZOD_IMPORT_MESSAGE =
|
|
24
24
|
'importing from "zod" directly couples your widget to the SDK\'s zod version. Prefer field.*/defineConfig; for advanced schemas import { z } from "@glasshome/widget-sdk".';
|