@usalyt/registry 0.0.1 → 0.0.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.
@@ -23,7 +23,8 @@
23
23
  "const": "usalyt"
24
24
  },
25
25
  "version": {
26
- "const": "0.0.1"
26
+ "type": "string",
27
+ "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$"
27
28
  },
28
29
  "license": {
29
30
  "$ref": "#/$defs/license"
@@ -60,7 +61,7 @@
60
61
  },
61
62
  "$defs": {
62
63
  "license": {
63
- "const": "GPL-3.0-only"
64
+ "const": "MIT"
64
65
  },
65
66
  "auditedLicense": {
66
67
  "enum": ["Apache-2.0", "ISC", "MIT", "OFL-1.1"]
@@ -86,7 +87,7 @@
86
87
  },
87
88
  "sourcePath": {
88
89
  "type": "string",
89
- "pattern": "^(components/[a-z0-9]+(?:-[a-z0-9]+)*/[A-Za-z0-9._-]+|blocks/[a-z0-9]+(?:-[a-z0-9]+)*/[A-Za-z0-9._-]+|lib/[A-Za-z0-9._-]+)$"
90
+ "pattern": "^(components/[a-z0-9]+(?:-[a-z0-9]+)*/[A-Za-z0-9._-]+|blocks/[a-z0-9]+(?:-[a-z0-9]+)*/[A-Za-z0-9._-]+|lib/[A-Za-z0-9._-]+|styles/[A-Za-z0-9._-]+)$"
90
91
  },
91
92
  "file": {
92
93
  "type": "object",
@@ -97,7 +98,7 @@
97
98
  "$ref": "#/$defs/sourcePath"
98
99
  },
99
100
  "type": {
100
- "enum": ["registry:ui", "registry:block", "registry:lib"]
101
+ "enum": ["registry:ui", "registry:block", "registry:lib", "registry:style"]
101
102
  },
102
103
  "content": {
103
104
  "type": "string",
@@ -126,7 +127,7 @@
126
127
  "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
127
128
  },
128
129
  "type": {
129
- "enum": ["registry:ui", "registry:block", "registry:lib"]
130
+ "enum": ["registry:ui", "registry:block", "registry:lib", "registry:style"]
130
131
  },
131
132
  "title": {
132
133
  "type": "string",
@@ -164,9 +164,9 @@ async function main(): Promise<void> {
164
164
  }
165
165
 
166
166
  await fs.outputFile(options.outPath, result.json);
167
- const { primitives, blocks, libraries, items } = result.stats;
167
+ const { primitives, blocks, libraries, styles, items } = result.stats;
168
168
  process.stdout.write(
169
- `Registry written to ${options.outPath} (${primitives} primitives, ${blocks} blocks, ${libraries} shared library, ${items} items).\n`
169
+ `Registry written to ${options.outPath} (${primitives} primitives, ${blocks} blocks, ${libraries} shared library, ${styles} style, ${items} items).\n`
170
170
  );
171
171
  }
172
172
 
@@ -1,14 +1,19 @@
1
1
  import fs from "fs-extra";
2
2
  import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+
5
+ const REGISTRY_PACKAGE_MANIFEST = fs.readJsonSync(
6
+ path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../package.json")
7
+ ) as { version?: string };
3
8
 
4
9
  export const REGISTRY_NAME = "usalyt";
5
- export const REGISTRY_VERSION = "0.0.1";
6
- export const REGISTRY_LICENSE = "GPL-3.0-only";
10
+ export const REGISTRY_VERSION = REGISTRY_PACKAGE_MANIFEST.version ?? "0.0.1";
11
+ export const REGISTRY_LICENSE = "MIT";
7
12
  export const REGISTRY_SCHEMA_REFERENCE = "./schema/registry.schema.json";
8
13
  export const REGISTRY_REPOSITORY = {
9
14
  type: "git",
10
15
  url: "git+https://github.com/Usalyt/ui.git",
11
- directory: "usalyt/packages/registry",
16
+ directory: "packages/registry",
12
17
  } as const;
13
18
 
14
19
  export interface RegistryFile {
@@ -44,6 +49,7 @@ export interface RegistryBuildStats {
44
49
  primitives: number;
45
50
  blocks: number;
46
51
  libraries: number;
52
+ styles: number;
47
53
  items: number;
48
54
  }
49
55
 
@@ -249,10 +255,25 @@ function buildDependencyLicenses(
249
255
  return sortedRecord(entries);
250
256
  }
251
257
 
258
+ async function resolveThemeCssPath(sourceRoot: string): Promise<string> {
259
+ const candidates = [
260
+ path.resolve(sourceRoot, "..", "styles", "theme.css"),
261
+ path.resolve(sourceRoot, "styles", "theme.css"),
262
+ ];
263
+ for (const candidate of candidates) {
264
+ if (await fs.pathExists(candidate)) {
265
+ return candidate;
266
+ }
267
+ }
268
+ throw new Error(
269
+ `Shared theme stylesheet not found next to source root: ${sourceRoot}`
270
+ );
271
+ }
272
+
252
273
  /**
253
274
  * Builds the registry data from an explicit UI source root. The function only
254
- * reads files below `sourceRoot` and the package-local notices file, and it
255
- * never records absolute paths or timestamps.
275
+ * reads files below `sourceRoot` (plus its sibling `styles/theme.css`) and the
276
+ * package-local notices file, and it never records absolute paths or timestamps.
256
277
  */
257
278
  export async function buildRegistry(
258
279
  options: RegistryBuildOptions
@@ -261,6 +282,7 @@ export async function buildRegistry(
261
282
  const componentsDir = path.join(sourceRoot, "components");
262
283
  const blocksDir = path.join(sourceRoot, "blocks");
263
284
  const utilsPath = path.join(sourceRoot, "lib", "utils.ts");
285
+ const themeCssPath = await resolveThemeCssPath(sourceRoot);
264
286
 
265
287
  if (!(await fs.pathExists(componentsDir))) {
266
288
  throw new Error(`UI source root not found or incomplete: ${sourceRoot}`);
@@ -371,12 +393,13 @@ export async function buildRegistry(
371
393
  for (const name of blockNames) {
372
394
  const files = await readItemFiles(sourceRoot, "blocks", name, "registry:block");
373
395
  const title = toTitle(name);
396
+ const blockTitle = title.endsWith(" Block") ? title : `${title} Block`;
374
397
  const { dependencies, dependencyVersions } = dependencyVersionsFor(name, files);
375
398
 
376
399
  items.push({
377
400
  name,
378
401
  type: "registry:block",
379
- title: `${title} Block`,
402
+ title: blockTitle,
380
403
  description: `Composed ${title} block built from Usalyt primitives, Base UI and Tailwind v4.`,
381
404
  license: REGISTRY_LICENSE,
382
405
  dependencies,
@@ -409,6 +432,26 @@ export async function buildRegistry(
409
432
  files: utilsFiles,
410
433
  });
411
434
 
435
+ items.push({
436
+ name: "theme",
437
+ type: "registry:style",
438
+ title: "Theme",
439
+ description:
440
+ "Usalyt Tailwind CSS v4 @theme tokens, dark/light surfaces, and motion primitives.",
441
+ license: REGISTRY_LICENSE,
442
+ dependencies: [],
443
+ devDependencies: [],
444
+ registryDependencies: [],
445
+ dependencyVersions: {},
446
+ files: [
447
+ {
448
+ path: "styles/theme.css",
449
+ type: "registry:style",
450
+ content: await fs.readFile(themeCssPath, "utf-8"),
451
+ },
452
+ ],
453
+ });
454
+
412
455
  items.sort((left, right) => (left.name < right.name ? -1 : left.name > right.name ? 1 : 0));
413
456
 
414
457
  const notices = await readNoticeLicenses(options.packageRoot);
@@ -419,10 +462,16 @@ export async function buildRegistry(
419
462
  ]),
420
463
  ].sort();
421
464
 
465
+ const registryManifestPath = path.join(options.packageRoot, "package.json");
466
+ const registryManifest = (await fs.pathExists(registryManifestPath))
467
+ ? ((await fs.readJson(registryManifestPath)) as { version?: string })
468
+ : undefined;
469
+ const version = registryManifest?.version ?? REGISTRY_VERSION;
470
+
422
471
  const registry: Registry = {
423
472
  $schema: REGISTRY_SCHEMA_REFERENCE,
424
473
  name: REGISTRY_NAME,
425
- version: REGISTRY_VERSION,
474
+ version,
426
475
  license: REGISTRY_LICENSE,
427
476
  repository: REGISTRY_REPOSITORY,
428
477
  dependencyLicenses: buildDependencyLicenses(directDependencyNames, notices),
@@ -436,6 +485,7 @@ export async function buildRegistry(
436
485
  primitives: primitiveNames.length,
437
486
  blocks: blockNames.length,
438
487
  libraries: 1,
488
+ styles: 1,
439
489
  items: items.length,
440
490
  },
441
491
  };