autoforce 0.1.20 → 0.1.22
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 +9 -0
- package/lib/helpers/github-graphql.d.ts +7 -0
- package/lib/helpers/github-graphql.js +25 -8
- package/lib/helpers/gitlab-graphql.d.ts +6 -0
- package/lib/helpers/gitlab-graphql.js +5 -0
- package/lib/helpers/taskFunctions.js +16 -0
- package/models/dev/npm/tasks/publish.json +2 -1
- package/models/project/github-releases/new/milestone.json +21 -0
- package/package.json +1 -1
package/.autoforce.json
CHANGED
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Versiones
|
2
2
|
|
3
|
+
## Version 0.1.20
|
4
|
+
- Fecha:
|
5
|
+
- Paquete: [Descargar](https://www.npmjs.com/package/autoforce/v/0.1.20)
|
6
|
+
- Cambios:
|
7
|
+
* Test con instalacion de paquete
|
8
|
+
- https://github.com/sebastianclaros/autoforce/issues/49
|
9
|
+
* Que config tome argumentos
|
10
|
+
- https://github.com/sebastianclaros/autoforce/issues/51
|
11
|
+
|
3
12
|
## Version 0.1.18
|
4
13
|
- Fecha:
|
5
14
|
- Paquete: [Descargar](https://www.npmjs.com/package/autoforce/v/0.1.18ra la placa
|
@@ -20,6 +20,13 @@ export declare class GitHubApi implements IGitApi {
|
|
20
20
|
constructor(token: string, owner: string, repo: string, projectNumber?: number);
|
21
21
|
createLabel(name: string, color?: string): Promise<ILabel | undefined>;
|
22
22
|
getRandomColor(): string;
|
23
|
+
updateMilestone(title: string, state?: string, description?: string, dueOn?: string): Promise<{
|
24
|
+
id: any;
|
25
|
+
title: any;
|
26
|
+
description: any;
|
27
|
+
dueOn: any;
|
28
|
+
url: any;
|
29
|
+
}>;
|
23
30
|
createMilestone(title: string, state?: string, description?: string, dueOn?: string): Promise<{
|
24
31
|
id: any;
|
25
32
|
title: any;
|
@@ -68,18 +68,35 @@ export class GitHubApi {
|
|
68
68
|
const number = Math.floor(Math.random() * colors.length);
|
69
69
|
return colors[number];
|
70
70
|
}
|
71
|
+
async updateMilestone(title, state = 'open', description, dueOn) {
|
72
|
+
const allMilestones = await this.getMilestones();
|
73
|
+
const toUpdate = allMilestones.filter(milestone => milestone.title === title)[0];
|
74
|
+
if (!toUpdate) {
|
75
|
+
throw new Error(`No se encontro el milestone ${title}`);
|
76
|
+
}
|
77
|
+
const milestone = {
|
78
|
+
title,
|
79
|
+
state,
|
80
|
+
description,
|
81
|
+
};
|
82
|
+
if (dueOn) {
|
83
|
+
milestone.due_on = dueOn;
|
84
|
+
}
|
85
|
+
const result = await this.octokit.request(`PATCH /repos/${this.repoVar.owner}/${this.repoVar.repo}/milestones/${toUpdate.number}`, { ...milestone, ...{ headers: { 'X-GitHub-Api-Version': '2022-11-28' } } });
|
86
|
+
return { id: result.data.node_id, title: result.data.title, description: result.data.description, dueOn: result.data.due_on, url: result.data.url };
|
87
|
+
}
|
71
88
|
async createMilestone(title, state = 'open', description, dueOn) {
|
72
|
-
const
|
89
|
+
const milestone = {
|
73
90
|
title,
|
74
91
|
state,
|
75
92
|
description,
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
});
|
81
|
-
|
82
|
-
return
|
93
|
+
};
|
94
|
+
if (dueOn) {
|
95
|
+
milestone.due_on = dueOn;
|
96
|
+
}
|
97
|
+
const result = await this.octokit.request(`POST /repos/${this.repoVar.owner}/${this.repoVar.repo}/milestones`, { ...milestone, ...{ headers: { 'X-GitHub-Api-Version': '2022-11-28' } } });
|
98
|
+
console.log(result.data.url);
|
99
|
+
return { id: result.data.node_id, title: result.data.title, description: result.data.description, dueOn: result.data.due_on, url: result.data.url };
|
83
100
|
}
|
84
101
|
async getUser() {
|
85
102
|
const query = `{
|
@@ -24,6 +24,12 @@ export declare class GitLabApi implements IGitApi, IProjectApi {
|
|
24
24
|
state: string;
|
25
25
|
url: string;
|
26
26
|
}>;
|
27
|
+
updateMilestone(title: string, state?: string, description?: string, dueOn?: string): Promise<{
|
28
|
+
id: string;
|
29
|
+
title: string;
|
30
|
+
state: string;
|
31
|
+
url: string;
|
32
|
+
}>;
|
27
33
|
createIssue(title: string, state?: string, label?: string, body?: string, milestone?: string): Promise<{
|
28
34
|
number: number;
|
29
35
|
}>;
|
@@ -24,6 +24,7 @@ export class GitLabApi {
|
|
24
24
|
return [];
|
25
25
|
}
|
26
26
|
async getIssuesWithFilter(filter) {
|
27
|
+
console.log(filter);
|
27
28
|
return [];
|
28
29
|
}
|
29
30
|
async createLabel(name, color = 'random') {
|
@@ -34,6 +35,10 @@ export class GitLabApi {
|
|
34
35
|
console.log(title, state, description, dueOn);
|
35
36
|
return { id: '', title: '', state: '', url: '' };
|
36
37
|
}
|
38
|
+
async updateMilestone(title, state = 'open', description, dueOn) {
|
39
|
+
console.log(title, state, description, dueOn);
|
40
|
+
return { id: '', title: '', state: '', url: '' };
|
41
|
+
}
|
37
42
|
async createIssue(title, state, label, body, milestone) {
|
38
43
|
console.log(title, state, label, body, milestone);
|
39
44
|
return { number: 1 };
|
@@ -221,6 +221,7 @@ export const taskFunctions = {
|
|
221
221
|
},
|
222
222
|
storeConfig(variable, value) {
|
223
223
|
storeConfig({ [variable]: value });
|
224
|
+
context.loadConfig();
|
224
225
|
return true;
|
225
226
|
},
|
226
227
|
async docProcess() {
|
@@ -304,6 +305,21 @@ export const taskFunctions = {
|
|
304
305
|
console.log('Not implemented');
|
305
306
|
return false;
|
306
307
|
},
|
308
|
+
async createMilestone(title, state = 'open', description, dueOn) {
|
309
|
+
if (context.projectApi === undefined || context.gitApi === undefined) {
|
310
|
+
return false;
|
311
|
+
}
|
312
|
+
const result = await context.gitApi.createMilestone(title, state, description, dueOn);
|
313
|
+
return result?.id ? true : false;
|
314
|
+
},
|
315
|
+
async updateMilestone(title, state = 'open', description, dueOn) {
|
316
|
+
if (context.projectApi === undefined || context.gitApi === undefined) {
|
317
|
+
return false;
|
318
|
+
}
|
319
|
+
console.log(title, state, description, dueOn);
|
320
|
+
const result = await context.gitApi.updateMilestone(title, state, description, dueOn);
|
321
|
+
return result?.id ? true : false;
|
322
|
+
},
|
307
323
|
async createIssue(title, label, body, milestone) {
|
308
324
|
if (context.projectApi === undefined || context.gitApi === undefined) {
|
309
325
|
return false;
|
@@ -9,6 +9,7 @@
|
|
9
9
|
{ "name": "Actualiza la version", "function": "storeConfig", "arguments": ["version", "${newVersion}"] },
|
10
10
|
{ "name": "Paquetiza", "subtask": "pack" },
|
11
11
|
{ "name": "Publica", "command": "yarn publish ", "arguments": {"--new-version": "${newVersion}"} },
|
12
|
-
{ "name": "Salida para el Changelog.md", "task": "list", "arguments": {"filter": "milestone", "template": "changelog", "milestone": "${newVersion}"} }
|
12
|
+
{ "name": "Salida para el Changelog.md", "task": "list", "arguments": {"filter": "milestone", "template": "changelog", "milestone": "${newVersion}"} },
|
13
|
+
{ "name": "Actualiza el milestone", "function": "updateMilestone", "arguments": ["v${newVersion}", "closed"] }
|
13
14
|
]
|
14
15
|
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
{
|
2
|
+
"name": "milestone",
|
3
|
+
"guards": ["isGitApi"],
|
4
|
+
"arguments": {
|
5
|
+
"title": { "required": true },
|
6
|
+
"state": {
|
7
|
+
"type": "select",
|
8
|
+
"choices": [ { "value": "open", "label": "open"}, { "value": "closed", "label": "closed"} ]
|
9
|
+
},
|
10
|
+
"description": { "required": false },
|
11
|
+
"dueOn": { "required": false }
|
12
|
+
},
|
13
|
+
"description": "Comando para crear un milestone nuevo",
|
14
|
+
"steps": [
|
15
|
+
{
|
16
|
+
"name": "Crear un milestone nuevo",
|
17
|
+
"function": "createMilestone",
|
18
|
+
"arguments": ["${title}", "${state}", "${description}", "${dueOn}"]
|
19
|
+
}
|
20
|
+
]
|
21
|
+
}
|