autoforce 0.1.16 → 0.1.17
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/.autoforce.json +1 -1
- package/CHANGELOG.md +11 -0
- package/commands/modelA/tasks/start.json +3 -3
- package/lib/helpers/github-graphql.d.ts +1 -0
- package/lib/helpers/github-graphql.js +6 -3
- package/lib/helpers/github-project-graphql.d.ts +2 -1
- package/lib/helpers/github-project-graphql.js +18 -2
- package/lib/helpers/taskFunctions.js +2 -2
- package/lib/helpers/util.js +1 -1
- package/package.json +1 -1
package/.autoforce.json
CHANGED
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
# Versiones
|
2
2
|
|
3
|
+
## Version 0.1.16
|
4
|
+
- Fecha:
|
5
|
+
- Paquete: [Descargar](https://www.npmjs.com/package/autoforce/v/0.1.16)
|
6
|
+
- Cambios:
|
7
|
+
* [new] new milestone
|
8
|
+
- https://github.com/sebastianclaros/autoforce/issues/34
|
9
|
+
* Pincha en subdirectorios buscando el package.json
|
10
|
+
- https://github.com/sebastianclaros/autoforce/issues/39
|
11
|
+
* Comando new Label
|
12
|
+
- https://github.com/sebastianclaros/autoforce/issues/43
|
13
|
+
|
3
14
|
## Version 0.1.15
|
4
15
|
- Fecha: 9 Dic 2024
|
5
16
|
- Paquete: [Descargar](https://www.npmjs.com/package/autoforce/v/0.1.15)
|
@@ -7,9 +7,9 @@
|
|
7
7
|
{
|
8
8
|
"name": "validate issue",
|
9
9
|
"function": "validateIssue",
|
10
|
-
"arguments": ["${newIssueNumber}", "
|
11
|
-
"description": "Valida que Issue este en la Columna
|
12
|
-
"errorMessage": "Por favor verifique que el issue ${newIssueNumber} este en la columna
|
10
|
+
"arguments": ["${newIssueNumber}", "Todo"],
|
11
|
+
"description": "Valida que Issue este en la Columna Todo",
|
12
|
+
"errorMessage": "Por favor verifique que el issue ${newIssueNumber} este en la columna Todo"
|
13
13
|
},
|
14
14
|
{
|
15
15
|
"name": "check Issue type based on Labels",
|
@@ -14,6 +14,7 @@ export declare class GitHubApi implements IGitApi {
|
|
14
14
|
};
|
15
15
|
_repository: IRepository | undefined;
|
16
16
|
_labels: ILabel[] | undefined;
|
17
|
+
_milestones: IMilestone[] | undefined;
|
17
18
|
_defaultColors: Record<string, string>;
|
18
19
|
getRepository(): Promise<IRepository>;
|
19
20
|
constructor(token: string, owner: string, repo: string, projectNumber?: number);
|
@@ -125,7 +125,8 @@ export class GitHubApi {
|
|
125
125
|
}
|
126
126
|
getMilestones() {
|
127
127
|
return __awaiter(this, void 0, void 0, function* () {
|
128
|
-
|
128
|
+
if (this._milestones === undefined) {
|
129
|
+
const query = `
|
129
130
|
query getRepo($owner:String!, $repo: String! ) {
|
130
131
|
repository(owner: $owner, name: $repo) {
|
131
132
|
milestones(last: 10, states: OPEN, orderBy: { field: CREATED_AT, direction: DESC} ) {
|
@@ -139,8 +140,10 @@ export class GitHubApi {
|
|
139
140
|
}
|
140
141
|
}
|
141
142
|
`;
|
142
|
-
|
143
|
-
|
143
|
+
const { repository } = yield this.graphqlAuth(query, this.repoVar);
|
144
|
+
this._milestones = repository.milestones.nodes;
|
145
|
+
}
|
146
|
+
return this._milestones;
|
144
147
|
});
|
145
148
|
}
|
146
149
|
getRepositoryObject() {
|
@@ -3,8 +3,9 @@ export declare class GitHubProjectApi extends GitHubApi implements IProjectApi {
|
|
3
3
|
projectNumber: number;
|
4
4
|
constructor(token: string, owner: string, repo: string, projectNumber: number);
|
5
5
|
getColumnValueMap(): Promise<Record<string, string>>;
|
6
|
+
findMilestoneByName(title: string | undefined): Promise<IMilestone | undefined>;
|
6
7
|
findLabelByName(name: string | undefined): Promise<ILabel | undefined>;
|
7
|
-
createIssue(title: string, state?: string, label?: string, body?: string,
|
8
|
+
createIssue(title: string, state?: string, label?: string, body?: string, milestone?: string): Promise<IIssueObject>;
|
8
9
|
getIssueState(issueNumber: string): Promise<string>;
|
9
10
|
getIssueName(title: string): string;
|
10
11
|
_getIssue(issueNumber: string): Promise<{
|
@@ -42,6 +42,21 @@ export class GitHubProjectApi extends GitHubApi {
|
|
42
42
|
return mapValues;
|
43
43
|
});
|
44
44
|
}
|
45
|
+
findMilestoneByName(title) {
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
47
|
+
if (title) {
|
48
|
+
const milestones = yield this.getMilestones();
|
49
|
+
if (milestones.length > 0) {
|
50
|
+
for (const milestone of milestones) {
|
51
|
+
if (milestone.title === title) {
|
52
|
+
return milestone;
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
return;
|
58
|
+
});
|
59
|
+
}
|
45
60
|
findLabelByName(name) {
|
46
61
|
return __awaiter(this, void 0, void 0, function* () {
|
47
62
|
if (name) {
|
@@ -57,13 +72,14 @@ export class GitHubProjectApi extends GitHubApi {
|
|
57
72
|
return;
|
58
73
|
});
|
59
74
|
}
|
60
|
-
createIssue(title, state, label, body,
|
75
|
+
createIssue(title, state, label, body, milestone) {
|
61
76
|
return __awaiter(this, void 0, void 0, function* () {
|
62
|
-
var _a;
|
77
|
+
var _a, _b;
|
63
78
|
const user = yield this.getUser();
|
64
79
|
const repository = yield this.getRepository();
|
65
80
|
const repositoryId = repository.id;
|
66
81
|
const labelId = (label === null || label === void 0 ? void 0 : label.startsWith('LA_')) ? label : (_a = (yield this.findLabelByName(label))) === null || _a === void 0 ? void 0 : _a.id;
|
82
|
+
const milestoneId = (milestone === null || milestone === void 0 ? void 0 : milestone.startsWith('MI_')) ? milestone : (_b = (yield this.findMilestoneByName(milestone))) === null || _b === void 0 ? void 0 : _b.id;
|
67
83
|
const projectId = repository.projectV2.id;
|
68
84
|
const variables = { labelId, body, assignId: user.id, projectId, repositoryId, title, milestoneId: milestoneId ? milestoneId : null };
|
69
85
|
const mutationIssue = `
|
@@ -406,7 +406,7 @@ export const taskFunctions = {
|
|
406
406
|
},
|
407
407
|
validaNoseaBranchActual(newBranchName) {
|
408
408
|
return __awaiter(this, void 0, void 0, function* () {
|
409
|
-
return
|
409
|
+
return getBranchName() !== newBranchName;
|
410
410
|
});
|
411
411
|
},
|
412
412
|
checkCommitPending() {
|
@@ -427,7 +427,7 @@ export const taskFunctions = {
|
|
427
427
|
try {
|
428
428
|
const newBranchName = context.newBranchName;
|
429
429
|
executeShell(`git checkout -b ${newBranchName} origin/main`);
|
430
|
-
context.set('branchName',
|
430
|
+
context.set('branchName', getBranchName());
|
431
431
|
return true;
|
432
432
|
}
|
433
433
|
catch (error) {
|
package/lib/helpers/util.js
CHANGED
@@ -13,7 +13,7 @@ import prompts from "prompts";
|
|
13
13
|
import context, { ProjectServices, GitServices } from "./context.js";
|
14
14
|
import { logInfo, logWarning } from "./color.js";
|
15
15
|
const COMMAND_FOLDER = searchInFolderHierarchy('commands', fileURLToPath(import.meta.url));
|
16
|
-
export const CONFIG_FILE =
|
16
|
+
export const CONFIG_FILE = searchInFolderHierarchy('.autoforce.json', fileURLToPath(import.meta.url));
|
17
17
|
export const TEMPLATES_FOLDER = searchInFolderHierarchy('templates', fileURLToPath(import.meta.url));
|
18
18
|
export const TEMPLATE_MODEL_FOLDER = TEMPLATES_FOLDER + '/' + getConfig('modelTemplates', 'modelA');
|
19
19
|
export const DICTIONARY_FOLDER = TEMPLATE_MODEL_FOLDER + "/diccionarios";
|