create-bearnie 0.4.2 → 0.4.4
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/README.md +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +29 -1
- package/package.json +3 -2
- package/template/src/styles/bearnie.css +5 -0
package/README.md
CHANGED
|
@@ -29,6 +29,7 @@ This fetches all components from the registry, installs them in `src/components/
|
|
|
29
29
|
- Astro 7 with TypeScript
|
|
30
30
|
- Tailwind CSS v4 (via `@tailwindcss/vite`)
|
|
31
31
|
- Bearnie CSS variables and theme
|
|
32
|
+
- `bearnie.json` CLI config at the project root
|
|
32
33
|
- Simple landing page to get started
|
|
33
34
|
- Ready for components via `npx bearnie add`
|
|
34
35
|
|
package/dist/index.d.ts
ADDED
package/dist/index.js
CHANGED
|
@@ -13,7 +13,15 @@ var link = (text, url) => `\x1B]8;;${url}\x07${pc.cyan(text)}\x1B]8;;\x07`;
|
|
|
13
13
|
function parseFullArg() {
|
|
14
14
|
return process.argv.includes("--full");
|
|
15
15
|
}
|
|
16
|
-
var REGISTRY_URL = "https://bearnie.dev/registry";
|
|
16
|
+
var REGISTRY_URL = process.env.BEARNIE_REGISTRY_URL || "https://bearnie.dev/registry";
|
|
17
|
+
var REGISTRY_PATH = process.env.BEARNIE_REGISTRY_PATH;
|
|
18
|
+
var BEARNIE_CONFIG = {
|
|
19
|
+
componentsDir: "src/components/bearnie",
|
|
20
|
+
utilsDir: "src/utils",
|
|
21
|
+
stylesDir: "src/styles",
|
|
22
|
+
tailwindConfig: "tailwind.config.mjs",
|
|
23
|
+
typescript: true
|
|
24
|
+
};
|
|
17
25
|
var UTILITY_NAMES = [
|
|
18
26
|
"focus-trap",
|
|
19
27
|
"ui-runtime-loader",
|
|
@@ -34,6 +42,13 @@ function resolveInstallPath(targetDir, filePath, type) {
|
|
|
34
42
|
}
|
|
35
43
|
async function fetchRegistryEntry(name) {
|
|
36
44
|
try {
|
|
45
|
+
if (REGISTRY_PATH) {
|
|
46
|
+
const entryPath = path.join(REGISTRY_PATH, `${name}.json`);
|
|
47
|
+
if (await fs.pathExists(entryPath)) {
|
|
48
|
+
return await fs.readJson(entryPath);
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
37
52
|
const response = await fetch(`${REGISTRY_URL}/${name}.json`);
|
|
38
53
|
if (!response.ok) return null;
|
|
39
54
|
return await response.json();
|
|
@@ -42,12 +57,24 @@ async function fetchRegistryEntry(name) {
|
|
|
42
57
|
}
|
|
43
58
|
}
|
|
44
59
|
async function fetchRegistryIndex() {
|
|
60
|
+
if (REGISTRY_PATH) {
|
|
61
|
+
const indexPath = path.join(REGISTRY_PATH, "index.json");
|
|
62
|
+
if (await fs.pathExists(indexPath)) {
|
|
63
|
+
return await fs.readJson(indexPath);
|
|
64
|
+
}
|
|
65
|
+
throw new Error(`Failed to fetch registry index at ${indexPath}`);
|
|
66
|
+
}
|
|
45
67
|
const response = await fetch(`${REGISTRY_URL}/index.json`);
|
|
46
68
|
if (!response.ok) {
|
|
47
69
|
throw new Error("Failed to fetch registry index");
|
|
48
70
|
}
|
|
49
71
|
return await response.json();
|
|
50
72
|
}
|
|
73
|
+
async function writeBearnieConfig(targetDir) {
|
|
74
|
+
await fs.writeJson(path.join(targetDir, "bearnie.json"), BEARNIE_CONFIG, {
|
|
75
|
+
spaces: 2
|
|
76
|
+
});
|
|
77
|
+
}
|
|
51
78
|
async function writeRegistryFiles(targetDir, entry) {
|
|
52
79
|
for (const file of entry.files) {
|
|
53
80
|
const filePath = resolveInstallPath(targetDir, file.path, entry.type);
|
|
@@ -114,6 +141,7 @@ ${fullInstall ? ` ${pc.dim("Full install: including all components")}
|
|
|
114
141
|
const pkg = await fs.readJson(pkgPath);
|
|
115
142
|
pkg.name = finalName;
|
|
116
143
|
await fs.writeJson(pkgPath, pkg, { spaces: 2 });
|
|
144
|
+
await writeBearnieConfig(targetDir);
|
|
117
145
|
if (fullInstall) {
|
|
118
146
|
console.log(`
|
|
119
147
|
${pc.dim("Fetching components from registry...")}
|
package/package.json
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-bearnie",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"description": "Create a new Astro project with Bearnie UI components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bin": {
|
|
8
8
|
"create-bearnie": "dist/index.js"
|
|
9
9
|
},
|
|
10
|
+
"types": "dist/index.d.ts",
|
|
10
11
|
"files": [
|
|
11
12
|
"dist",
|
|
12
13
|
"template"
|
|
13
14
|
],
|
|
14
15
|
"scripts": {
|
|
15
|
-
"build": "tsup src/index.ts --format esm --clean",
|
|
16
|
+
"build": "tsup src/index.ts --format esm --clean && tsc --emitDeclarationOnly",
|
|
16
17
|
"dev": "tsup src/index.ts --format esm --watch"
|
|
17
18
|
},
|
|
18
19
|
"dependencies": {
|
|
@@ -61,6 +61,9 @@
|
|
|
61
61
|
/* Surface */
|
|
62
62
|
--color-surface: var(--surface);
|
|
63
63
|
|
|
64
|
+
/* Canvas */
|
|
65
|
+
--color-canvas: var(--canvas);
|
|
66
|
+
|
|
64
67
|
/* Shadows — theme-aware via elevation tokens */
|
|
65
68
|
--shadow-xs: var(--elevation-xs);
|
|
66
69
|
--shadow-sm: var(--elevation-sm);
|
|
@@ -106,6 +109,7 @@
|
|
|
106
109
|
|
|
107
110
|
--overlay: oklch(0 0 0);
|
|
108
111
|
--surface: oklch(1 0 0);
|
|
112
|
+
--canvas: var(--muted);
|
|
109
113
|
|
|
110
114
|
--sidebar: oklch(0.985 0 0);
|
|
111
115
|
--sidebar-foreground: oklch(0.145 0 0);
|
|
@@ -194,6 +198,7 @@
|
|
|
194
198
|
|
|
195
199
|
--overlay: oklch(0 0 0);
|
|
196
200
|
--surface: oklch(0.19 0 0);
|
|
201
|
+
--canvas: oklch(0.185 0 0);
|
|
197
202
|
|
|
198
203
|
--sidebar: oklch(0.205 0 0);
|
|
199
204
|
--sidebar-foreground: oklch(0.985 0 0);
|