create-bl-theme 1.0.4 → 1.0.5
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 +35 -4
- package/bin/cli.js +50 -14
- package/package.json +3 -2
- package/templates/style.rics +11 -0
- package/templates/style.css +0 -6
package/README.md
CHANGED
|
@@ -42,7 +42,8 @@ create-bl-theme validate https://github.com/username/theme-repo
|
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
The validator checks:
|
|
45
|
-
- Required files (metadata.json, style.css, images/)
|
|
45
|
+
- Required files (metadata.json, style.rics or style.css, images/)
|
|
46
|
+
- RICS syntax validation (for .rics files)
|
|
46
47
|
- Valid JSON structure and required fields
|
|
47
48
|
- Image integrity (detects corrupted files)
|
|
48
49
|
- Image dimensions (recommends 1280x720, but other sizes work fine)
|
|
@@ -52,7 +53,7 @@ The validator checks:
|
|
|
52
53
|
```
|
|
53
54
|
my-theme/
|
|
54
55
|
├── metadata.json # Theme metadata (required)
|
|
55
|
-
├── style.
|
|
56
|
+
├── style.rics # Your styles in RICS format (required)
|
|
56
57
|
├── DESCRIPTION.md # Rich description (optional, takes precedence)
|
|
57
58
|
├── shader.json # Shader config (if enabled)
|
|
58
59
|
├── README.md # Theme documentation
|
|
@@ -60,6 +61,33 @@ my-theme/
|
|
|
60
61
|
└── preview.png
|
|
61
62
|
```
|
|
62
63
|
|
|
64
|
+
## RICS
|
|
65
|
+
|
|
66
|
+
Themes use [RICS](https://github.com/better-lyrics/rics) - a lightweight CSS preprocessor with full CSS parity. RICS adds variables, nesting, and mixins while staying close to standard CSS.
|
|
67
|
+
|
|
68
|
+
**Any valid CSS is also valid RICS**, so you can write plain CSS if you prefer.
|
|
69
|
+
|
|
70
|
+
```scss
|
|
71
|
+
$accent: #ff6b6b;
|
|
72
|
+
|
|
73
|
+
.lyrics-container {
|
|
74
|
+
background: rgba(0, 0, 0, 0.8);
|
|
75
|
+
|
|
76
|
+
.lyrics-line {
|
|
77
|
+
color: $accent;
|
|
78
|
+
|
|
79
|
+
&.active {
|
|
80
|
+
font-weight: bold;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
- **Playground:** https://rics.boidu.dev
|
|
87
|
+
- **RICS Docs:** https://github.com/better-lyrics/rics
|
|
88
|
+
|
|
89
|
+
> **Note:** Both `.rics` and `.css` files are supported. The validator prefers `.rics` if both exist.
|
|
90
|
+
|
|
63
91
|
### Theme Description Options
|
|
64
92
|
|
|
65
93
|
You can provide your theme description in two ways:
|
|
@@ -77,7 +105,7 @@ Better Lyrics supports **GitHub Flavored Markdown (GFM)** in DESCRIPTION.md, so
|
|
|
77
105
|
|
|
78
106
|
## Theme Development
|
|
79
107
|
|
|
80
|
-
1. **Edit `style.
|
|
108
|
+
1. **Edit `style.rics`** - Add your custom styles using RICS or plain CSS. Use browser DevTools to inspect Better Lyrics elements and find the right selectors.
|
|
81
109
|
|
|
82
110
|
2. **Add screenshots** - Place at least one preview image in `images/`. Recommended size: 1280x720 (16:9 aspect ratio).
|
|
83
111
|
|
|
@@ -85,10 +113,13 @@ Better Lyrics supports **GitHub Flavored Markdown (GFM)** in DESCRIPTION.md, so
|
|
|
85
113
|
|
|
86
114
|
4. **Test locally** - Install your theme via "Install from URL" in Better Lyrics using your local path or GitHub repo URL.
|
|
87
115
|
|
|
116
|
+
**Resources:**
|
|
117
|
+
- [Styling Guide](https://github.com/better-lyrics/better-lyrics/blob/master/STYLING.md) - Available selectors and styling reference
|
|
118
|
+
|
|
88
119
|
## Submitting to Theme Store
|
|
89
120
|
|
|
90
121
|
1. Push your theme to a GitHub repository
|
|
91
|
-
2. Fork [
|
|
122
|
+
2. Fork [themes](https://github.com/better-lyrics/themes)
|
|
92
123
|
3. Add your theme to `index.json`:
|
|
93
124
|
```json
|
|
94
125
|
{
|
package/bin/cli.js
CHANGED
|
@@ -8,6 +8,7 @@ import os from "os";
|
|
|
8
8
|
import { fileURLToPath } from "url";
|
|
9
9
|
import { imageSize } from "image-size";
|
|
10
10
|
import { execSync } from "child_process";
|
|
11
|
+
import { compileWithDetails } from "rics";
|
|
11
12
|
|
|
12
13
|
const __filename = fileURLToPath(import.meta.url);
|
|
13
14
|
const __dirname = path.dirname(__filename);
|
|
@@ -212,12 +213,12 @@ Any special instructions for using this theme.
|
|
|
212
213
|
fs.writeFileSync(path.join(fullPath, "DESCRIPTION.md"), descriptionMd);
|
|
213
214
|
}
|
|
214
215
|
|
|
215
|
-
// Create style.
|
|
216
|
-
const
|
|
217
|
-
path.join(TEMPLATES_DIR, "style.
|
|
216
|
+
// Create style.rics from template
|
|
217
|
+
const ricsTemplate = fs.readFileSync(
|
|
218
|
+
path.join(TEMPLATES_DIR, "style.rics"),
|
|
218
219
|
"utf-8"
|
|
219
220
|
);
|
|
220
|
-
fs.writeFileSync(path.join(fullPath, "style.
|
|
221
|
+
fs.writeFileSync(path.join(fullPath, "style.rics"), ricsTemplate);
|
|
221
222
|
|
|
222
223
|
// Create shader.json if needed
|
|
223
224
|
if (response.hasShaders) {
|
|
@@ -261,7 +262,7 @@ MIT
|
|
|
261
262
|
console.log();
|
|
262
263
|
console.log(pc.bold(" Next steps:"));
|
|
263
264
|
console.log(` ${pc.dim("1.")} cd ${dir}`);
|
|
264
|
-
console.log(` ${pc.dim("2.")} Edit ${pc.cyan("style.
|
|
265
|
+
console.log(` ${pc.dim("2.")} Edit ${pc.cyan("style.rics")} with your theme styles`);
|
|
265
266
|
console.log(
|
|
266
267
|
` ${pc.dim("3.")} Add a preview screenshot to ${pc.cyan("images/preview.png")}`
|
|
267
268
|
);
|
|
@@ -277,9 +278,15 @@ MIT
|
|
|
277
278
|
console.log(
|
|
278
279
|
` ${pc.dim(`${stepNum}.`)} Push to GitHub and submit to the theme store`
|
|
279
280
|
);
|
|
280
|
-
console.log(
|
|
281
|
-
|
|
282
|
-
);
|
|
281
|
+
console.log();
|
|
282
|
+
console.log(pc.bold(" Resources:"));
|
|
283
|
+
console.log(` ${pc.cyan("RICS")} is a lightweight CSS preprocessor with full CSS parity.`);
|
|
284
|
+
console.log(` It adds variables, nesting, and mixins - but plain CSS works too!`);
|
|
285
|
+
console.log();
|
|
286
|
+
console.log(` ${pc.dim("Playground:")} https://rics.boidu.dev`);
|
|
287
|
+
console.log(` ${pc.dim("RICS Docs:")} https://github.com/better-lyrics/rics`);
|
|
288
|
+
console.log(` ${pc.dim("Styling Guide:")} https://github.com/better-lyrics/better-lyrics/blob/master/STYLING.md`);
|
|
289
|
+
console.log(` ${pc.dim("Submit Theme:")} https://github.com/better-lyrics/themes`);
|
|
283
290
|
console.log();
|
|
284
291
|
console.log(
|
|
285
292
|
pc.dim(" Validate your theme with: ") + pc.cyan(`npx create-bl-theme@latest validate ${dir}`)
|
|
@@ -411,12 +418,41 @@ async function validate(dir) {
|
|
|
411
418
|
}
|
|
412
419
|
}
|
|
413
420
|
|
|
414
|
-
// Check style.css
|
|
415
|
-
const
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
421
|
+
// Check for style.rics or style.css (prefer .rics)
|
|
422
|
+
const ricsPath = path.join(fullPath, "style.rics");
|
|
423
|
+
const cssPath = path.join(fullPath, "style.css");
|
|
424
|
+
const hasRics = fs.existsSync(ricsPath);
|
|
425
|
+
const hasCss = fs.existsSync(cssPath);
|
|
426
|
+
|
|
427
|
+
if (!hasRics && !hasCss) {
|
|
428
|
+
errors.push("Missing required file: style.rics or style.css");
|
|
429
|
+
} else if (hasRics) {
|
|
430
|
+
const ricsSource = fs.readFileSync(ricsPath, "utf-8");
|
|
431
|
+
if (ricsSource.trim().length === 0) {
|
|
432
|
+
warnings.push("style.rics is empty");
|
|
433
|
+
} else {
|
|
434
|
+
// Validate RICS syntax
|
|
435
|
+
try {
|
|
436
|
+
const result = compileWithDetails(ricsSource);
|
|
437
|
+
if (result.errors && result.errors.length > 0) {
|
|
438
|
+
for (const err of result.errors) {
|
|
439
|
+
const location = err.start
|
|
440
|
+
? ` (line ${err.start.line}, column ${err.start.column})`
|
|
441
|
+
: "";
|
|
442
|
+
errors.push(`style.rics: ${err.message}${location}`);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
if (result.warnings && result.warnings.length > 0) {
|
|
446
|
+
for (const warn of result.warnings) {
|
|
447
|
+
warnings.push(`style.rics: ${warn.message || warn}`);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
} catch (e) {
|
|
451
|
+
errors.push(`style.rics: Failed to compile - ${e.message}`);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
} else if (hasCss) {
|
|
455
|
+
const css = fs.readFileSync(cssPath, "utf-8");
|
|
420
456
|
if (css.trim().length === 0) {
|
|
421
457
|
warnings.push("style.css is empty");
|
|
422
458
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-bl-theme",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "CLI tool to scaffold Better Lyrics themes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"image-size": "^2.0.2",
|
|
22
22
|
"picocolors": "^1.1.1",
|
|
23
|
-
"prompts": "^2.4.2"
|
|
23
|
+
"prompts": "^2.4.2",
|
|
24
|
+
"rics": "^0.3.7"
|
|
24
25
|
}
|
|
25
26
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Better Lyrics Theme
|
|
3
|
+
*
|
|
4
|
+
* This file uses RICS - a lightweight CSS preprocessor with full CSS parity.
|
|
5
|
+
* RICS adds variables, nesting, and mixins while staying close to standard CSS.
|
|
6
|
+
* Any valid CSS is also valid RICS, so you can write plain CSS if you prefer.
|
|
7
|
+
*
|
|
8
|
+
* RICS Playground: https://rics.boidu.dev
|
|
9
|
+
* RICS Docs: https://github.com/better-lyrics/rics
|
|
10
|
+
* Styling Guide: https://github.com/better-lyrics/better-lyrics/blob/master/STYLING.md
|
|
11
|
+
*/
|