@0xgf/boneyard 1.0.1 → 1.1.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.
- package/bin/boneyard.mjs +52 -1
- package/package.json +1 -1
package/bin/boneyard.mjs
CHANGED
|
@@ -43,7 +43,7 @@ if (command !== 'build') {
|
|
|
43
43
|
const urls = []
|
|
44
44
|
// Auto-detect: prefer ./src/bones for projects with a src/ directory (Next.js, Vite, etc.)
|
|
45
45
|
let outDir = existsSync(resolve(process.cwd(), 'src')) ? './src/bones' : './bones'
|
|
46
|
-
let breakpoints =
|
|
46
|
+
let breakpoints = null // null = auto-detect
|
|
47
47
|
let waitMs = 800
|
|
48
48
|
|
|
49
49
|
for (let i = 1; i < args.length; i++) {
|
|
@@ -58,6 +58,57 @@ for (let i = 1; i < args.length; i++) {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
// ── Auto-detect breakpoints from Tailwind ────────────────────────────────────
|
|
62
|
+
|
|
63
|
+
/** Tailwind v4 default breakpoints */
|
|
64
|
+
const TAILWIND_DEFAULTS = [640, 768, 1024, 1280, 1536]
|
|
65
|
+
|
|
66
|
+
function detectTailwindBreakpoints() {
|
|
67
|
+
// Check for Tailwind v4 (CSS-based config)
|
|
68
|
+
const cssConfigPaths = [
|
|
69
|
+
'src/app/globals.css',
|
|
70
|
+
'src/globals.css',
|
|
71
|
+
'app/globals.css',
|
|
72
|
+
'styles/globals.css',
|
|
73
|
+
'src/index.css',
|
|
74
|
+
'index.css',
|
|
75
|
+
]
|
|
76
|
+
|
|
77
|
+
for (const p of cssConfigPaths) {
|
|
78
|
+
const full = resolve(process.cwd(), p)
|
|
79
|
+
if (!existsSync(full)) continue
|
|
80
|
+
try {
|
|
81
|
+
const css = await import('fs').then(m => m.readFileSync(full, 'utf-8'))
|
|
82
|
+
if (css.includes('@import "tailwindcss"') || css.includes("@import 'tailwindcss'") || css.includes('@tailwind')) {
|
|
83
|
+
return TAILWIND_DEFAULTS
|
|
84
|
+
}
|
|
85
|
+
} catch {}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Check for tailwind in package.json dependencies
|
|
89
|
+
try {
|
|
90
|
+
const pkgPath = resolve(process.cwd(), 'package.json')
|
|
91
|
+
if (existsSync(pkgPath)) {
|
|
92
|
+
const pkg = JSON.parse(await import('fs').then(m => m.readFileSync(pkgPath, 'utf-8')))
|
|
93
|
+
const allDeps = { ...pkg.dependencies, ...pkg.devDependencies }
|
|
94
|
+
if (allDeps['tailwindcss']) return TAILWIND_DEFAULTS
|
|
95
|
+
}
|
|
96
|
+
} catch {}
|
|
97
|
+
|
|
98
|
+
return null
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (!breakpoints) {
|
|
102
|
+
const tw = await detectTailwindBreakpoints()
|
|
103
|
+
if (tw) {
|
|
104
|
+
// Add mobile (375) as the smallest breakpoint since Tailwind's start at 640
|
|
105
|
+
breakpoints = [375, ...tw]
|
|
106
|
+
process.stdout.write(` boneyard: detected Tailwind — using breakpoints: ${breakpoints.join(', ')}px\n`)
|
|
107
|
+
} else {
|
|
108
|
+
breakpoints = [375, 768, 1280]
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
61
112
|
// ── Auto-detect dev server ────────────────────────────────────────────────────
|
|
62
113
|
|
|
63
114
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xgf/boneyard",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Pixel-perfect skeleton loading screens. Wrap your component in <Skeleton> and boneyard snapshots the real DOM layout — no manual descriptors, no configuration.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|