create-bl-theme 1.0.9 → 1.0.10
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 -1
- package/bin/cli.js +41 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -164,7 +164,7 @@ Better Lyrics supports **GitHub Flavored Markdown (GFM)** in DESCRIPTION.md, so
|
|
|
164
164
|
|
|
165
165
|
### Auto-Publishing
|
|
166
166
|
|
|
167
|
-
After your theme is registered, install the [Better Lyrics
|
|
167
|
+
After your theme is registered, install the [Better Lyrics Harmonizer](https://github.com/apps/better-lyrics-harmonizer/installations/new) GitHub App on your repo. This enables automatic updates:
|
|
168
168
|
|
|
169
169
|
1. Bump your version: `create-bl-theme bump patch`
|
|
170
170
|
2. Commit and push
|
package/bin/cli.js
CHANGED
|
@@ -170,7 +170,28 @@ ${pc.bold("Documentation:")}
|
|
|
170
170
|
`);
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
+
function isDirectoryEmpty(dirPath) {
|
|
174
|
+
const entries = fs.readdirSync(dirPath);
|
|
175
|
+
return entries.every((entry) => entry.startsWith("."));
|
|
176
|
+
}
|
|
177
|
+
|
|
173
178
|
async function create(targetDir) {
|
|
179
|
+
if (targetDir) {
|
|
180
|
+
const earlyPath = path.resolve(process.cwd(), targetDir);
|
|
181
|
+
if (fs.existsSync(earlyPath) && !isDirectoryEmpty(earlyPath)) {
|
|
182
|
+
const { proceed } = await prompts({
|
|
183
|
+
type: "confirm",
|
|
184
|
+
name: "proceed",
|
|
185
|
+
message: `Directory "${targetDir}" is not empty. Continue anyway? (files may be overwritten)`,
|
|
186
|
+
initial: false,
|
|
187
|
+
});
|
|
188
|
+
if (!proceed) {
|
|
189
|
+
console.log(pc.red("\nCancelled."));
|
|
190
|
+
process.exit(1);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
174
195
|
const questions = [
|
|
175
196
|
{
|
|
176
197
|
type: targetDir ? null : "text",
|
|
@@ -254,9 +275,17 @@ async function create(targetDir) {
|
|
|
254
275
|
const dir = targetDir || response.directory;
|
|
255
276
|
const fullPath = path.resolve(process.cwd(), dir);
|
|
256
277
|
|
|
257
|
-
if (fs.existsSync(fullPath)) {
|
|
258
|
-
|
|
259
|
-
|
|
278
|
+
if (!targetDir && fs.existsSync(fullPath) && !isDirectoryEmpty(fullPath)) {
|
|
279
|
+
const { proceed } = await prompts({
|
|
280
|
+
type: "confirm",
|
|
281
|
+
name: "proceed",
|
|
282
|
+
message: `Directory "${dir}" is not empty. Continue anyway? (files may be overwritten)`,
|
|
283
|
+
initial: false,
|
|
284
|
+
});
|
|
285
|
+
if (!proceed) {
|
|
286
|
+
console.log(pc.red("\nCancelled."));
|
|
287
|
+
process.exit(1);
|
|
288
|
+
}
|
|
260
289
|
}
|
|
261
290
|
|
|
262
291
|
console.log();
|
|
@@ -375,12 +404,17 @@ MIT
|
|
|
375
404
|
console.log(pc.green(" Theme scaffolded successfully!"));
|
|
376
405
|
console.log();
|
|
377
406
|
console.log(pc.bold(" Next steps:"));
|
|
378
|
-
|
|
379
|
-
|
|
407
|
+
let stepNum = 1;
|
|
408
|
+
if (dir !== ".") {
|
|
409
|
+
console.log(` ${pc.dim(`${stepNum}.`)} cd ${dir}`);
|
|
410
|
+
stepNum++;
|
|
411
|
+
}
|
|
412
|
+
console.log(` ${pc.dim(`${stepNum}.`)} Edit ${pc.cyan("style.rics")} with your theme styles`);
|
|
413
|
+
stepNum++;
|
|
380
414
|
console.log(
|
|
381
|
-
` ${pc.dim(
|
|
415
|
+
` ${pc.dim(`${stepNum}.`)} Add a preview screenshot to ${pc.cyan("images/preview.png")}`
|
|
382
416
|
);
|
|
383
|
-
|
|
417
|
+
stepNum++;
|
|
384
418
|
if (response.useDescriptionFile) {
|
|
385
419
|
console.log(` ${pc.dim(`${stepNum}.`)} Edit ${pc.cyan("DESCRIPTION.md")} with your theme description`);
|
|
386
420
|
stepNum++;
|