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 CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.1.16",
2
+ "version": "0.1.17",
3
3
  "backlogColumn": "Todo",
4
4
  "model": "modelC",
5
5
  "modelTemplates": "modelB",
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}", "Ready,Backlog"],
11
- "description": "Valida que Issue este en la Columna Ready o Backlog",
12
- "errorMessage": "Por favor verifique que el issue ${newIssueNumber} este en la columna Ready o Backlog"
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
- const query = `
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
- const { repository } = yield this.graphqlAuth(query, this.repoVar);
143
- return repository.milestones.nodes;
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, milestoneId?: string): Promise<IIssueObject>;
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, milestoneId) {
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 this.getBranchName() !== newBranchName;
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', this.getBranchName());
430
+ context.set('branchName', getBranchName());
431
431
  return true;
432
432
  }
433
433
  catch (error) {
@@ -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 = process.cwd() + '/.autoforce.json';
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";
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.16",
5
+ "version": "0.1.17",
6
6
  "keywords": [
7
7
  "Salesforce",
8
8
  "Automation",