github-labels-template 0.3.0 โ 0.4.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/README.md +15 -2
- package/dist/index.js +113 -6
- package/package.json +7 -3
package/README.md
CHANGED
|
@@ -16,7 +16,8 @@ A CLI tool to apply a curated set of GitHub labels to any repository using `gh`
|
|
|
16
16
|
- ๐ **Smart Conflict Handling**: Skips existing labels by default, `--force` to update
|
|
17
17
|
- ๐งน **Wipe Command**: Remove all existing labels with a confirmation prompt
|
|
18
18
|
- โ
**Pre-Flight Checks**: Validates `gh` CLI is installed and authenticated before doing anything
|
|
19
|
-
- ๐ **Clear Output**:
|
|
19
|
+
- ๐ **Clear Output**: Structured logging powered by [@wgtechlabs/log-engine](https://github.com/wgtechlabs/log-engine) with color-coded levels and emoji
|
|
20
|
+
- ๐จ **ASCII Banner**: Beautiful ANSI Shadow figlet banner with version and author info
|
|
20
21
|
- ๐ **Dual Runtime**: Works with both `npx` and `bunx`
|
|
21
22
|
|
|
22
23
|
## Quick Start
|
|
@@ -149,7 +150,10 @@ Broad software layers โ universal across any project.
|
|
|
149
150
|
ghlt โ GitHub Labels Template CLI
|
|
150
151
|
|
|
151
152
|
USAGE
|
|
152
|
-
ghlt apply|wipe
|
|
153
|
+
ghlt [OPTIONS] apply|wipe
|
|
154
|
+
|
|
155
|
+
OPTIONS
|
|
156
|
+
-v, --version Show version number
|
|
153
157
|
|
|
154
158
|
COMMANDS
|
|
155
159
|
apply Apply labels from the template to a repository
|
|
@@ -164,6 +168,15 @@ OPTIONS (wipe)
|
|
|
164
168
|
-y, --yes Skip confirmation prompt
|
|
165
169
|
```
|
|
166
170
|
|
|
171
|
+
## Testing
|
|
172
|
+
|
|
173
|
+
This project uses the [Bun test framework](https://bun.sh/docs/cli/test) for testing.
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
# Run all tests
|
|
177
|
+
bun test
|
|
178
|
+
```
|
|
179
|
+
|
|
167
180
|
## Contributing
|
|
168
181
|
|
|
169
182
|
Contributions are welcome! This project follows the [Clean Commit](https://github.com/wgtechlabs/clean-commit) convention.
|
package/dist/index.js
CHANGED
|
@@ -114,18 +114,27 @@ async function deleteLabel(repo, name) {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
// src/utils/logger.ts
|
|
117
|
+
import { LogEngine, LogMode } from "@wgtechlabs/log-engine";
|
|
117
118
|
import pc from "picocolors";
|
|
119
|
+
LogEngine.configure({
|
|
120
|
+
mode: LogMode.INFO,
|
|
121
|
+
format: {
|
|
122
|
+
includeIsoTimestamp: false,
|
|
123
|
+
includeLocalTime: true,
|
|
124
|
+
includeEmoji: true
|
|
125
|
+
}
|
|
126
|
+
});
|
|
118
127
|
function success(msg) {
|
|
119
|
-
|
|
128
|
+
LogEngine.log(msg);
|
|
120
129
|
}
|
|
121
130
|
function error(msg) {
|
|
122
|
-
|
|
131
|
+
LogEngine.error(msg);
|
|
123
132
|
}
|
|
124
133
|
function warn(msg) {
|
|
125
|
-
|
|
134
|
+
LogEngine.warn(msg);
|
|
126
135
|
}
|
|
127
136
|
function info(msg) {
|
|
128
|
-
|
|
137
|
+
LogEngine.info(msg);
|
|
129
138
|
}
|
|
130
139
|
function heading(msg) {
|
|
131
140
|
console.log(`
|
|
@@ -297,7 +306,10 @@ ${pc2.bold(pc2.red(`This will delete all ${existing.length} labels from ${repo}.
|
|
|
297
306
|
process.stdout.write(`${pc2.dim("Continue? [y/N] ")}`);
|
|
298
307
|
const response = await new Promise((resolve) => {
|
|
299
308
|
process.stdin.setEncoding("utf-8");
|
|
300
|
-
process.stdin.once("data", (data) =>
|
|
309
|
+
process.stdin.once("data", (data) => {
|
|
310
|
+
process.stdin.pause();
|
|
311
|
+
resolve(data.toString().trim());
|
|
312
|
+
});
|
|
301
313
|
process.stdin.resume();
|
|
302
314
|
});
|
|
303
315
|
if (response.toLowerCase() !== "y") {
|
|
@@ -321,16 +333,111 @@ ${pc2.bold(pc2.red(`This will delete all ${existing.length} labels from ${repo}.
|
|
|
321
333
|
}
|
|
322
334
|
});
|
|
323
335
|
|
|
336
|
+
// src/ui/banner.ts
|
|
337
|
+
import figlet from "figlet";
|
|
338
|
+
import pc3 from "picocolors";
|
|
339
|
+
// package.json
|
|
340
|
+
var package_default = {
|
|
341
|
+
name: "github-labels-template",
|
|
342
|
+
version: "0.4.0",
|
|
343
|
+
description: "A CLI tool to apply a curated GitHub labels template to any repository using gh CLI.",
|
|
344
|
+
type: "module",
|
|
345
|
+
bin: {
|
|
346
|
+
ghlt: "dist/index.js"
|
|
347
|
+
},
|
|
348
|
+
files: [
|
|
349
|
+
"dist"
|
|
350
|
+
],
|
|
351
|
+
scripts: {
|
|
352
|
+
build: "bun build src/index.ts --outfile dist/index.js --target node --packages external",
|
|
353
|
+
dev: "bun src/index.ts",
|
|
354
|
+
test: "bun test"
|
|
355
|
+
},
|
|
356
|
+
engines: {
|
|
357
|
+
node: ">=18",
|
|
358
|
+
bun: ">=1.0"
|
|
359
|
+
},
|
|
360
|
+
keywords: [
|
|
361
|
+
"github",
|
|
362
|
+
"labels",
|
|
363
|
+
"template",
|
|
364
|
+
"cli",
|
|
365
|
+
"gh"
|
|
366
|
+
],
|
|
367
|
+
author: "Waren Gonzaga",
|
|
368
|
+
license: "MIT",
|
|
369
|
+
repository: {
|
|
370
|
+
type: "git",
|
|
371
|
+
url: "git+https://github.com/warengonzaga/github-labels-template.git"
|
|
372
|
+
},
|
|
373
|
+
dependencies: {
|
|
374
|
+
"@wgtechlabs/log-engine": "^2.3.1",
|
|
375
|
+
citty: "^0.1.6",
|
|
376
|
+
figlet: "^1.10.0",
|
|
377
|
+
picocolors: "^1.1.1"
|
|
378
|
+
},
|
|
379
|
+
devDependencies: {
|
|
380
|
+
"@types/bun": "latest",
|
|
381
|
+
"@types/figlet": "^1.7.0"
|
|
382
|
+
}
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
// src/ui/banner.ts
|
|
386
|
+
var LOGO;
|
|
387
|
+
try {
|
|
388
|
+
LOGO = figlet.textSync("GHLT", { font: "ANSI Shadow" });
|
|
389
|
+
} catch {
|
|
390
|
+
LOGO = ` โโโโโโโ โโโ โโโโโโ โโโโโโโโโ
|
|
391
|
+
` + `โโโโโโโโ โโโ โโโโโโ โโโโโโโโโ
|
|
392
|
+
` + `โโโ โโโโโโโโโโโโโโโ โโโ
|
|
393
|
+
` + `โโโ โโโโโโโโโโโโโโ โโโ
|
|
394
|
+
` + `โโโโโโโโโโโโ โโโโโโโโโโโ โโโ
|
|
395
|
+
` + ` โโโโโโโ โโโ โโโโโโโโโโโ โโโ `;
|
|
396
|
+
}
|
|
397
|
+
function getVersion() {
|
|
398
|
+
return package_default.version ?? "unknown";
|
|
399
|
+
}
|
|
400
|
+
function getAuthor() {
|
|
401
|
+
return package_default.author ?? "unknown";
|
|
402
|
+
}
|
|
403
|
+
function showBanner(minimal = false) {
|
|
404
|
+
console.log(pc3.cyan(`
|
|
405
|
+
` + LOGO));
|
|
406
|
+
console.log(` ${pc3.dim("v" + getVersion())} ${pc3.dim("โ")} ${pc3.dim("Built by " + getAuthor())}`);
|
|
407
|
+
if (!minimal) {
|
|
408
|
+
console.log(` ${pc3.dim(package_default.description)}`);
|
|
409
|
+
console.log();
|
|
410
|
+
console.log(` ${pc3.yellow("Star")} ${pc3.cyan("https://gh.waren.build/github-labels-template")}`);
|
|
411
|
+
console.log(` ${pc3.green("Contribute")} ${pc3.cyan("https://gh.waren.build/github-labels-template/blob/main/CONTRIBUTING.md")}`);
|
|
412
|
+
console.log(` ${pc3.magenta("Sponsor")} ${pc3.cyan("https://warengonzaga.com/sponsor")}`);
|
|
413
|
+
}
|
|
414
|
+
console.log();
|
|
415
|
+
}
|
|
416
|
+
|
|
324
417
|
// src/index.ts
|
|
418
|
+
var isHelp = process.argv.includes("--help") || process.argv.includes("-h");
|
|
419
|
+
showBanner(isHelp);
|
|
325
420
|
var main = defineCommand3({
|
|
326
421
|
meta: {
|
|
327
422
|
name: "ghlt",
|
|
328
|
-
version:
|
|
423
|
+
version: getVersion(),
|
|
329
424
|
description: "GitHub Labels Template โ apply a curated set of labels to any repo using gh CLI."
|
|
330
425
|
},
|
|
426
|
+
args: {
|
|
427
|
+
version: {
|
|
428
|
+
type: "boolean",
|
|
429
|
+
alias: "v",
|
|
430
|
+
description: "Show version number"
|
|
431
|
+
}
|
|
432
|
+
},
|
|
331
433
|
subCommands: {
|
|
332
434
|
apply: apply_default,
|
|
333
435
|
wipe: wipe_default
|
|
436
|
+
},
|
|
437
|
+
run({ args }) {
|
|
438
|
+
if (args.version) {
|
|
439
|
+
console.log(`ghlt v${getVersion()}`);
|
|
440
|
+
}
|
|
334
441
|
}
|
|
335
442
|
});
|
|
336
443
|
runMain(main);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "github-labels-template",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "A CLI tool to apply a curated GitHub labels template to any repository using gh CLI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
13
|
"build": "bun build src/index.ts --outfile dist/index.js --target node --packages external",
|
|
14
|
-
"dev": "bun src/index.ts"
|
|
14
|
+
"dev": "bun src/index.ts",
|
|
15
|
+
"test": "bun test"
|
|
15
16
|
},
|
|
16
17
|
"engines": {
|
|
17
18
|
"node": ">=18",
|
|
@@ -31,10 +32,13 @@
|
|
|
31
32
|
"url": "git+https://github.com/warengonzaga/github-labels-template.git"
|
|
32
33
|
},
|
|
33
34
|
"dependencies": {
|
|
35
|
+
"@wgtechlabs/log-engine": "^2.3.1",
|
|
34
36
|
"citty": "^0.1.6",
|
|
37
|
+
"figlet": "^1.10.0",
|
|
35
38
|
"picocolors": "^1.1.1"
|
|
36
39
|
},
|
|
37
40
|
"devDependencies": {
|
|
38
|
-
"@types/bun": "latest"
|
|
41
|
+
"@types/bun": "latest",
|
|
42
|
+
"@types/figlet": "^1.7.0"
|
|
39
43
|
}
|
|
40
44
|
}
|