@airscript/ghitgud 1.0.0 → 1.0.1
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/CHANGELOG.md +13 -0
- package/CITATION.cff +2 -2
- package/README.md +7 -9
- package/VERSION +1 -1
- package/app/ghitgud.ts +1 -1
- package/app/library.ts +6 -7
- package/dist/app/ghitgud.js +0 -0
- package/dist/app/library.js +6 -7
- package/dist/tests/library.test.js +0 -3
- package/package.json +1 -1
- package/tests/library.test.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,3 +2,16 @@
|
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
|
3
3
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) with some edits,
|
|
4
4
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
5
|
+
|
|
6
|
+
# 1.0.1
|
|
7
|
+
|
|
8
|
+
## What's Changed
|
|
9
|
+
|
|
10
|
+
- refactor: change the base metadata folder
|
|
11
|
+
|
|
12
|
+
# 1.0.0
|
|
13
|
+
|
|
14
|
+
## What's Changed
|
|
15
|
+
|
|
16
|
+
- feat: add base cli with labels, ping and config commands;
|
|
17
|
+
- feat: add github label templates;
|
package/CITATION.cff
CHANGED
package/README.md
CHANGED
|
@@ -4,6 +4,7 @@ A simple CLI to give superpowers to GitHub.
|
|
|
4
4
|
## Table of Contents
|
|
5
5
|
- [Installation](#installation)
|
|
6
6
|
- [Usage](#usage)
|
|
7
|
+
- [Wiki](#wiki)
|
|
7
8
|
- [Contributing](#contributing)
|
|
8
9
|
- [Support](#support)
|
|
9
10
|
- [License](#license)
|
|
@@ -13,18 +14,11 @@ Follow the steps below to make use of Ghitgud.
|
|
|
13
14
|
|
|
14
15
|
Clone this repository:
|
|
15
16
|
```bash
|
|
16
|
-
|
|
17
|
+
npm install -g @airscript/ghitgud
|
|
17
18
|
```
|
|
18
19
|
|
|
19
20
|
## Usage
|
|
20
|
-
After
|
|
21
|
-
```bash
|
|
22
|
-
pnpm install
|
|
23
|
-
pnpm run build
|
|
24
|
-
pnpm link
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Then you'll be able to access the CLI and its relative help command:
|
|
21
|
+
After installing you'll be able to access the CLI and its relative help command:
|
|
28
22
|
```bash
|
|
29
23
|
ghitgud help
|
|
30
24
|
```
|
|
@@ -34,6 +28,10 @@ Remember that to use the CLI you have to set a token and a repo with the format
|
|
|
34
28
|
ghitgud config set token `your-token-here`
|
|
35
29
|
ghitgud config set repo `username/repository`
|
|
36
30
|
```
|
|
31
|
+
> You can create your token with: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens
|
|
32
|
+
|
|
33
|
+
## Wiki
|
|
34
|
+
For more in-depth help with the usage of this CLI, just check the wiki: https://github.com/airscripts/ghitgud/wiki
|
|
37
35
|
|
|
38
36
|
## Contributing
|
|
39
37
|
Contributions and suggestions about how to improve this project are welcome!
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0.
|
|
1
|
+
1.0.1
|
package/app/ghitgud.ts
CHANGED
package/app/library.ts
CHANGED
|
@@ -8,7 +8,6 @@ import functions from "./functions";
|
|
|
8
8
|
|
|
9
9
|
const ENCODING = "utf8";
|
|
10
10
|
const PING_RESPONSE = "pong";
|
|
11
|
-
const METADATA_FOLDER = "metadata";
|
|
12
11
|
const METADATA_FILE = "labels.json";
|
|
13
12
|
const ERROR_NO_METADATA = "No metadata file found.";
|
|
14
13
|
|
|
@@ -48,14 +47,14 @@ const labels = {
|
|
|
48
47
|
}));
|
|
49
48
|
|
|
50
49
|
try {
|
|
51
|
-
fs.mkdirSync(
|
|
50
|
+
fs.mkdirSync(GHITGUD_FOLDER, { recursive: true });
|
|
52
51
|
} catch (error) {
|
|
53
52
|
throw new Error(error instanceof Error ? error.message : String(error));
|
|
54
53
|
}
|
|
55
54
|
|
|
56
55
|
try {
|
|
57
56
|
fs.writeFileSync(
|
|
58
|
-
`${
|
|
57
|
+
`${GHITGUD_FOLDER}/${METADATA_FILE}`,
|
|
59
58
|
JSON.stringify(labels, null, 2)
|
|
60
59
|
);
|
|
61
60
|
} catch (error) {
|
|
@@ -68,11 +67,11 @@ const labels = {
|
|
|
68
67
|
},
|
|
69
68
|
|
|
70
69
|
push: async () => {
|
|
71
|
-
if (!fs.existsSync(`${
|
|
70
|
+
if (!fs.existsSync(`${GHITGUD_FOLDER}/${METADATA_FILE}`))
|
|
72
71
|
throw new Error(ERROR_NO_METADATA);
|
|
73
72
|
|
|
74
73
|
const data = fs.readFileSync(
|
|
75
|
-
`${
|
|
74
|
+
`${GHITGUD_FOLDER}/${METADATA_FILE}`,
|
|
76
75
|
ENCODING
|
|
77
76
|
);
|
|
78
77
|
|
|
@@ -94,11 +93,11 @@ const labels = {
|
|
|
94
93
|
},
|
|
95
94
|
|
|
96
95
|
prune: async () => {
|
|
97
|
-
if (!fs.existsSync(`${
|
|
96
|
+
if (!fs.existsSync(`${GHITGUD_FOLDER}/${METADATA_FILE}`))
|
|
98
97
|
throw new Error(ERROR_NO_METADATA);
|
|
99
98
|
|
|
100
99
|
const data = fs.readFileSync(
|
|
101
|
-
`${
|
|
100
|
+
`${GHITGUD_FOLDER}/${METADATA_FILE}`,
|
|
102
101
|
ENCODING
|
|
103
102
|
);
|
|
104
103
|
|
package/dist/app/ghitgud.js
CHANGED
|
File without changes
|
package/dist/app/library.js
CHANGED
|
@@ -19,7 +19,6 @@ const api_1 = __importDefault(require("./api"));
|
|
|
19
19
|
const functions_1 = __importDefault(require("./functions"));
|
|
20
20
|
const ENCODING = "utf8";
|
|
21
21
|
const PING_RESPONSE = "pong";
|
|
22
|
-
const METADATA_FOLDER = "metadata";
|
|
23
22
|
const METADATA_FILE = "labels.json";
|
|
24
23
|
const ERROR_NO_METADATA = "No metadata file found.";
|
|
25
24
|
const CREDENTIALS_FILE = "credentials.json";
|
|
@@ -51,13 +50,13 @@ const labels = {
|
|
|
51
50
|
description: label.description,
|
|
52
51
|
}));
|
|
53
52
|
try {
|
|
54
|
-
fs_1.default.mkdirSync(
|
|
53
|
+
fs_1.default.mkdirSync(GHITGUD_FOLDER, { recursive: true });
|
|
55
54
|
}
|
|
56
55
|
catch (error) {
|
|
57
56
|
throw new Error(error instanceof Error ? error.message : String(error));
|
|
58
57
|
}
|
|
59
58
|
try {
|
|
60
|
-
fs_1.default.writeFileSync(`${
|
|
59
|
+
fs_1.default.writeFileSync(`${GHITGUD_FOLDER}/${METADATA_FILE}`, JSON.stringify(labels, null, 2));
|
|
61
60
|
}
|
|
62
61
|
catch (error) {
|
|
63
62
|
throw new Error(error instanceof Error ? error.message : String(error));
|
|
@@ -67,9 +66,9 @@ const labels = {
|
|
|
67
66
|
return result;
|
|
68
67
|
}),
|
|
69
68
|
push: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
70
|
-
if (!fs_1.default.existsSync(`${
|
|
69
|
+
if (!fs_1.default.existsSync(`${GHITGUD_FOLDER}/${METADATA_FILE}`))
|
|
71
70
|
throw new Error(ERROR_NO_METADATA);
|
|
72
|
-
const data = fs_1.default.readFileSync(`${
|
|
71
|
+
const data = fs_1.default.readFileSync(`${GHITGUD_FOLDER}/${METADATA_FILE}`, ENCODING);
|
|
73
72
|
const labels = JSON.parse(data);
|
|
74
73
|
yield Promise.all(labels.map((label) => __awaiter(void 0, void 0, void 0, function* () {
|
|
75
74
|
const response = yield api_1.default.labels.get(label.name);
|
|
@@ -83,9 +82,9 @@ const labels = {
|
|
|
83
82
|
return result;
|
|
84
83
|
}),
|
|
85
84
|
prune: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
86
|
-
if (!fs_1.default.existsSync(`${
|
|
85
|
+
if (!fs_1.default.existsSync(`${GHITGUD_FOLDER}/${METADATA_FILE}`))
|
|
87
86
|
throw new Error(ERROR_NO_METADATA);
|
|
88
|
-
const data = fs_1.default.readFileSync(`${
|
|
87
|
+
const data = fs_1.default.readFileSync(`${GHITGUD_FOLDER}/${METADATA_FILE}`, ENCODING);
|
|
89
88
|
const labels = JSON.parse(data);
|
|
90
89
|
labels.map((label) => __awaiter(void 0, void 0, void 0, function* () { return yield api_1.default.labels.delete(label.name); }));
|
|
91
90
|
const result = { success: true };
|
|
@@ -12,7 +12,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const fs_1 = __importDefault(require("fs"));
|
|
16
15
|
const vitest_1 = require("vitest");
|
|
17
16
|
const api_1 = __importDefault(require("../app/api"));
|
|
18
17
|
const library_1 = __importDefault(require("../app/library"));
|
|
@@ -58,11 +57,9 @@ const METADATA_LABELS = [
|
|
|
58
57
|
(0, vitest_1.expect)(result).toEqual({ success: true, metadata: METADATA_LABELS });
|
|
59
58
|
}));
|
|
60
59
|
(0, vitest_1.it)("should pull labels", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
61
|
-
const spy = vitest_1.vi.spyOn(fs_1.default, "writeFileSync").mockImplementation(() => { });
|
|
62
60
|
const mockResponse = { json: () => Promise.resolve(API_LABELS) };
|
|
63
61
|
api_1.default.labels.fetch.mockResolvedValue(mockResponse);
|
|
64
62
|
const result = yield library_1.default.labels.pull();
|
|
65
|
-
(0, vitest_1.expect)(spy).toHaveBeenCalledWith("metadata/labels.json", JSON.stringify(METADATA_LABELS, null, 2));
|
|
66
63
|
(0, vitest_1.expect)(result).toEqual({ success: true });
|
|
67
64
|
}));
|
|
68
65
|
(0, vitest_1.it)("should push labels", () => __awaiter(void 0, void 0, void 0, function* () {
|
package/package.json
CHANGED
package/tests/library.test.ts
CHANGED