autoforce 0.1.13 → 0.1.15
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 +11 -0
- package/commands/modelA/new/issue.json +8 -24
- package/commands/modelC/tasks/publish.json +2 -2
- package/lib/auto.js +3 -2
- package/lib/helpers/github-project-graphql.d.ts +1 -1
- package/lib/helpers/github-project-graphql.js +8 -2
- package/lib/helpers/gitlab-graphql.d.ts +3 -1
- package/lib/helpers/gitlab-graphql.js +1 -1
- package/lib/helpers/taskFunctions.js +8 -3
- package/lib/helpers/util.d.ts +1 -0
- package/lib/helpers/util.js +6 -3
- package/package.json +2 -2
- package/templates/modelA/openIssues.bash +4 -0
- package/templates/modelA/viewIssue.bash +8 -0
package/.autoforce.json
ADDED
@@ -5,36 +5,20 @@
|
|
5
5
|
"title": { "required": true },
|
6
6
|
"label": {
|
7
7
|
"type": "select",
|
8
|
-
"
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
"title": "Bugfix",
|
16
|
-
"value": "bug",
|
17
|
-
"description": "Correxion de codigo, no hay incremento funcional"
|
18
|
-
},
|
19
|
-
{
|
20
|
-
"title": "Documentation",
|
21
|
-
"value": "documentation",
|
22
|
-
"description": "Cambios en la documentacion"
|
23
|
-
},
|
24
|
-
{
|
25
|
-
"title": "Feature",
|
26
|
-
"value": "feature",
|
27
|
-
"description": "Nuevas funcionalidades"
|
28
|
-
}
|
29
|
-
]
|
30
|
-
}
|
8
|
+
"values": "labels"
|
9
|
+
},
|
10
|
+
"milestone": {
|
11
|
+
"type": "select",
|
12
|
+
"values": "milestones"
|
13
|
+
},
|
14
|
+
"body": { "required": false }
|
31
15
|
},
|
32
16
|
"description": "Comando para crear un requerimiento nuevo",
|
33
17
|
"steps": [
|
34
18
|
{
|
35
19
|
"name": "Crear un issue nuevo",
|
36
20
|
"function": "createIssue",
|
37
|
-
"arguments": ["${title}", "${label}"]
|
21
|
+
"arguments": ["${title}", "${label}", "${body}", "${milestone}"]
|
38
22
|
}
|
39
23
|
]
|
40
24
|
}
|
@@ -6,9 +6,9 @@
|
|
6
6
|
},
|
7
7
|
"description": "Comando para publicar un requerimiento al ambiente",
|
8
8
|
"steps": [
|
9
|
-
{ "name": "Paquetiza", "subtask": "pack" },
|
10
9
|
{ "name": "Actualiza la version", "function": "storeConfig", "arguments": ["version", "${newVersion}"] },
|
11
|
-
{ "name": "
|
10
|
+
{ "name": "Paquetiza", "subtask": "pack" },
|
11
|
+
{ "name": "Publica", "command": "yarn publish ", "arguments": {"--new-version": "${newVersion}"} },
|
12
12
|
{ "name": "Salida para el Changelog.md", "task": "list", "arguments": {"filter": "milestone", "template": "changelog", "milestone": "${newVersion}"} }
|
13
13
|
]
|
14
14
|
}
|
package/lib/auto.js
CHANGED
@@ -11,7 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
11
11
|
import { createObject, validateTask, getTasks, helpTask, runTask, getTaskFolder } from "./helpers/tasks.js";
|
12
12
|
import { logError } from "./helpers/color.js";
|
13
13
|
import prompts from "prompts";
|
14
|
-
import { createConfigurationFile } from "./helpers/util.js";
|
14
|
+
import { createConfigurationFile, getConfigFile } from "./helpers/util.js";
|
15
15
|
import context from "./helpers/context.js";
|
16
16
|
const proxyCommand = {
|
17
17
|
'version': showVersion,
|
@@ -25,7 +25,8 @@ const taskCommand = {
|
|
25
25
|
};
|
26
26
|
function showVersion() {
|
27
27
|
return __awaiter(this, void 0, void 0, function* () {
|
28
|
-
|
28
|
+
const version = getConfigFile('../.autoforce.json', 'version', '0.1.14');
|
29
|
+
console.log('AutoForce v' + version);
|
29
30
|
return true;
|
30
31
|
});
|
31
32
|
}
|
@@ -3,7 +3,7 @@ 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
|
-
createIssue(title: string, state?: string, label?: string, body?: string, milestoneId?: string): Promise<
|
6
|
+
createIssue(title: string, state?: string, label?: string, body?: string, milestoneId?: string): Promise<IIssueObject>;
|
7
7
|
getIssueState(issueNumber: string): Promise<string>;
|
8
8
|
getIssueName(title: string): string;
|
9
9
|
_getIssue(issueNumber: string): Promise<{
|
@@ -65,13 +65,19 @@ export class GitHubProjectApi extends GitHubApi {
|
|
65
65
|
issue {
|
66
66
|
id
|
67
67
|
number
|
68
|
+
url
|
69
|
+
milestone {
|
70
|
+
title
|
71
|
+
dueOn
|
72
|
+
url
|
73
|
+
}
|
68
74
|
}
|
69
75
|
}
|
70
76
|
}`;
|
71
77
|
const { createIssue } = yield this.graphqlAuth(mutationIssue, { labelId, body, assignId: user.id, projectId, repositoryId, title, milestoneId: milestoneId ? milestoneId : null, label: label ? [label] : null });
|
72
78
|
const issue = createIssue.issue;
|
73
79
|
if (!state || !issue.number) {
|
74
|
-
return issue
|
80
|
+
return issue;
|
75
81
|
}
|
76
82
|
const mutationItem = `
|
77
83
|
mutation addProjectV2ItemById($projectId: ID!, $contentId: ID! ) {
|
@@ -111,7 +117,7 @@ export class GitHubProjectApi extends GitHubApi {
|
|
111
117
|
}`;
|
112
118
|
yield this.graphqlAuth(mutationColumn, { projectId, itemId, fieldId, columnValue });
|
113
119
|
}
|
114
|
-
return issue
|
120
|
+
return issue;
|
115
121
|
});
|
116
122
|
}
|
117
123
|
getIssueState(issueNumber) {
|
@@ -13,7 +13,9 @@ export declare class GitLabApi implements IGitApi, IProjectApi {
|
|
13
13
|
getIssue(issueNumber: string): Promise<{}>;
|
14
14
|
getIssues(): Promise<never[]>;
|
15
15
|
getIssuesWithFilter(filter: string): Promise<never[]>;
|
16
|
-
createIssue(title: string, state?: string, label?: string, body?: string, milestone?: string): Promise<
|
16
|
+
createIssue(title: string, state?: string, label?: string, body?: string, milestone?: string): Promise<{
|
17
|
+
number: number;
|
18
|
+
}>;
|
17
19
|
moveIssue(issueNumber: string, state: string): Promise<boolean>;
|
18
20
|
assignIssueToMe(issueNumber: string): Promise<boolean>;
|
19
21
|
getUser(): Promise<{
|
@@ -45,7 +45,7 @@ export class GitLabApi {
|
|
45
45
|
createIssue(title, state, label, body, milestone) {
|
46
46
|
return __awaiter(this, void 0, void 0, function* () {
|
47
47
|
console.log(title, state, label, body, milestone);
|
48
|
-
return 1;
|
48
|
+
return { number: 1 };
|
49
49
|
});
|
50
50
|
}
|
51
51
|
moveIssue(issueNumber, state) {
|
@@ -338,9 +338,14 @@ export const taskFunctions = {
|
|
338
338
|
if (context.projectApi === undefined) {
|
339
339
|
return false;
|
340
340
|
}
|
341
|
-
|
342
|
-
|
343
|
-
|
341
|
+
console.log(milestone);
|
342
|
+
const issue = yield context.projectApi.createIssue(title, context.backlogColumn, label, body, milestone);
|
343
|
+
if (issue) {
|
344
|
+
console.log(`Se creo el issue ${issue.number}`);
|
345
|
+
console.log(`${issue.url}`);
|
346
|
+
// if ( issue.milestone) {
|
347
|
+
// console.log(`Milestone ${issue.milestone.title} expira en ${issue.milestone.dueOn} `);
|
348
|
+
// }
|
344
349
|
return true;
|
345
350
|
}
|
346
351
|
return false;
|
package/lib/helpers/util.d.ts
CHANGED
@@ -23,6 +23,7 @@ export declare function titlesToChoices(list: string[], titleToValue?: (title: s
|
|
23
23
|
export declare function getDataFromPackage(): Record<string, string>;
|
24
24
|
export declare function findChoicesPosition(choices: Choice[], value: string): number;
|
25
25
|
export declare function createConfigurationFile(taskName?: string): Promise<boolean>;
|
26
|
+
export declare function getConfigFile(file: string, variable: string, defaultValue: AnyValue): any;
|
26
27
|
export declare function getConfig(variable: string, defaultValue: AnyValue): any;
|
27
28
|
export declare function storeConfig(record: Record<string, AnyValue>): void;
|
28
29
|
export declare function sortByName(objA: {
|
package/lib/helpers/util.js
CHANGED
@@ -218,9 +218,9 @@ export function createConfigurationFile(taskName) {
|
|
218
218
|
return true;
|
219
219
|
});
|
220
220
|
}
|
221
|
-
export function
|
222
|
-
if (fs.existsSync(
|
223
|
-
const content = fs.readFileSync(
|
221
|
+
export function getConfigFile(file, variable, defaultValue) {
|
222
|
+
if (fs.existsSync(file)) {
|
223
|
+
const content = fs.readFileSync(file, "utf8");
|
224
224
|
try {
|
225
225
|
const config = JSON.parse(content);
|
226
226
|
if (config[variable]) {
|
@@ -233,6 +233,9 @@ export function getConfig(variable, defaultValue) {
|
|
233
233
|
}
|
234
234
|
return defaultValue;
|
235
235
|
}
|
236
|
+
export function getConfig(variable, defaultValue) {
|
237
|
+
return getConfigFile(CONFIG_FILE, variable, defaultValue);
|
238
|
+
}
|
236
239
|
export function storeConfig(record) {
|
237
240
|
let config = {};
|
238
241
|
if (fs.existsSync(CONFIG_FILE)) {
|
package/package.json
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
"name": "autoforce",
|
3
3
|
"homepage": "https://sebastianclaros.github.io/autoforce",
|
4
4
|
"private": false,
|
5
|
-
"version": "0.1.
|
5
|
+
"version": "0.1.15",
|
6
6
|
"keywords": [
|
7
7
|
"Salesforce",
|
8
8
|
"Automation",
|
@@ -18,6 +18,7 @@
|
|
18
18
|
"commands/**/*",
|
19
19
|
"templates/**/*",
|
20
20
|
"lib/**/*",
|
21
|
+
".autoforce.json",
|
21
22
|
"bin/**/*"
|
22
23
|
],
|
23
24
|
"bin": {
|
@@ -54,7 +55,6 @@
|
|
54
55
|
"dependencies": {
|
55
56
|
"@types/jsforce": "^1.11.5",
|
56
57
|
"@types/prompts": "^2.4.9",
|
57
|
-
"autoforce": "file:./autoforce.tgz",
|
58
58
|
"graphql": "^16.9.0",
|
59
59
|
"graphql-request": "^7.1.0",
|
60
60
|
"gray-matter": "^4.0.3",
|