create-bl-theme 1.0.6 → 1.0.8
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/.claude/settings.local.json +10 -0
- package/README.md +42 -0
- package/bin/cli.js +123 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -45,9 +45,41 @@ The validator checks:
|
|
|
45
45
|
- Required files (metadata.json, style.rics or style.css, images/)
|
|
46
46
|
- RICS syntax validation (for .rics files)
|
|
47
47
|
- Valid JSON structure and required fields
|
|
48
|
+
- Semver version format
|
|
48
49
|
- Image integrity (detects corrupted files)
|
|
49
50
|
- Image dimensions (recommends 1280x720, but other sizes work fine)
|
|
50
51
|
|
|
52
|
+
### Bump version
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Bump patch version (1.0.0 → 1.0.1)
|
|
56
|
+
create-bl-theme bump patch
|
|
57
|
+
|
|
58
|
+
# Bump minor version (1.0.0 → 1.1.0)
|
|
59
|
+
create-bl-theme bump minor
|
|
60
|
+
|
|
61
|
+
# Bump major version (1.0.0 → 2.0.0)
|
|
62
|
+
create-bl-theme bump major
|
|
63
|
+
|
|
64
|
+
# Bump in a specific directory
|
|
65
|
+
create-bl-theme bump patch ./my-theme
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Check publishing status
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# Check if theme is registered and ready to publish
|
|
72
|
+
create-bl-theme publish
|
|
73
|
+
|
|
74
|
+
# Check a specific directory
|
|
75
|
+
create-bl-theme publish ./my-theme
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
The publish command:
|
|
79
|
+
- Checks if your theme is registered in the theme store
|
|
80
|
+
- Shows your current version vs. the registry version
|
|
81
|
+
- Provides setup instructions for auto-publishing
|
|
82
|
+
|
|
51
83
|
## Generated Structure
|
|
52
84
|
|
|
53
85
|
```
|
|
@@ -130,6 +162,16 @@ Better Lyrics supports **GitHub Flavored Markdown (GFM)** in DESCRIPTION.md, so
|
|
|
130
162
|
```
|
|
131
163
|
4. Open a pull request
|
|
132
164
|
|
|
165
|
+
### Auto-Publishing
|
|
166
|
+
|
|
167
|
+
After your theme is registered, install the [Better Lyrics Themes](https://github.com/marketplace/better-lyrics-themes) GitHub App on your repo. This enables automatic updates:
|
|
168
|
+
|
|
169
|
+
1. Bump your version: `create-bl-theme bump patch`
|
|
170
|
+
2. Commit and push
|
|
171
|
+
3. The registry automatically validates and publishes your update
|
|
172
|
+
|
|
173
|
+
Use `create-bl-theme publish` to check your publishing status.
|
|
174
|
+
|
|
133
175
|
## License
|
|
134
176
|
|
|
135
177
|
MIT
|
package/bin/cli.js
CHANGED
|
@@ -22,12 +22,28 @@ const RECOMMENDED_HEIGHT = 720;
|
|
|
22
22
|
// GitHub URL patterns
|
|
23
23
|
const GITHUB_URL_PATTERN = /^(?:https?:\/\/)?(?:www\.)?github\.com\/([^\/]+)\/([^\/]+)(?:\/)?(?:\.git)?$/;
|
|
24
24
|
|
|
25
|
+
// Load package.json for version
|
|
26
|
+
const pkg = JSON.parse(
|
|
27
|
+
fs.readFileSync(path.join(__dirname, "..", "package.json"), "utf-8")
|
|
28
|
+
);
|
|
29
|
+
|
|
25
30
|
async function main() {
|
|
26
31
|
const args = process.argv.slice(2);
|
|
27
32
|
const command = args[0];
|
|
28
33
|
|
|
34
|
+
// Handle flags first (no banner)
|
|
35
|
+
if (command === "--version" || command === "-v" || command === "version") {
|
|
36
|
+
console.log(pkg.version);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (command === "--help" || command === "-h" || command === "help") {
|
|
41
|
+
showHelp();
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
29
45
|
console.log();
|
|
30
|
-
console.log(pc.bold(pc.cyan(" Better Lyrics Theme Creator")));
|
|
46
|
+
console.log(pc.bold(pc.cyan(" Better Lyrics Theme Creator")) + pc.dim(` v${pkg.version}`));
|
|
31
47
|
console.log(pc.dim(" Create themes for Better Lyrics extension"));
|
|
32
48
|
console.log();
|
|
33
49
|
|
|
@@ -41,8 +57,8 @@ async function main() {
|
|
|
41
57
|
return;
|
|
42
58
|
}
|
|
43
59
|
|
|
44
|
-
if (command === "
|
|
45
|
-
|
|
60
|
+
if (command === "bump") {
|
|
61
|
+
await bump(args[1], args[2]);
|
|
46
62
|
return;
|
|
47
63
|
}
|
|
48
64
|
|
|
@@ -50,16 +66,27 @@ async function main() {
|
|
|
50
66
|
}
|
|
51
67
|
|
|
52
68
|
function showHelp() {
|
|
53
|
-
console.log(
|
|
69
|
+
console.log(`
|
|
70
|
+
${pc.bold(pc.cyan("create-bl-theme"))} ${pc.dim(`v${pkg.version}`)}
|
|
71
|
+
CLI for Better Lyrics themes
|
|
72
|
+
|
|
73
|
+
${pc.bold("Usage:")}
|
|
54
74
|
${pc.cyan("create-bl-theme")} [name] Create a new theme
|
|
55
75
|
${pc.cyan("create-bl-theme")} validate [dir|url] Validate a theme (local or GitHub)
|
|
56
76
|
${pc.cyan("create-bl-theme")} publish [dir] Check publishing status
|
|
77
|
+
${pc.cyan("create-bl-theme")} bump [type] [dir] Bump version (patch, minor, major)
|
|
78
|
+
|
|
79
|
+
${pc.bold("Options:")}
|
|
80
|
+
${pc.cyan("-v, --version")} Show version number
|
|
81
|
+
${pc.cyan("-h, --help")} Show this help message
|
|
57
82
|
|
|
58
83
|
${pc.bold("Examples:")}
|
|
59
84
|
${pc.dim("$")} create-bl-theme my-awesome-theme
|
|
60
85
|
${pc.dim("$")} create-bl-theme validate ./my-theme
|
|
61
86
|
${pc.dim("$")} create-bl-theme validate https://github.com/user/theme-repo
|
|
62
87
|
${pc.dim("$")} create-bl-theme publish
|
|
88
|
+
${pc.dim("$")} create-bl-theme bump patch
|
|
89
|
+
${pc.dim("$")} create-bl-theme bump minor ./my-theme
|
|
63
90
|
|
|
64
91
|
${pc.bold("Theme Structure:")}
|
|
65
92
|
my-theme/
|
|
@@ -762,11 +789,16 @@ function getGitRemote(themePath) {
|
|
|
762
789
|
async function checkThemeRegistered(repo) {
|
|
763
790
|
try {
|
|
764
791
|
const response = await fetch(
|
|
765
|
-
"https://raw.githubusercontent.com/better-lyrics/themes/
|
|
792
|
+
"https://raw.githubusercontent.com/better-lyrics/themes/master/index.json"
|
|
766
793
|
);
|
|
794
|
+
if (!response.ok) {
|
|
795
|
+
console.log(pc.dim(` (Could not fetch registry: ${response.status})`));
|
|
796
|
+
return false;
|
|
797
|
+
}
|
|
767
798
|
const index = await response.json();
|
|
768
799
|
return index.themes?.some((t) => t.repo === repo) ?? false;
|
|
769
|
-
} catch {
|
|
800
|
+
} catch (e) {
|
|
801
|
+
console.log(pc.dim(` (Could not fetch registry: ${e.message})`));
|
|
770
802
|
return false;
|
|
771
803
|
}
|
|
772
804
|
}
|
|
@@ -774,7 +806,7 @@ async function checkThemeRegistered(repo) {
|
|
|
774
806
|
async function checkLockStatus(repo) {
|
|
775
807
|
try {
|
|
776
808
|
const response = await fetch(
|
|
777
|
-
"https://raw.githubusercontent.com/better-lyrics/themes/
|
|
809
|
+
"https://raw.githubusercontent.com/better-lyrics/themes/master/index.lock.json"
|
|
778
810
|
);
|
|
779
811
|
const lock = await response.json();
|
|
780
812
|
return lock.themes?.find((t) => t.repo === repo) ?? null;
|
|
@@ -783,6 +815,90 @@ async function checkLockStatus(repo) {
|
|
|
783
815
|
}
|
|
784
816
|
}
|
|
785
817
|
|
|
818
|
+
async function bump(typeOrDir, dirArg) {
|
|
819
|
+
// Handle flexible argument order: bump [type] [dir] or bump [dir]
|
|
820
|
+
let type = "patch";
|
|
821
|
+
let dir = ".";
|
|
822
|
+
|
|
823
|
+
const validTypes = ["patch", "minor", "major"];
|
|
824
|
+
|
|
825
|
+
if (typeOrDir) {
|
|
826
|
+
if (validTypes.includes(typeOrDir)) {
|
|
827
|
+
type = typeOrDir;
|
|
828
|
+
dir = dirArg || ".";
|
|
829
|
+
} else {
|
|
830
|
+
// Assume it's a directory
|
|
831
|
+
dir = typeOrDir;
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
const fullPath = path.resolve(process.cwd(), dir);
|
|
836
|
+
const metadataPath = path.join(fullPath, "metadata.json");
|
|
837
|
+
|
|
838
|
+
// Check metadata.json exists
|
|
839
|
+
if (!fs.existsSync(metadataPath)) {
|
|
840
|
+
console.log(pc.red("Error: metadata.json not found."));
|
|
841
|
+
process.exit(1);
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
let metadata;
|
|
845
|
+
try {
|
|
846
|
+
metadata = JSON.parse(fs.readFileSync(metadataPath, "utf-8"));
|
|
847
|
+
} catch (e) {
|
|
848
|
+
console.log(pc.red(`Error: Invalid metadata.json - ${e.message}`));
|
|
849
|
+
process.exit(1);
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
const currentVersion = metadata.version;
|
|
853
|
+
if (!currentVersion) {
|
|
854
|
+
console.log(pc.red("Error: No version field in metadata.json"));
|
|
855
|
+
process.exit(1);
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
// Parse current version
|
|
859
|
+
const match = currentVersion.match(/^(\d+)\.(\d+)\.(\d+)(.*)$/);
|
|
860
|
+
if (!match) {
|
|
861
|
+
console.log(pc.red(`Error: Invalid version format "${currentVersion}"`));
|
|
862
|
+
process.exit(1);
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
let [, major, minor, patch, prerelease] = match;
|
|
866
|
+
major = parseInt(major, 10);
|
|
867
|
+
minor = parseInt(minor, 10);
|
|
868
|
+
patch = parseInt(patch, 10);
|
|
869
|
+
|
|
870
|
+
// Bump version
|
|
871
|
+
switch (type) {
|
|
872
|
+
case "major":
|
|
873
|
+
major++;
|
|
874
|
+
minor = 0;
|
|
875
|
+
patch = 0;
|
|
876
|
+
prerelease = "";
|
|
877
|
+
break;
|
|
878
|
+
case "minor":
|
|
879
|
+
minor++;
|
|
880
|
+
patch = 0;
|
|
881
|
+
prerelease = "";
|
|
882
|
+
break;
|
|
883
|
+
case "patch":
|
|
884
|
+
default:
|
|
885
|
+
patch++;
|
|
886
|
+
prerelease = "";
|
|
887
|
+
break;
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
const newVersion = `${major}.${minor}.${patch}`;
|
|
891
|
+
metadata.version = newVersion;
|
|
892
|
+
|
|
893
|
+
// Write back
|
|
894
|
+
fs.writeFileSync(metadataPath, JSON.stringify(metadata, null, 2) + "\n");
|
|
895
|
+
|
|
896
|
+
console.log(pc.green(` ${currentVersion} → ${newVersion}`));
|
|
897
|
+
console.log();
|
|
898
|
+
console.log(pc.dim(` Updated ${metadataPath}`));
|
|
899
|
+
console.log();
|
|
900
|
+
}
|
|
901
|
+
|
|
786
902
|
main().catch((err) => {
|
|
787
903
|
console.error(pc.red(err.message));
|
|
788
904
|
process.exit(1);
|