get-ui-cli 0.0.0-stage → 2.0.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.
@@ -0,0 +1,79 @@
1
+ // Load the component index: remote (cached for 24h) -> stale cache -> bundled copy.
2
+ import fs from 'node:fs/promises';
3
+ import os from 'node:os';
4
+ import path from 'node:path';
5
+ import { fileURLToPath } from 'node:url';
6
+ export const REGISTRY_URL = 'https://raw.githubusercontent.com/yashjaiswal2818/getui/main/registry/index.json';
7
+ const MAX_AGE_MS = 24 * 60 * 60 * 1000;
8
+ export function cacheFile() {
9
+ const base = process.env.XDG_CACHE_HOME || path.join(os.homedir(), '.cache');
10
+ return path.join(base, 'get-ui', 'registry.json');
11
+ }
12
+ function bundledPath() {
13
+ // dist/node/registry.js -> ../../registry/index.json ; src/node/registry.ts (tsx) -> same
14
+ return fileURLToPath(new URL('../../registry/index.json', import.meta.url));
15
+ }
16
+ function isRegistry(x) {
17
+ return !!x && typeof x === 'object' && Array.isArray(x.items) && !!x.libraries;
18
+ }
19
+ async function readJson(file) {
20
+ return JSON.parse(await fs.readFile(file, 'utf8'));
21
+ }
22
+ async function fetchJson(url, timeoutMs) {
23
+ const controller = new AbortController();
24
+ const t = setTimeout(() => controller.abort(), timeoutMs);
25
+ try {
26
+ const res = await fetch(url, { signal: controller.signal });
27
+ if (!res.ok)
28
+ throw new Error(`${res.status} ${res.statusText}`);
29
+ return await res.json();
30
+ }
31
+ finally {
32
+ clearTimeout(t);
33
+ }
34
+ }
35
+ export async function loadRegistry(opts = {}) {
36
+ const override = process.env.GET_UI_REGISTRY;
37
+ if (override) {
38
+ const data = /^https?:\/\//.test(override) ? await fetchJson(override, 15_000) : await readJson(path.resolve(override));
39
+ if (!isRegistry(data))
40
+ throw new Error(`GET_UI_REGISTRY (${override}) is not a valid registry index`);
41
+ return { registry: data, source: 'override' };
42
+ }
43
+ const cache = cacheFile();
44
+ let cached;
45
+ try {
46
+ const stat = await fs.stat(cache);
47
+ const data = await readJson(cache);
48
+ if (isRegistry(data)) {
49
+ cached = data;
50
+ if (!opts.refresh && Date.now() - stat.mtimeMs < MAX_AGE_MS)
51
+ return { registry: data, source: 'cache' };
52
+ }
53
+ }
54
+ catch {
55
+ /* no cache */
56
+ }
57
+ try {
58
+ const data = await fetchJson(REGISTRY_URL, 5_000);
59
+ if (isRegistry(data)) {
60
+ try {
61
+ await fs.mkdir(path.dirname(cache), { recursive: true });
62
+ await fs.writeFile(cache, JSON.stringify(data));
63
+ }
64
+ catch {
65
+ /* cache is best-effort */
66
+ }
67
+ return { registry: data, source: 'remote' };
68
+ }
69
+ }
70
+ catch {
71
+ /* offline or not published yet */
72
+ }
73
+ if (cached)
74
+ return { registry: cached, source: 'cache' };
75
+ const data = await readJson(bundledPath());
76
+ if (!isRegistry(data))
77
+ throw new Error('Bundled registry is invalid');
78
+ return { registry: data, source: 'bundled' };
79
+ }
@@ -0,0 +1,48 @@
1
+ export type LibraryId = 'shadcn' | 'magicui' | 'aceternity' | 'reui' | 'kokonutui' | 'cultui' | 'motion-primitives' | 'unlumen' | 'amicro';
2
+ export type ItemKind = 'component' | 'block' | 'snippet';
3
+ /** Every indexed item is a shadcn-schema registry item JSON (files[].content, deps…). */
4
+ export type ItemFormat = 'shadcn';
5
+ export interface Library {
6
+ id: LibraryId;
7
+ name: string;
8
+ homepage: string;
9
+ license: string;
10
+ /** Registry namespace other items use to reference this library, e.g. `@reui/badge`. */
11
+ namespace?: string;
12
+ /** Base URL used to resolve bare `registryDependencies` of this library's items. */
13
+ itemBase?: string;
14
+ /**
15
+ * Raw base URL of the library's source repo. Local files an item imports but
16
+ * its registry entry doesn't ship (an upstream omission) are fetched from here.
17
+ */
18
+ sourceBase?: string;
19
+ count?: number;
20
+ }
21
+ export interface RegistryItem {
22
+ /** Globally unique: `<library>/<name>` */
23
+ id: string;
24
+ library: LibraryId;
25
+ name: string;
26
+ title: string;
27
+ description: string;
28
+ kind: ItemKind;
29
+ category: string;
30
+ dependencies: string[];
31
+ registryDependencies: string[];
32
+ format: ItemFormat;
33
+ /** Where the code lives. Fetched at install/preview time — never stored by us. */
34
+ source: string;
35
+ /** Optional demo item (shadcn format) that renders the component nicely for previews. */
36
+ demo?: string;
37
+ docs: string;
38
+ author?: string;
39
+ /** Paid item: the registry answers 401/403 without a licence key. Hidden from browse by default. */
40
+ pro?: boolean;
41
+ }
42
+ export interface Registry {
43
+ version: 2;
44
+ generatedAt: string;
45
+ libraries: Record<LibraryId, Library>;
46
+ items: RegistryItem[];
47
+ }
48
+ export declare const LIBRARIES: Record<LibraryId, Library>;
@@ -0,0 +1,41 @@
1
+ // Shared registry schema — used by the builder script, the CLI and the web app.
2
+ export const LIBRARIES = {
3
+ shadcn: {
4
+ id: 'shadcn', name: 'shadcn/ui', homepage: 'https://ui.shadcn.com', license: 'MIT',
5
+ itemBase: 'https://ui.shadcn.com/r/styles/new-york-v4/',
6
+ },
7
+ magicui: {
8
+ id: 'magicui', name: 'Magic UI', homepage: 'https://magicui.design', license: 'MIT',
9
+ namespace: '@magicui', itemBase: 'https://magicui.design/r/',
10
+ },
11
+ aceternity: {
12
+ id: 'aceternity', name: 'Aceternity UI', homepage: 'https://ui.aceternity.com', license: 'Aceternity UI licence',
13
+ namespace: '@aceternity', itemBase: 'https://ui.aceternity.com/registry/',
14
+ },
15
+ reui: {
16
+ id: 'reui', name: 'ReUI', homepage: 'https://reui.io', license: 'MIT',
17
+ namespace: '@reui', itemBase: 'https://reui.io/r/styles/base-nova/',
18
+ },
19
+ kokonutui: {
20
+ id: 'kokonutui', name: 'Kokonut UI', homepage: 'https://kokonutui.com', license: 'MIT',
21
+ namespace: '@kokonutui', itemBase: 'https://kokonutui.com/r/',
22
+ },
23
+ cultui: {
24
+ id: 'cultui', name: 'Cult UI', homepage: 'https://www.cult-ui.com', license: 'MIT',
25
+ namespace: '@cult-ui', itemBase: 'https://www.cult-ui.com/r/',
26
+ },
27
+ 'motion-primitives': {
28
+ id: 'motion-primitives', name: 'Motion Primitives', homepage: 'https://motion-primitives.com', license: 'MIT',
29
+ namespace: '@motion-primitives', itemBase: 'https://motion-primitives.com/c/',
30
+ },
31
+ unlumen: {
32
+ id: 'unlumen', name: 'Unlumen UI', homepage: 'https://ui.unlumen.com', license: 'MIT',
33
+ namespace: '@unlumen-ui', itemBase: 'https://ui.unlumen.com/r/',
34
+ },
35
+ amicro: {
36
+ id: 'amicro', name: 'Amicro', homepage: 'https://amicro.vercel.app', license: 'MIT',
37
+ // The site blocks automated fetches; the same registry files live in the MIT repo.
38
+ namespace: '@amicro', itemBase: 'https://raw.githubusercontent.com/Subhan-code/Amicro--Micro-transitions-/main/public/r/',
39
+ sourceBase: 'https://raw.githubusercontent.com/Subhan-code/Amicro--Micro-transitions-/main/',
40
+ },
41
+ };
package/package.json CHANGED
@@ -1,6 +1,70 @@
1
1
  {
2
2
  "name": "get-ui-cli",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "2.0.0",
4
+ "description": "Install any of 2,000+ free UI components (shadcn/ui, Magic UI, Aceternity, ReUI, Kokonut UI, Cult UI, Motion Primitives, Unlumen UI, Amicro) into your React project with one command.",
5
+ "homepage": "https://get-ui.dev",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/yashjaiswal2818/getui.git"
9
+ },
10
+ "bugs": {
11
+ "url": "https://github.com/yashjaiswal2818/getui/issues"
12
+ },
13
+ "main": "dist/index.js",
14
+ "type": "module",
15
+ "bin": {
16
+ "get-ui": "./dist/index.js",
17
+ "get-ui-cli": "./dist/index.js"
18
+ },
19
+ "files": [
20
+ "dist",
21
+ "registry/index.json"
22
+ ],
23
+ "scripts": {
24
+ "build": "rm -rf dist && tsc",
25
+ "dev": "tsx src/index.ts",
26
+ "registry:build": "tsx scripts/build-registry.ts",
27
+ "prepublishOnly": "npm run build",
28
+ "typecheck": "tsc --noEmit"
29
+ },
30
+ "keywords": [
31
+ "shadcn",
32
+ "shadcn-ui",
33
+ "ui",
34
+ "components",
35
+ "react",
36
+ "tailwind",
37
+ "tailwindcss",
38
+ "magicui",
39
+ "aceternity",
40
+ "reui",
41
+ "kokonutui",
42
+ "cult-ui",
43
+ "motion-primitives",
44
+ "cli",
45
+ "registry"
46
+ ],
47
+ "author": "",
48
+ "license": "MIT",
49
+ "dependencies": {
50
+ "@clack/prompts": "^1.8.1",
51
+ "commander": "^14.0.3",
52
+ "node-html-parser": "^9.0.4",
53
+ "picocolors": "^1.1.1"
54
+ },
55
+ "devDependencies": {
56
+ "@types/node": "^26.6.4",
57
+ "tsx": "^4.23.15",
58
+ "typescript": "^7.0.2"
59
+ },
60
+ "exports": {
61
+ ".": "./dist/index.js",
62
+ "./core": {
63
+ "types": "./dist/core/index.d.ts",
64
+ "default": "./dist/core/index.js"
65
+ }
66
+ },
67
+ "engines": {
68
+ "node": ">=18.17"
69
+ }
70
+ }