@mccaskie-labs/workbench-ui 0.5.0 → 0.5.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @mccaskie-labs/workbench-ui
2
2
 
3
+ ## 0.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - `npx workbench-ui styles` takes every `ToolStyles` a package exports at `./styles`, one per tool, each with its own prefix (was exactly one), so workbench-availability 0.2.0's calendar (`wb-cal-`) and onboarding cards (`wb-onboard-`) both reach workbench.css.
8
+
3
9
  ## 0.5.0
4
10
 
5
11
  ### Minor Changes
package/dist/cli.js CHANGED
@@ -47,16 +47,20 @@ export async function installedStyles(dir) {
47
47
  continue;
48
48
  const mod = (await import(__rewriteRelativeImportExtension(pathToFileURL(req.resolve(`${name}/styles`)).href)));
49
49
  const found = Object.values(mod).filter((x) => !!x && typeof x === "object" && x.format === 1 && typeof x.prefix === "string");
50
- if (found.length !== 1)
51
- throw new Error(`${name}/styles must export exactly one ToolStyles`);
52
- tools.push({ styles: found[0], version: manifest.version });
50
+ // One ToolStyles per tool the package draws (workbench-availability has the calendar and onboarding), each with its own prefix.
51
+ if (found.length === 0)
52
+ throw new Error(`${name}/styles must export at least one ToolStyles`);
53
+ if (new Set(found.map((f) => f.prefix)).size !== found.length)
54
+ throw new Error(`${name}/styles exports two ToolStyles with one prefix`);
55
+ for (const f of found.sort((a, b) => (a.prefix < b.prefix ? -1 : 1)))
56
+ tools.push({ styles: f, version: manifest.version });
53
57
  }
54
58
  const own = JSON.parse(read(resolve(dirname(fileURLToPath(import.meta.url)), "../package.json")));
55
59
  const uiVersion = version("@mccaskie-labs/workbench-ui") ?? own.version;
56
60
  // The page look's own classes are always there: this command is workbench-ui.
57
61
  if (!tools.some((t) => t.styles.package === UI_STYLES.package))
58
62
  tools.push({ styles: UI_STYLES, version: uiVersion });
59
- tools.sort((a, b) => (a.styles.package < b.styles.package ? -1 : 1));
63
+ tools.sort((a, b) => (a.styles.package < b.styles.package ? -1 : a.styles.package > b.styles.package ? 1 : a.styles.prefix < b.styles.prefix ? -1 : 1));
60
64
  return { tools, uiVersion };
61
65
  }
62
66
  /** What `styles` writes in `dir`, and what --check would fail on, without touching the disk. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mccaskie-labs/workbench-ui",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Workbench pages: one dark look, a top bar with the environment tag, cards, outcome pills, and one format for times, money and durations.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",