frakment 0.0.1 → 3.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.
@@ -1,61 +0,0 @@
1
- import { existsSync } from "node:fs";
2
- import { readFile } from "node:fs/promises";
3
- import path from "node:path";
4
-
5
- import * as p from "@clack/prompts";
6
- import pc from "picocolors";
7
-
8
- import { findProjectRoot } from "../utils/detect.js";
9
-
10
- export async function list(options) {
11
- p.intro(`${pc.dim("frakment")} list`);
12
-
13
- let cwd;
14
- try {
15
- cwd = findProjectRoot(process.cwd());
16
- } catch (error) {
17
- p.outro(pc.red("error ") + error.message);
18
- process.exit(1);
19
- }
20
-
21
- const configPath = path.join(cwd, "components.json");
22
- if (!existsSync(configPath)) {
23
- p.outro(
24
- `${pc.red("error ")}components.json not found. Run \`frakment init\` first.`
25
- );
26
- process.exit(1);
27
- }
28
-
29
- const config = JSON.parse(await readFile(configPath, "utf-8"));
30
- const registryUrl = (options.registry ?? config.registry).replace(/\/$/u, "");
31
- const s = p.spinner();
32
- s.start("fetching components");
33
-
34
- let index;
35
- try {
36
- const res = await fetch(`${registryUrl}/index.json`);
37
- if (!res.ok) {
38
- throw new Error(`HTTP ${res.status}`);
39
- }
40
- index = await res.json();
41
- } catch {
42
- s.stop(`${pc.red("✗")} failed to fetch component list`);
43
- process.exit(1);
44
- }
45
- s.stop(`${pc.green("✓")} found ${index.components.length} component(s)`);
46
-
47
- if (!index.components.length) {
48
- p.outro(pc.dim("no components available yet"));
49
- return;
50
- }
51
-
52
- const nameWidth = Math.max(...index.components.map((c) => c.name.length));
53
- const lines = index.components.map(
54
- (c) =>
55
- ` ${pc.cyan(c.name.padEnd(nameWidth))} ${pc.dim(c.description ?? "")}`
56
- );
57
-
58
- p.outro(
59
- `${lines.join("\n")}\n\n Add one with ${pc.cyan("frakment add <name>")}`
60
- );
61
- }
@@ -1,38 +0,0 @@
1
- import { existsSync } from "node:fs";
2
- import path from "node:path";
3
-
4
- export function findProjectRoot(startDir) {
5
- let dir = startDir;
6
- while (dir !== path.dirname(dir)) {
7
- if (existsSync(path.join(dir, "package.json"))) {
8
- return dir;
9
- }
10
- dir = path.dirname(dir);
11
- }
12
- throw new Error("No package.json found. Are you inside a project?");
13
- }
14
-
15
- export function detectPackageManager(cwd) {
16
- if (existsSync(path.join(cwd, "pnpm-lock.yaml"))) {
17
- return "pnpm";
18
- }
19
- if (existsSync(path.join(cwd, "yarn.lock"))) {
20
- return "yarn";
21
- }
22
- if (existsSync(path.join(cwd, "bun.lockb"))) {
23
- return "bun";
24
- }
25
- return "npm";
26
- }
27
-
28
- export function detectGlobalsCss(cwd) {
29
- const candidates = [
30
- "app/globals.css",
31
- "src/app/globals.css",
32
- "styles/globals.css",
33
- "src/styles/globals.css",
34
- ];
35
- return (
36
- candidates.find((p) => existsSync(path.join(cwd, p))) ?? "app/globals.css"
37
- );
38
- }
@@ -1,12 +0,0 @@
1
- export const SPRING_SMOOTH = {
2
- damping: 30,
3
- stiffness: 200,
4
- type: "spring",
5
- } as const;
6
-
7
- export const EASE_OUT = [0.16, 1, 0.3, 1] as const;
8
- export const EASE_SMOOTH = [0.32, 0.72, 0, 1] as const;
9
- export const EASE_IN_OUT = [0.4, 0, 0.2, 1] as const;
10
-
11
- export const DURATION_FAST = 0.2;
12
- export const DURATION_SMOOTH = 0.45;