autoforce 0.1.8 → 0.1.10
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 +4 -0
- package/README.md +6 -3
- package/commands/modelA/tasks/list.json +11 -0
- package/commands/modelA/tasks/start.json +2 -2
- package/commands/modelA/tasks/view.json +1 -0
- package/commands/modelC/new/issue.json +41 -0
- package/commands/modelC/subtasks/checkout-branch.json +60 -0
- package/commands/modelC/subtasks/create-pull.json +20 -0
- package/commands/modelC/subtasks/pack.json +29 -0
- package/commands/modelC/subtasks/publish-branch.json +20 -0
- package/commands/modelC/tasks/cancel.json +6 -0
- package/commands/modelC/tasks/finish.json +41 -0
- package/commands/modelC/tasks/list.json +11 -0
- package/commands/modelC/tasks/publish.json +13 -0
- package/commands/modelC/tasks/start.json +51 -0
- package/commands/modelC/tasks/stop.json +32 -0
- package/commands/modelC/tasks/switch.json +53 -0
- package/commands/modelC/tasks/view.json +13 -0
- package/commands/models.json +18 -0
- package/lib/auto.js +2 -1
- package/lib/helpers/class.js +4 -3
- package/lib/helpers/context.d.ts +7 -5
- package/lib/helpers/context.js +18 -8
- package/lib/helpers/github-graphql.d.ts +2 -5
- package/lib/helpers/github-graphql.js +1 -31
- package/lib/helpers/github-project-graphql.d.ts +18 -3
- package/lib/helpers/github-project-graphql.js +60 -6
- package/lib/helpers/gitlab-graphql.d.ts +7 -5
- package/lib/helpers/gitlab-graphql.js +13 -3
- package/lib/helpers/lwc.js +4 -3
- package/lib/helpers/metadata.js +2 -2
- package/lib/helpers/object.js +4 -3
- package/lib/helpers/taskFunctions.js +24 -3
- package/lib/helpers/tasks.js +11 -7
- package/lib/helpers/template.d.ts +2 -2
- package/lib/helpers/template.js +2 -4
- package/lib/helpers/util.d.ts +7 -1
- package/lib/helpers/util.js +48 -5
- package/package.json +2 -1
- package/templates/modelB/changelog.md +4 -0
- package/templates/modelB/openIssues.md +0 -0
- package/templates/models.json +13 -0
- package/templates/story.md +0 -32
- package/templates/usecase.md +0 -52
- /package/templates/{dictionary → modelA/dictionary}/class-all.md +0 -0
- /package/templates/{dictionary → modelA/dictionary}/class-diagrama.md +0 -0
- /package/templates/{dictionary → modelA/dictionary}/class-inner.md +0 -0
- /package/templates/{dictionary → modelA/dictionary}/class-metodos.md +0 -0
- /package/templates/{dictionary → modelA/dictionary}/class-public.md +0 -0
- /package/templates/{dictionary → modelA/dictionary}/class-referencias.md +0 -0
- /package/templates/{dictionary → modelA/dictionary}/class.md +0 -0
- /package/templates/{dictionary → modelA/dictionary}/classes.md +0 -0
- /package/templates/{dictionary → modelA/dictionary}/object.md +0 -0
- /package/templates/{dictionary → modelA/dictionary}/objects.md +0 -0
- /package/templates/{intro.md → modelA/intro.md} +0 -0
- /package/templates/{process.md → modelA/process.md} +0 -0
@@ -28,11 +28,8 @@ export declare class GitHubApi implements IGitApi {
|
|
28
28
|
};
|
29
29
|
}>;
|
30
30
|
createPullRequest(branchName: string, title: string, body: string): Promise<boolean>;
|
31
|
-
assignBranchToIssue(issueNumber:
|
32
|
-
|
33
|
-
getIssueName(title: string): string;
|
34
|
-
getIssueObject(issueNumber: number): Promise<IIssueObject>;
|
35
|
-
getIssue(issueNumber: number): Promise<{
|
31
|
+
assignBranchToIssue(issueNumber: string, branchName: string, commitSha: string): Promise<boolean>;
|
32
|
+
getIssue(issueNumber: string): Promise<{
|
36
33
|
id: string;
|
37
34
|
title: string;
|
38
35
|
labels: {
|
@@ -116,36 +116,6 @@ export class GitHubApi {
|
|
116
116
|
return ((_a = createLinkedBranch === null || createLinkedBranch === void 0 ? void 0 : createLinkedBranch.issue) === null || _a === void 0 ? void 0 : _a.id) ? true : false;
|
117
117
|
});
|
118
118
|
}
|
119
|
-
getIssueState(issueNumber) {
|
120
|
-
var _a, _b, _c;
|
121
|
-
return __awaiter(this, void 0, void 0, function* () {
|
122
|
-
const issue = yield this.getIssue(issueNumber);
|
123
|
-
return (_c = (_b = (_a = issue.projectItems) === null || _a === void 0 ? void 0 : _a.nodes[0]) === null || _b === void 0 ? void 0 : _b.fieldValueByName) === null || _c === void 0 ? void 0 : _c.name;
|
124
|
-
});
|
125
|
-
}
|
126
|
-
getIssueName(title) {
|
127
|
-
return title.toLowerCase().replaceAll(' ', '-');
|
128
|
-
}
|
129
|
-
getIssueObject(issueNumber) {
|
130
|
-
return __awaiter(this, void 0, void 0, function* () {
|
131
|
-
const issue = yield this.getIssue(issueNumber);
|
132
|
-
const issueObject = { title: issue.title };
|
133
|
-
issueObject.name = this.getIssueName(issue.title);
|
134
|
-
if (issue.linkedBranches.nodes.length > 0) {
|
135
|
-
issueObject.branch = issue.linkedBranches.nodes[0].ref.name;
|
136
|
-
}
|
137
|
-
if (issue.projectItems.nodes.length > 0) {
|
138
|
-
issueObject.state = issue.projectItems.nodes[0].fieldValueByName.name;
|
139
|
-
}
|
140
|
-
if (issue.labels.nodes.length > 0) {
|
141
|
-
issueObject.labels = [];
|
142
|
-
for (const node of issue.labels.nodes) {
|
143
|
-
issueObject.labels.push(node.name);
|
144
|
-
}
|
145
|
-
}
|
146
|
-
return issueObject;
|
147
|
-
});
|
148
|
-
}
|
149
119
|
getIssue(issueNumber) {
|
150
120
|
return __awaiter(this, void 0, void 0, function* () {
|
151
121
|
const query = `
|
@@ -191,7 +161,7 @@ export class GitHubApi {
|
|
191
161
|
}
|
192
162
|
}
|
193
163
|
`;
|
194
|
-
const { repository } = yield this.graphqlAuth(query, Object.assign({ issueNumber }, this.repoVar));
|
164
|
+
const { repository } = yield this.graphqlAuth(query, Object.assign({ issueNumber: Number.parseInt(issueNumber) }, this.repoVar));
|
195
165
|
return repository.issue;
|
196
166
|
});
|
197
167
|
}
|
@@ -3,7 +3,22 @@ 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,
|
7
|
-
|
8
|
-
|
6
|
+
createIssue(title: string, state?: string, label?: string, body?: string, milestone?: string): Promise<number>;
|
7
|
+
getIssueState(issueNumber: string): Promise<string>;
|
8
|
+
getIssueName(title: string): string;
|
9
|
+
getIssueObject(issueNumber: string): Promise<IIssueObject>;
|
10
|
+
getIssues(): Promise<{
|
11
|
+
id: string;
|
12
|
+
title: string;
|
13
|
+
}[]>;
|
14
|
+
getIssuesByMilestone(milestone: string): Promise<{
|
15
|
+
id: string;
|
16
|
+
title: string;
|
17
|
+
}[]>;
|
18
|
+
getIssuesWithFilter(filterBy: string): Promise<{
|
19
|
+
id: string;
|
20
|
+
title: string;
|
21
|
+
}[]>;
|
22
|
+
moveIssue(issueNumber: string, state: string): Promise<boolean>;
|
23
|
+
assignIssueToMe(issueNumber: string): Promise<boolean>;
|
9
24
|
}
|
@@ -42,7 +42,7 @@ export class GitHubProjectApi extends GitHubApi {
|
|
42
42
|
return mapValues;
|
43
43
|
});
|
44
44
|
}
|
45
|
-
createIssue(title, state, label,
|
45
|
+
createIssue(title, state, label, body, milestone) {
|
46
46
|
var _a;
|
47
47
|
return __awaiter(this, void 0, void 0, function* () {
|
48
48
|
const user = yield this.getUser();
|
@@ -109,15 +109,69 @@ export class GitHubProjectApi extends GitHubApi {
|
|
109
109
|
clientMutationId
|
110
110
|
}
|
111
111
|
}`;
|
112
|
-
|
113
|
-
const { updateProjectV2ItemFieldValue } = yield this.graphqlAuth(mutationColumn, { projectId, itemId, fieldId, columnValue });
|
114
|
-
if (!updateProjectV2ItemFieldValue.clientMutationId) {
|
115
|
-
return 0;
|
116
|
-
}
|
112
|
+
yield this.graphqlAuth(mutationColumn, { projectId, itemId, fieldId, columnValue });
|
117
113
|
}
|
118
114
|
return issue.number;
|
119
115
|
});
|
120
116
|
}
|
117
|
+
getIssueState(issueNumber) {
|
118
|
+
var _a, _b, _c;
|
119
|
+
return __awaiter(this, void 0, void 0, function* () {
|
120
|
+
const issue = yield this.getIssue(issueNumber);
|
121
|
+
return (_c = (_b = (_a = issue.projectItems) === null || _a === void 0 ? void 0 : _a.nodes[0]) === null || _b === void 0 ? void 0 : _b.fieldValueByName) === null || _c === void 0 ? void 0 : _c.name;
|
122
|
+
});
|
123
|
+
}
|
124
|
+
getIssueName(title) {
|
125
|
+
return title.toLowerCase().replaceAll(' ', '-');
|
126
|
+
}
|
127
|
+
getIssueObject(issueNumber) {
|
128
|
+
return __awaiter(this, void 0, void 0, function* () {
|
129
|
+
const issue = yield this.getIssue(issueNumber);
|
130
|
+
const issueObject = { title: issue.title };
|
131
|
+
issueObject.name = this.getIssueName(issue.title);
|
132
|
+
if (issue.linkedBranches.nodes.length > 0) {
|
133
|
+
issueObject.branch = issue.linkedBranches.nodes[0].ref.name;
|
134
|
+
}
|
135
|
+
if (issue.projectItems.nodes.length > 0) {
|
136
|
+
issueObject.state = issue.projectItems.nodes[0].fieldValueByName.name;
|
137
|
+
}
|
138
|
+
if (issue.labels.nodes.length > 0) {
|
139
|
+
issueObject.labels = [];
|
140
|
+
for (const node of issue.labels.nodes) {
|
141
|
+
issueObject.labels.push(node.name);
|
142
|
+
}
|
143
|
+
}
|
144
|
+
return issueObject;
|
145
|
+
});
|
146
|
+
}
|
147
|
+
getIssues() {
|
148
|
+
return __awaiter(this, void 0, void 0, function* () {
|
149
|
+
return yield this.getIssuesWithFilter(`{ states: OPEN }`);
|
150
|
+
});
|
151
|
+
}
|
152
|
+
getIssuesByMilestone(milestone) {
|
153
|
+
return __awaiter(this, void 0, void 0, function* () {
|
154
|
+
return yield this.getIssuesWithFilter(`{ milestone: ${milestone} }`);
|
155
|
+
});
|
156
|
+
}
|
157
|
+
getIssuesWithFilter(filterBy) {
|
158
|
+
return __awaiter(this, void 0, void 0, function* () {
|
159
|
+
const query = `
|
160
|
+
query getIssues($owner:String!, $repo: String!) {
|
161
|
+
repository(owner: $owner, name: $repo) {
|
162
|
+
issues(last: 10, filterBy: ${filterBy} ) {
|
163
|
+
nodes {
|
164
|
+
title
|
165
|
+
id
|
166
|
+
}
|
167
|
+
}
|
168
|
+
}
|
169
|
+
}
|
170
|
+
`;
|
171
|
+
const { repository } = yield this.graphqlAuth(query, this.repoVar);
|
172
|
+
return repository.issues.nodes;
|
173
|
+
});
|
174
|
+
}
|
121
175
|
moveIssue(issueNumber, state) {
|
122
176
|
return __awaiter(this, void 0, void 0, function* () {
|
123
177
|
const issue = yield this.getIssue(issueNumber);
|
@@ -8,10 +8,12 @@ export declare class GitLabApi implements IGitApi, IProjectApi {
|
|
8
8
|
projectNumber: number | undefined;
|
9
9
|
graphqlAuth: GraphQLClient;
|
10
10
|
constructor(token: string, owner: string, repo: string, projectNumber?: number);
|
11
|
-
getIssueObject(issueNumber:
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
getIssueObject(issueNumber: string): Promise<{}>;
|
12
|
+
getIssues(): Promise<never[]>;
|
13
|
+
getIssuesByMilestone(milestone: string): Promise<never[]>;
|
14
|
+
createIssue(title: string, state?: string, label?: string, body?: string, milestone?: string): Promise<number>;
|
15
|
+
moveIssue(issueNumber: string, state: string): Promise<boolean>;
|
16
|
+
assignIssueToMe(issueNumber: string): Promise<boolean>;
|
15
17
|
getUser(): Promise<{
|
16
18
|
login: string;
|
17
19
|
id: number;
|
@@ -19,5 +21,5 @@ export declare class GitLabApi implements IGitApi, IProjectApi {
|
|
19
21
|
graphqlQuery(query: string, vars: Record<string, AnyValue>): Promise<unknown>;
|
20
22
|
getRepository(): Promise<void>;
|
21
23
|
createPullRequest(branchName: string, title: string, body: string): Promise<boolean>;
|
22
|
-
assignBranchToIssue(issueNumber:
|
24
|
+
assignBranchToIssue(issueNumber: string, branchName: string, commitSha: string): Promise<boolean>;
|
23
25
|
}
|
@@ -22,9 +22,19 @@ export class GitLabApi {
|
|
22
22
|
return {};
|
23
23
|
});
|
24
24
|
}
|
25
|
-
|
25
|
+
getIssues() {
|
26
26
|
return __awaiter(this, void 0, void 0, function* () {
|
27
|
-
|
27
|
+
return [];
|
28
|
+
});
|
29
|
+
}
|
30
|
+
getIssuesByMilestone(milestone) {
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
32
|
+
return [];
|
33
|
+
});
|
34
|
+
}
|
35
|
+
createIssue(title, state, label, body, milestone) {
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
37
|
+
console.log(title, state, label, body, milestone);
|
28
38
|
return 1;
|
29
39
|
});
|
30
40
|
}
|
@@ -95,7 +105,7 @@ export class GitLabApi {
|
|
95
105
|
const query = `mutation($branchName: ID!, $issueNumber: Int!, $commitSha: String!) {
|
96
106
|
|
97
107
|
}`;
|
98
|
-
yield this.graphqlQuery(query, { branchName, issueNumber, commitSha });
|
108
|
+
yield this.graphqlQuery(query, { branchName, issueNumber: Number.parseInt(issueNumber), commitSha });
|
99
109
|
return true;
|
100
110
|
});
|
101
111
|
}
|
package/lib/helpers/lwc.js
CHANGED
@@ -9,8 +9,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
9
9
|
};
|
10
10
|
import sf from "./connect.js";
|
11
11
|
import templateGenerator from "./template.js";
|
12
|
-
|
13
|
-
|
12
|
+
import { DICTIONARY_FOLDER, TEMPLATE_MODEL_FOLDER } from "./util.js";
|
13
|
+
const templateEngine = templateGenerator(`${TEMPLATE_MODEL_FOLDER}/dictionary`, "md");
|
14
|
+
import { sortByName, splitFilename } from "./util.js";
|
14
15
|
function getMetadata(lwc) {
|
15
16
|
return __awaiter(this, void 0, void 0, function* () {
|
16
17
|
try {
|
@@ -59,7 +60,7 @@ function executeLwc(items, filename, folder) {
|
|
59
60
|
templateEngine.render(lwcContext, {
|
60
61
|
helpers: {}
|
61
62
|
});
|
62
|
-
templateEngine.save(filename,
|
63
|
+
templateEngine.save(filename, TEMPLATE_MODEL_FOLDER + "/" + folder);
|
63
64
|
});
|
64
65
|
}
|
65
66
|
const lwcModule = {
|
package/lib/helpers/metadata.js
CHANGED
@@ -10,7 +10,7 @@ const helpers = {
|
|
10
10
|
export default helpers;
|
11
11
|
/*
|
12
12
|
import context from "./context.js";
|
13
|
-
import {
|
13
|
+
import { TEMPLATE_MODEL_FOLDER } from "./util.js";
|
14
14
|
import type { DocumentationModule, IProcessInfo, IMetadataNode, IMetadataComponentNode } from "../types/auto.js";
|
15
15
|
function getMetadataFromContext(components: string[]) {
|
16
16
|
return getMetadataArray(context.getProcessMetadata(), components);
|
@@ -66,7 +66,7 @@ function getMetadataArray(metadata: IProcessInfo[], props: string[]) {
|
|
66
66
|
return items;
|
67
67
|
};
|
68
68
|
|
69
|
-
return getItemsFromTree({ folder:
|
69
|
+
return getItemsFromTree({ folder: TEMPLATE_MODEL_FOLDER, childs: metadata });
|
70
70
|
}
|
71
71
|
|
72
72
|
export async function execute() {
|
package/lib/helpers/object.js
CHANGED
@@ -9,8 +9,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
9
9
|
};
|
10
10
|
import sf from "./connect.js";
|
11
11
|
import templateGenerator from "./template.js";
|
12
|
-
|
13
|
-
|
12
|
+
import { DICTIONARY_FOLDER, TEMPLATE_MODEL_FOLDER } from "./util.js";
|
13
|
+
const templateEngine = templateGenerator(`${TEMPLATE_MODEL_FOLDER}/dictionary`, "md");
|
14
|
+
import { sortByLabel } from "./util.js";
|
14
15
|
function getMetadata(objetos) {
|
15
16
|
return __awaiter(this, void 0, void 0, function* () {
|
16
17
|
try {
|
@@ -123,7 +124,7 @@ function executeObjects(items, filename, folder) {
|
|
123
124
|
templateEngine.render(objectContext, {
|
124
125
|
helpers: { isManaged, isMetadataFormula, attributesFormula }
|
125
126
|
});
|
126
|
-
templateEngine.save(filename,
|
127
|
+
templateEngine.save(filename, TEMPLATE_MODEL_FOLDER + "/" + folder);
|
127
128
|
});
|
128
129
|
}
|
129
130
|
const objectModule = {
|
@@ -9,11 +9,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
9
9
|
};
|
10
10
|
import { execSync } from "child_process";
|
11
11
|
import context from "./context.js";
|
12
|
-
import { logError } from "./color.js";
|
12
|
+
import { logError, logInfo } from "./color.js";
|
13
13
|
import metadata from './metadata.js';
|
14
14
|
import prompts from "prompts";
|
15
15
|
import templateGenerator from "./template.js";
|
16
16
|
import { getColored } from "./color.js";
|
17
|
+
import { storeConfig } from "./util.js";
|
17
18
|
function createTemplate(templateFolder, templateExtension, template, filename, folder, context) {
|
18
19
|
if (!template || !filename || !templateFolder || !templateExtension) {
|
19
20
|
return;
|
@@ -219,6 +220,14 @@ function getFilesChanged() {
|
|
219
220
|
return files;
|
220
221
|
}
|
221
222
|
export const taskFunctions = {
|
223
|
+
skip() {
|
224
|
+
logInfo('Error omitido por configuracion del step');
|
225
|
+
return true;
|
226
|
+
},
|
227
|
+
storeConfig(variable, value) {
|
228
|
+
storeConfig(variable, value);
|
229
|
+
return true;
|
230
|
+
},
|
222
231
|
docProcess() {
|
223
232
|
return __awaiter(this, void 0, void 0, function* () {
|
224
233
|
if (!context.process) {
|
@@ -312,12 +321,12 @@ export const taskFunctions = {
|
|
312
321
|
console.log('Not implemented');
|
313
322
|
return false;
|
314
323
|
},
|
315
|
-
createIssue(title, label) {
|
324
|
+
createIssue(title, label, body) {
|
316
325
|
return __awaiter(this, void 0, void 0, function* () {
|
317
326
|
if (context.projectApi === undefined) {
|
318
327
|
return false;
|
319
328
|
}
|
320
|
-
const issueNumber = yield context.projectApi.createIssue(title, context.backlogColumn, label);
|
329
|
+
const issueNumber = yield context.projectApi.createIssue(title, context.backlogColumn, label, body);
|
321
330
|
if (issueNumber) {
|
322
331
|
console.log(`Se creo el issue ${issueNumber}`);
|
323
332
|
return true;
|
@@ -447,6 +456,18 @@ export const taskFunctions = {
|
|
447
456
|
return true;
|
448
457
|
});
|
449
458
|
},
|
459
|
+
listIssues() {
|
460
|
+
return __awaiter(this, void 0, void 0, function* () {
|
461
|
+
if (!context.projectApi) {
|
462
|
+
return false;
|
463
|
+
}
|
464
|
+
const result = yield context.projectApi.getIssues();
|
465
|
+
for (const issue of result) {
|
466
|
+
console.log(issue.title);
|
467
|
+
}
|
468
|
+
return true;
|
469
|
+
});
|
470
|
+
},
|
450
471
|
checkIssueType(issueNumber) {
|
451
472
|
var _a;
|
452
473
|
return __awaiter(this, void 0, void 0, function* () {
|
package/lib/helpers/tasks.js
CHANGED
@@ -118,15 +118,19 @@ export function runTask(task, taskContext, tabs = '') {
|
|
118
118
|
}
|
119
119
|
yield context.askForArguments(task.arguments);
|
120
120
|
}
|
121
|
-
|
121
|
+
if (task.verbose) {
|
122
|
+
logStep(`[INICIO] ${task.name}`, tabs);
|
123
|
+
}
|
122
124
|
for (const step of task.steps) {
|
123
125
|
if (isCriteriaMet(step.criteria)) {
|
124
|
-
if (!(yield executeStep(step, tabs + '\t'))) {
|
126
|
+
if (!(yield executeStep(step, tabs + '\t', task.verbose))) {
|
125
127
|
return false;
|
126
128
|
}
|
127
129
|
}
|
128
130
|
}
|
129
|
-
|
131
|
+
if (task.verbose) {
|
132
|
+
logStep(`[FIN] ${task.name}`, tabs);
|
133
|
+
}
|
130
134
|
return true;
|
131
135
|
});
|
132
136
|
}
|
@@ -174,7 +178,7 @@ function runStep(step, tabs) {
|
|
174
178
|
}
|
175
179
|
else if (typeof step.subtask === 'string') {
|
176
180
|
const subtask = getTask(step.subtask, SUBTASKS_FOLDER);
|
177
|
-
let stepContext = context.mergeArgs(step.arguments);
|
181
|
+
let stepContext = step.arguments ? context.mergeArgs(step.arguments) : {};
|
178
182
|
if (Array.isArray(stepContext)) {
|
179
183
|
stepContext = createObject(subtask.arguments, stepContext);
|
180
184
|
}
|
@@ -202,10 +206,10 @@ function askForContinueOrRetry() {
|
|
202
206
|
function getStepError(step, stepName) {
|
203
207
|
return step.errorMessage ? context.merge(step.errorMessage) : stepName ? `Fallo el step ${stepName}` : '';
|
204
208
|
}
|
205
|
-
function executeStep(step, tabs) {
|
209
|
+
function executeStep(step, tabs, verbose = false) {
|
206
210
|
return __awaiter(this, void 0, void 0, function* () {
|
207
211
|
const stepName = step.name ? context.merge(step.name) : undefined;
|
208
|
-
if (stepName) {
|
212
|
+
if (verbose && stepName) {
|
209
213
|
logStep(`[INICIO] ${stepName}`, tabs);
|
210
214
|
}
|
211
215
|
let retry = false;
|
@@ -235,7 +239,7 @@ function executeStep(step, tabs) {
|
|
235
239
|
success = result == 'continue';
|
236
240
|
}
|
237
241
|
} while (!success && retry);
|
238
|
-
if (stepName) {
|
242
|
+
if (verbose && stepName) {
|
239
243
|
logStep(`[FIN] ${stepName}`, tabs);
|
240
244
|
}
|
241
245
|
if (!success) {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/// <reference types="handlebars" />
|
2
|
-
declare class TemplateEngine
|
2
|
+
declare class TemplateEngine {
|
3
3
|
_template: HandlebarsTemplateDelegate | undefined;
|
4
4
|
_rendered: string | undefined;
|
5
5
|
_extension: string;
|
@@ -10,5 +10,5 @@ declare class TemplateEngine<T> {
|
|
10
10
|
render(context: object, options?: RuntimeOptions): void;
|
11
11
|
save(filename: string, folder: string, options?: SaveTemplateOptions): void;
|
12
12
|
}
|
13
|
-
declare const _default: (source: string, extension: string) => TemplateEngine
|
13
|
+
declare const _default: (source: string, extension: string) => TemplateEngine;
|
14
14
|
export default _default;
|
package/lib/helpers/template.js
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
import fs from "fs";
|
2
2
|
import Handlebars from "handlebars";
|
3
3
|
import { merge } from "./merge.js";
|
4
|
-
import {
|
5
|
-
import { getFiles, searchInFolderHierarchy } from "./util.js";
|
6
|
-
const TEMPLATE_ROOT_FOLDER = searchInFolderHierarchy('templates', fileURLToPath(import.meta.url));
|
4
|
+
import { getFiles } from "./util.js";
|
7
5
|
function isObjectEmpty(objectName) {
|
8
6
|
return (objectName &&
|
9
7
|
Object.keys(objectName).length === 0 &&
|
@@ -26,7 +24,7 @@ function openTemplate(sourceFolder, templateName, extension) {
|
|
26
24
|
}
|
27
25
|
class TemplateEngine {
|
28
26
|
constructor(source, extension) {
|
29
|
-
this._sourceFolder =
|
27
|
+
this._sourceFolder = source;
|
30
28
|
if (!fs.existsSync(this._sourceFolder)) {
|
31
29
|
throw new Error(`La carpeta source ${this._sourceFolder} no existe!`);
|
32
30
|
}
|
package/lib/helpers/util.d.ts
CHANGED
@@ -1,7 +1,10 @@
|
|
1
|
+
import prompts from "prompts";
|
2
|
+
import { AnyValue } from "../types/auto.js";
|
3
|
+
export declare const CONFIG_FILE: string;
|
1
4
|
export declare const TEMPLATES_FOLDER: string;
|
5
|
+
export declare const TEMPLATE_MODEL_FOLDER: string;
|
2
6
|
export declare const DICTIONARY_FOLDER: string;
|
3
7
|
export declare const WORKING_FOLDER: string;
|
4
|
-
export declare const CONFIG_FILE: string;
|
5
8
|
export declare const filterJson: (fullPath: string) => boolean;
|
6
9
|
export declare const filterDirectory: (fullPath: string) => boolean;
|
7
10
|
export declare const filterFiles: (fullPath: string) => boolean;
|
@@ -18,6 +21,8 @@ export declare function titlesToChoices(list: string[], titleToValue?: (title: s
|
|
18
21
|
}[];
|
19
22
|
export declare function getDataFromPackage(): Record<string, string>;
|
20
23
|
export declare function createConfigurationFile(): Promise<boolean>;
|
24
|
+
export declare function getConfig(variable: string, defaultValue: AnyValue): any;
|
25
|
+
export declare function storeConfig(variable: string, value: AnyValue): void;
|
21
26
|
export declare function sortByName(objA: {
|
22
27
|
Name: string;
|
23
28
|
}, objB: {
|
@@ -44,3 +49,4 @@ export declare function searchInFolderHierarchy(element: string, parentFolder: s
|
|
44
49
|
export declare function getFiles(source: string, filter?: (file: string) => boolean, recursive?: boolean, ignoreList?: string[]): string[];
|
45
50
|
export declare function convertNameToKey(name: string): string;
|
46
51
|
export declare function convertKeyToName(key: string): string;
|
52
|
+
export declare function readJsonSync(filename: string): prompts.Choice[];
|
package/lib/helpers/util.js
CHANGED
@@ -13,10 +13,11 @@ import prompts from "prompts";
|
|
13
13
|
import { 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 = process.cwd() + '/.autoforce.json';
|
16
17
|
export const TEMPLATES_FOLDER = searchInFolderHierarchy('templates', fileURLToPath(import.meta.url));
|
17
|
-
export const
|
18
|
+
export const TEMPLATE_MODEL_FOLDER = TEMPLATES_FOLDER + '/' + getConfig('modelTemplates', 'modelA');
|
19
|
+
export const DICTIONARY_FOLDER = TEMPLATE_MODEL_FOLDER + "/diccionarios";
|
18
20
|
export const WORKING_FOLDER = process.env.INIT_CWD || ".";
|
19
|
-
export const CONFIG_FILE = process.cwd() + '/.autoforce.json';
|
20
21
|
export const filterJson = (fullPath) => fullPath.endsWith(".json");
|
21
22
|
export const filterDirectory = (fullPath) => fs.lstatSync(fullPath).isDirectory();
|
22
23
|
export const filterFiles = (fullPath) => !fs.lstatSync(fullPath).isDirectory();
|
@@ -92,7 +93,7 @@ export function createConfigurationFile() {
|
|
92
93
|
if (gitServices.git === GitServices.GitLab && !process.env.GITLAB_TOKEN) {
|
93
94
|
logWarning('A fin de que la herramienta funcione debe configurar una variable de entorno GITLAB_TOKEN');
|
94
95
|
}
|
95
|
-
const models =
|
96
|
+
const models = readJsonSync(`${COMMAND_FOLDER}/models.json`);
|
96
97
|
const automationModel = yield prompts([{
|
97
98
|
type: "select",
|
98
99
|
name: "model",
|
@@ -124,7 +125,7 @@ export function createConfigurationFile() {
|
|
124
125
|
const backlogColumn = yield prompts([{
|
125
126
|
type: "text",
|
126
127
|
name: "backlogColumn",
|
127
|
-
initial: '
|
128
|
+
initial: 'Todo',
|
128
129
|
message: "Nombre de la columna donde se crean nuevos issues"
|
129
130
|
}]);
|
130
131
|
optionals['backlogColumn'] = backlogColumn.backlogColumn;
|
@@ -135,8 +136,16 @@ export function createConfigurationFile() {
|
|
135
136
|
name: "projectId",
|
136
137
|
message: "Id del proyecto"
|
137
138
|
}]);
|
139
|
+
// Modelo de Dcumentacion
|
140
|
+
const modelsTemplates = readJsonSync(`${TEMPLATES_FOLDER}/models.json`);
|
141
|
+
const modelTemplates = yield prompts([{
|
142
|
+
type: "select",
|
143
|
+
name: "model",
|
144
|
+
message: "Elija un modelo de documentacion",
|
145
|
+
choices: modelsTemplates
|
146
|
+
}]);
|
138
147
|
// console.log('Genera documentacion');
|
139
|
-
const config = Object.assign({ model: automationModel.model, gitServices: gitServices.git, projectServices: projectServices.project, projectId: projectId.projectId }, optionals);
|
148
|
+
const config = Object.assign({ model: automationModel.model, modelTemplates: modelTemplates.model, gitServices: gitServices.git, projectServices: projectServices.project, projectId: projectId.projectId }, optionals);
|
140
149
|
try {
|
141
150
|
fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2));
|
142
151
|
}
|
@@ -146,6 +155,35 @@ export function createConfigurationFile() {
|
|
146
155
|
return true;
|
147
156
|
});
|
148
157
|
}
|
158
|
+
export function getConfig(variable, defaultValue) {
|
159
|
+
if (fs.existsSync(CONFIG_FILE)) {
|
160
|
+
const content = fs.readFileSync(CONFIG_FILE, "utf8");
|
161
|
+
try {
|
162
|
+
const config = JSON.parse(content);
|
163
|
+
if (config[variable]) {
|
164
|
+
return config[variable];
|
165
|
+
}
|
166
|
+
}
|
167
|
+
catch (_a) {
|
168
|
+
return defaultValue;
|
169
|
+
}
|
170
|
+
}
|
171
|
+
return defaultValue;
|
172
|
+
}
|
173
|
+
export function storeConfig(variable, value) {
|
174
|
+
let config = {};
|
175
|
+
if (fs.existsSync(CONFIG_FILE)) {
|
176
|
+
const content = fs.readFileSync(CONFIG_FILE, "utf8");
|
177
|
+
try {
|
178
|
+
config = JSON.parse(content);
|
179
|
+
}
|
180
|
+
catch (_a) {
|
181
|
+
throw new Error(`Verifique que el ${CONFIG_FILE} sea json valido`);
|
182
|
+
}
|
183
|
+
}
|
184
|
+
config[variable] = value;
|
185
|
+
fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2));
|
186
|
+
}
|
149
187
|
export function sortByName(objA, objB) {
|
150
188
|
return objA.Name > objB.Name ? 1 : objA.Name < objB.Name ? -1 : 0;
|
151
189
|
}
|
@@ -239,3 +277,8 @@ export function convertKeyToName(key) {
|
|
239
277
|
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
240
278
|
.join(' ');
|
241
279
|
}
|
280
|
+
export function readJsonSync(filename) {
|
281
|
+
const content = fs.readFileSync(filename, "utf8");
|
282
|
+
const data = JSON.parse(content);
|
283
|
+
return data;
|
284
|
+
}
|
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.10",
|
6
6
|
"keywords": [
|
7
7
|
"Salesforce",
|
8
8
|
"Automation",
|
@@ -54,6 +54,7 @@
|
|
54
54
|
"@types/graphql": "^14.5.0",
|
55
55
|
"@types/jsforce": "^1.11.5",
|
56
56
|
"@types/prompts": "^2.4.9",
|
57
|
+
"autoforce": "file:./autoforce.tgz",
|
57
58
|
"graphql": "^16.9.0",
|
58
59
|
"graphql-request": "^7.1.0",
|
59
60
|
"gray-matter": "^4.0.3",
|
File without changes
|
@@ -0,0 +1,13 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"title": "Procesos de Negocio en Salesforce",
|
4
|
+
"value": "modelA",
|
5
|
+
"description": "Documenta Clases, Objetos y LWC a traves de procesos de negocios. Se basa en docusaurus"0
|
6
|
+
},
|
7
|
+
{
|
8
|
+
"title": "Proyecto simple en Github Docs",
|
9
|
+
"value": "modelB",
|
10
|
+
"description": "Github pages con changelog, readme y carpeta docs de Markdowns"
|
11
|
+
}
|
12
|
+
]
|
13
|
+
|
package/templates/story.md
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
---
|
2
|
-
sidebar_position: 1
|
3
|
-
tags: [{ { rol } }]
|
4
|
-
---
|
5
|
-
|
6
|
-
# {{titulo}}
|
7
|
-
|
8
|
-
- Modulo: [{{modulo}}](/{{modulo}})
|
9
|
-
- Roles: [{{rol}}](/tags/{{rol}})
|
10
|
-
|
11
|
-
## Descripcion:
|
12
|
-
|
13
|
-
## Escenarios
|
14
|
-
|
15
|
-
1.
|
16
|
-
|
17
|
-
<!-- START autogenerated-objects -->
|
18
|
-
<!-- END autogenerated-objects -->
|
19
|
-
|
20
|
-
<!-- START autogenerated-classes -->
|
21
|
-
<!-- END autogenerated-classes -->
|
22
|
-
|
23
|
-
<!-- START autogenerated-usecase -->
|
24
|
-
|
25
|
-
:::tip
|
26
|
-
Para refrescar metadata:
|
27
|
-
|
28
|
-
```bash
|
29
|
-
{{command}}
|
30
|
-
```
|
31
|
-
|
32
|
-
<!-- END autogenerated-usecase -->
|