juas.dev 1.0.2 → 1.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/src/lib/logger.js CHANGED
@@ -1,22 +1,22 @@
1
- // ============================================================
2
- // logger.js — colourful terminal output helpers
3
- // ============================================================
4
- import pc from "picocolors";
5
-
6
- export const logger = {
7
- info: (...args) => console.log(pc.cyan(" ●"), ...args),
8
- success: (...args) => console.log(pc.green(" ✔"), ...args),
9
- warn: (...args) => console.log(pc.yellow(" ⚠"), ...args),
10
- error: (...args) => console.error(pc.red(" ✖"), ...args),
11
- label: (label, value) => console.log(` ${pc.bold(label + ":")} ${value}`),
12
- divider: () => console.log(pc.dim(" " + "─".repeat(52))),
13
- blank: () => console.log(),
14
-
15
- banner() {
16
- console.log();
17
- console.log(pc.bold(pc.magenta(" ┌──────────────────────────────────────┐")));
18
- console.log(pc.bold(pc.magenta(" │ juas.dev CLI ⚡ │")));
19
- console.log(pc.bold(pc.magenta(" └──────────────────────────────────────┘")));
20
- console.log();
21
- },
22
- };
1
+ // ============================================================
2
+ // logger.js — colourful terminal output helpers
3
+ // ============================================================
4
+ import pc from "picocolors";
5
+
6
+ export const logger = {
7
+ info: (...args) => console.log(pc.cyan(" ●"), ...args),
8
+ success: (...args) => console.log(pc.green(" ✔"), ...args),
9
+ warn: (...args) => console.log(pc.yellow(" ⚠"), ...args),
10
+ error: (...args) => console.error(pc.red(" ✖"), ...args),
11
+ label: (label, value) => console.log(` ${pc.bold(label + ":")} ${value}`),
12
+ divider: () => console.log(pc.dim(" " + "─".repeat(52))),
13
+ blank: () => console.log(),
14
+
15
+ banner() {
16
+ console.log();
17
+ console.log(pc.bold(pc.magenta(" ┌──────────────────────────────────────┐")));
18
+ console.log(pc.bold(pc.magenta(" │ juas.dev CLI ⚡ │")));
19
+ console.log(pc.bold(pc.magenta(" └──────────────────────────────────────┘")));
20
+ console.log();
21
+ },
22
+ };
@@ -1,81 +1,81 @@
1
- // ============================================================
2
- // supabase.js — lightweight REST client for the CLI
3
- // Uses the PUBLIC anon key — safe to ship in the npm package
4
- // ============================================================
5
-
6
- export const SUPABASE_URL = "https://jznmqsiueeauoulgvzww.supabase.co";
7
- export const SUPABASE_ANON_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Imp6bm1xc2l1ZWVhdW91bGd2end3Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODE1MTA0MjIsImV4cCI6MjA5NzA4NjQyMn0.KG54rFl_jT0ofhQ9KuYGEQYNC8_kZD0KxoCpmXWz1pU";
8
-
9
- /**
10
- * Thin fetch wrapper around the Supabase REST API.
11
- */
12
- export async function supabaseGet(table, params = {}) {
13
- const url = new URL(`${SUPABASE_URL}/rest/v1/${table}`);
14
- Object.entries(params).forEach(([k, v]) => url.searchParams.set(k, v));
15
-
16
- const res = await fetch(url.toString(), {
17
- headers: {
18
- apikey: SUPABASE_ANON_KEY,
19
- Authorization: `Bearer ${SUPABASE_ANON_KEY}`,
20
- "Content-Type": "application/json",
21
- },
22
- });
23
-
24
- if (!res.ok) {
25
- const txt = await res.text();
26
- throw new Error(`Supabase error ${res.status}: ${txt}`);
27
- }
28
-
29
- return res.json();
30
- }
31
-
32
- /**
33
- * Fetch a single component + its latest version code by slug.
34
- */
35
- export async function fetchComponentBySlug(slug) {
36
- const components = await supabaseGet("components", {
37
- slug: `eq.${slug}`,
38
- status: "eq.published",
39
- select: "id,name,slug,description,category,tags,tech_stack,framework,latest_version",
40
- limit: "1",
41
- });
42
-
43
- if (!components.length) return null;
44
- const component = components[0];
45
-
46
- const versions = await supabaseGet("component_versions", {
47
- component_id: `eq.${component.id}`,
48
- version: `eq.${component.latest_version}`,
49
- select: "id,version,code_tsx,code_css,dependencies,readme",
50
- limit: "1",
51
- });
52
-
53
- return { component, version: versions[0] ?? null };
54
- }
55
-
56
- /**
57
- * List all published components.
58
- */
59
- export async function listComponents({ category } = {}) {
60
- const params = {
61
- status: "eq.published",
62
- select: "id,name,slug,description,category,tags,tech_stack,latest_version",
63
- order: "name.asc",
64
- limit: "200",
65
- };
66
- if (category) params.category = `eq.${category}`;
67
- return supabaseGet("components", params);
68
- }
69
-
70
- /**
71
- * Search components by name or description.
72
- */
73
- export async function searchComponents(query) {
74
- return supabaseGet("components", {
75
- status: "eq.published",
76
- or: `name.ilike.*${query}*,description.ilike.*${query}*`,
77
- select: "id,name,slug,description,category,tags,latest_version",
78
- order: "name.asc",
79
- limit: "50",
80
- });
81
- }
1
+ // ============================================================
2
+ // supabase.js — lightweight REST client for the CLI
3
+ // Uses the PUBLIC anon key — safe to ship in the npm package
4
+ // ============================================================
5
+
6
+ export const SUPABASE_URL = "https://jznmqsiueeauoulgvzww.supabase.co";
7
+ export const SUPABASE_ANON_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Imp6bm1xc2l1ZWVhdW91bGd2end3Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODE1MTA0MjIsImV4cCI6MjA5NzA4NjQyMn0.KG54rFl_jT0ofhQ9KuYGEQYNC8_kZD0KxoCpmXWz1pU";
8
+
9
+ /**
10
+ * Thin fetch wrapper around the Supabase REST API.
11
+ */
12
+ export async function supabaseGet(table, params = {}) {
13
+ const url = new URL(`${SUPABASE_URL}/rest/v1/${table}`);
14
+ Object.entries(params).forEach(([k, v]) => url.searchParams.set(k, v));
15
+
16
+ const res = await fetch(url.toString(), {
17
+ headers: {
18
+ apikey: SUPABASE_ANON_KEY,
19
+ Authorization: `Bearer ${SUPABASE_ANON_KEY}`,
20
+ "Content-Type": "application/json",
21
+ },
22
+ });
23
+
24
+ if (!res.ok) {
25
+ const txt = await res.text();
26
+ throw new Error(`Supabase error ${res.status}: ${txt}`);
27
+ }
28
+
29
+ return res.json();
30
+ }
31
+
32
+ /**
33
+ * Fetch a single component + its latest version code by slug.
34
+ */
35
+ export async function fetchComponentBySlug(slug) {
36
+ const components = await supabaseGet("components", {
37
+ slug: `eq.${slug}`,
38
+ status: "in.(published,featured)",
39
+ select: "id,name,slug,description,category,tags,tech_stack,framework,latest_version,pricing_tier,project_files",
40
+ limit: "1",
41
+ });
42
+
43
+ if (!components.length) return null;
44
+ const component = components[0];
45
+
46
+ const versions = await supabaseGet("component_versions", {
47
+ component_id: `eq.${component.id}`,
48
+ version: `eq.${component.latest_version}`,
49
+ select: "id,version,code_tsx,code_css,dependencies,readme",
50
+ limit: "1",
51
+ });
52
+
53
+ return { component, version: versions[0] ?? null };
54
+ }
55
+
56
+ /**
57
+ * List all published components.
58
+ */
59
+ export async function listComponents({ category } = {}) {
60
+ const params = {
61
+ status: "in.(published,featured)",
62
+ select: "id,name,slug,description,category,tags,tech_stack,latest_version",
63
+ order: "name.asc",
64
+ limit: "200",
65
+ };
66
+ if (category) params.category = `eq.${category}`;
67
+ return supabaseGet("components", params);
68
+ }
69
+
70
+ /**
71
+ * Search components by name or description.
72
+ */
73
+ export async function searchComponents(query) {
74
+ return supabaseGet("components", {
75
+ status: "in.(published,featured)",
76
+ or: `name.ilike.*${query}*,description.ilike.*${query}*`,
77
+ select: "id,name,slug,description,category,tags,latest_version",
78
+ order: "name.asc",
79
+ limit: "50",
80
+ });
81
+ }