autoforce 0.1.17 → 0.1.19

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.
Files changed (80) hide show
  1. package/.autoforce.json +8 -4
  2. package/CHANGELOG.md +20 -1
  3. package/lib/auto.js +50 -64
  4. package/lib/helpers/class.d.ts +1 -0
  5. package/lib/helpers/class.js +74 -80
  6. package/lib/helpers/connect.js +199 -213
  7. package/lib/helpers/context.d.ts +6 -3
  8. package/lib/helpers/context.js +279 -225
  9. package/lib/helpers/github-graphql.js +90 -113
  10. package/lib/helpers/github-project-graphql.js +100 -132
  11. package/lib/helpers/gitlab-graphql.js +68 -104
  12. package/lib/helpers/lwc.js +42 -48
  13. package/lib/helpers/metadata.js +1 -2
  14. package/lib/helpers/object.js +47 -55
  15. package/lib/helpers/openai.js +10 -22
  16. package/lib/helpers/taskFunctions.js +330 -386
  17. package/lib/helpers/tasks.d.ts +3 -6
  18. package/lib/helpers/tasks.js +132 -147
  19. package/lib/helpers/template.d.ts +9 -5
  20. package/lib/helpers/template.js +31 -18
  21. package/lib/helpers/util.d.ts +5 -6
  22. package/lib/helpers/util.js +131 -187
  23. package/models/dev/models.json +19 -0
  24. package/models/doc/models.json +9 -0
  25. package/models/git/models.json +9 -0
  26. package/models/project/models.json +9 -0
  27. package/package.json +16 -12
  28. package/commands/modelC/new/issue.json +0 -24
  29. package/commands/models.json +0 -18
  30. package/templates/modelB/openIssues.bash +0 -4
  31. package/templates/modelB/viewIssue.bash +0 -8
  32. package/templates/models.json +0 -12
  33. /package/{commands/modelA → models/dev/npm}/subtasks/checkout-branch.json +0 -0
  34. /package/{commands/modelA → models/dev/npm}/subtasks/create-pull.json +0 -0
  35. /package/{commands/modelC → models/dev/npm}/subtasks/pack.json +0 -0
  36. /package/{commands/modelA → models/dev/npm}/subtasks/publish-branch.json +0 -0
  37. /package/{commands/modelA → models/dev/npm}/tasks/cancel.json +0 -0
  38. /package/{commands/modelA → models/dev/npm}/tasks/finish.json +0 -0
  39. /package/{commands/modelC → models/dev/npm}/tasks/list.json +0 -0
  40. /package/{commands/modelC → models/dev/npm}/tasks/publish.json +0 -0
  41. /package/{commands/modelC → models/dev/npm}/tasks/start.json +0 -0
  42. /package/{commands/modelA → models/dev/npm}/tasks/stop.json +0 -0
  43. /package/{commands/modelA → models/dev/npm}/tasks/switch.json +0 -0
  44. /package/{commands/modelA → models/dev/npm}/tasks/view.json +0 -0
  45. /package/{commands/modelA → models/dev/scratchs}/subtasks/create-scratch.json +0 -0
  46. /package/{commands/modelA → models/dev/scratchs}/subtasks/deploy-code.json +0 -0
  47. /package/{commands/modelA → models/dev/scratchs}/subtasks/drop-scratch.json +0 -0
  48. /package/{commands/modelA → models/dev/scratchs}/subtasks/package-code.json +0 -0
  49. /package/{commands/modelA → models/dev/scratchs}/subtasks/validate-code.json +0 -0
  50. /package/{commands/modelA → models/dev/scratchs}/subtasks/validate-scratch.json +0 -0
  51. /package/{commands/modelC → models/dev/scratchs}/tasks/cancel.json +0 -0
  52. /package/{commands/modelA → models/dev/scratchs}/tasks/deploy.json +0 -0
  53. /package/{commands/modelC → models/dev/scratchs}/tasks/finish.json +0 -0
  54. /package/{commands/modelA → models/dev/scratchs}/tasks/rollback.json +0 -0
  55. /package/{commands/modelA → models/dev/scratchs}/tasks/start.json +0 -0
  56. /package/{commands/modelC → models/dev/scratchs}/tasks/stop.json +0 -0
  57. /package/{commands/modelC → models/dev/scratchs}/tasks/switch.json +0 -0
  58. /package/{commands/modelA → models/doc/processes}/new/process.json +0 -0
  59. /package/{commands/modelA/subtasks → models/doc/processes/subtask}/update-documentation.json +0 -0
  60. /package/{templates/modelA → models/doc/processes/templates}/dictionary/class-all.md +0 -0
  61. /package/{templates/modelA → models/doc/processes/templates}/dictionary/class-diagrama.md +0 -0
  62. /package/{templates/modelA → models/doc/processes/templates}/dictionary/class-inner.md +0 -0
  63. /package/{templates/modelA → models/doc/processes/templates}/dictionary/class-metodos.md +0 -0
  64. /package/{templates/modelA → models/doc/processes/templates}/dictionary/class-public.md +0 -0
  65. /package/{templates/modelA → models/doc/processes/templates}/dictionary/class-referencias.md +0 -0
  66. /package/{templates/modelA → models/doc/processes/templates}/dictionary/class.md +0 -0
  67. /package/{templates/modelA → models/doc/processes/templates}/dictionary/classes.md +0 -0
  68. /package/{templates/modelA → models/doc/processes/templates}/dictionary/object.md +0 -0
  69. /package/{templates/modelA → models/doc/processes/templates}/dictionary/objects.md +0 -0
  70. /package/{templates/modelA → models/doc/processes/templates}/intro.md +0 -0
  71. /package/{templates/modelA → models/doc/processes/templates}/process.md +0 -0
  72. /package/{commands/modelC/subtasks → models/git/githubflow/subtask}/checkout-branch.json +0 -0
  73. /package/{commands/modelC/subtasks → models/git/githubflow/subtask}/create-pull.json +0 -0
  74. /package/{commands/modelC/subtasks → models/git/githubflow/subtask}/publish-branch.json +0 -0
  75. /package/{commands/modelA → models/project/github-releases}/new/issue.json +0 -0
  76. /package/{commands/modelA/tasks → models/project/github-releases/task}/list.json +0 -0
  77. /package/{commands/modelC/tasks → models/project/github-releases/task}/view.json +0 -0
  78. /package/{templates/modelB → models/project/github-releases/templates}/changelog.md +0 -0
  79. /package/{templates/modelA → models/project/github-releases/templates}/openIssues.bash +0 -0
  80. /package/{templates/modelA → models/project/github-releases/templates}/viewIssue.bash +0 -0
@@ -1,23 +1,12 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
1
  import fs from "fs";
11
2
  import { fileURLToPath } from 'url';
12
3
  import prompts from "prompts";
13
4
  import context, { ProjectServices, GitServices } from "./context.js";
14
5
  import { logInfo, logWarning } from "./color.js";
15
- const COMMAND_FOLDER = searchInFolderHierarchy('commands', fileURLToPath(import.meta.url));
16
- export const CONFIG_FILE = searchInFolderHierarchy('.autoforce.json', fileURLToPath(import.meta.url));
17
- export const TEMPLATES_FOLDER = searchInFolderHierarchy('templates', fileURLToPath(import.meta.url));
18
- export const TEMPLATE_MODEL_FOLDER = TEMPLATES_FOLDER + '/' + getConfig('modelTemplates', 'modelA');
19
- export const DICTIONARY_FOLDER = TEMPLATE_MODEL_FOLDER + "/diccionarios";
6
+ const MODELS_FOLDER = searchInFolderHierarchy('models', fileURLToPath(import.meta.url));
20
7
  export const WORKING_FOLDER = process.env.INIT_CWD || ".";
8
+ export const CONFIG_FILE = searchInFolderHierarchy('.autoforce.json', WORKING_FOLDER);
9
+ export const DICTIONARY_FOLDER = process.cwd() + "/docs"; // context.dictionaryFolder;
21
10
  export const filterJson = (fullPath) => fullPath.endsWith(".json");
22
11
  export const filterDirectory = (fullPath) => fs.lstatSync(fullPath).isDirectory();
23
12
  export const filterFiles = (fullPath) => !fs.lstatSync(fullPath).isDirectory();
@@ -31,195 +20,146 @@ export function valuesToChoices(list, valueToTitle = (value) => value) {
31
20
  export function titlesToChoices(list, titleToValue = (title) => title) {
32
21
  return list.map(title => { return { title, value: titleToValue(title) }; });
33
22
  }
34
- export function getDataFromPackage() {
35
- const data = {};
36
- try {
37
- const filename = searchInFolderHierarchy("package.json", process.cwd());
38
- if (!filename) {
39
- throw new Error("No se encontro el package.json en " + process.cwd());
40
- }
41
- const content = fs.readFileSync(filename, "utf8");
42
- const packageJson = JSON.parse(content);
43
- if (packageJson.repository) {
44
- if (packageJson.repository.url) {
45
- data.repositoryUrl = packageJson.repository.url;
46
- data.repositoryType = packageJson.repository.type;
47
- // Ver de sacar repo y owner
48
- if (data.repositoryUrl) {
49
- if (data.repositoryUrl.includes("github.com")) {
50
- const repositoryArray = data.repositoryUrl.split('github.com/');
51
- [data.repositoryOwner, data.repositoryRepo] = repositoryArray[1].split('/');
52
- }
53
- if (data.repositoryUrl.includes("gitlab.com")) {
54
- const repositoryArray = data.repositoryUrl.split('gitlab.com/');
55
- [data.repositoryOwner, data.repositoryRepo] = repositoryArray[1].split('/');
56
- }
57
- }
58
- }
59
- else if (typeof packageJson.repository === 'string') {
60
- data.repositoryUrl = packageJson.repository;
61
- const repositoryArray = data.repositoryUrl.split(':');
62
- data.repositoryType = repositoryArray[0];
63
- [data.repositoryOwner, data.repositoryRepo] = repositoryArray[1].split('/');
64
- }
65
- if (data.repositoryRepo && data.repositoryRepo.endsWith('.git')) {
66
- data.repositoryRepo = data.repositoryRepo.replace('.git', '');
67
- }
68
- }
69
- }
70
- catch (error) {
71
- console.log(error);
72
- throw new Error(`Verifique que exista y sea valido el package.json`);
73
- }
74
- return data;
75
- }
76
23
  export function findChoicesPosition(choices, value) {
77
24
  const index = choices.findIndex(choice => choice.value === value);
78
25
  return index === -1 ? 0 : index;
79
26
  }
80
- function getTaskConfig(config) {
81
- return __awaiter(this, void 0, void 0, function* () {
82
- // TODO: Ver si esto se mueve a un config list
83
- // List Command settings
84
- const filters = context.listFilters();
85
- const listFilter = yield prompts([
27
+ export function getFilesInFolders(folders, filter, recursive = false, ignoreList = []) {
28
+ const files = new Set();
29
+ for (const folder of folders) {
30
+ getFiles(folder, filter, recursive, ignoreList)
31
+ .forEach(file => files.add(file));
32
+ }
33
+ return Array.from(files);
34
+ }
35
+ export function getModelFolders(subfolder) {
36
+ const folder = [
37
+ `${MODELS_FOLDER}/dev/${context.devModel}/${subfolder}`,
38
+ `${MODELS_FOLDER}/git/${context.gitModel}/${subfolder}`,
39
+ `${MODELS_FOLDER}/doc/${context.docModel}/${subfolder}`,
40
+ `${MODELS_FOLDER}/project/${context.projectModel}/${subfolder}`,
41
+ ];
42
+ // Filter only folders that exists
43
+ return folder.filter(folder => fs.existsSync(folder));
44
+ }
45
+ function getTemplates(filter) {
46
+ return getFilesInFolders(getModelFolders('templates'), filter);
47
+ }
48
+ async function getTaskConfig(config) {
49
+ // TODO: Ver si esto se mueve a un config list
50
+ // List Command settings
51
+ const filters = context.listFilters();
52
+ const listFilter = await prompts([
53
+ {
54
+ message: 'Elija un filtro, o bien lo puede dejar fijo en autoforce como listFilter',
55
+ name: 'filter',
56
+ type: 'select',
57
+ initial: findChoicesPosition(filters, config.listFilter),
58
+ choices: filters
59
+ }
60
+ ]);
61
+ if (listFilter.filter === undefined)
62
+ return;
63
+ config.listFilter = listFilter.filter;
64
+ const files = getTemplates(filterBash).map(filename => filename.split(".")[0]);
65
+ if (files.length > 0) {
66
+ const templates = valuesToChoices(files);
67
+ const template = await prompts([
86
68
  {
87
- message: 'Elija un filtro, o bien lo puede dejar fijo en autoforce como listFilter',
88
- name: 'filter',
69
+ message: 'Elija un template, o bien lo puede dejar en autoforce como listTemplate',
70
+ name: 'template',
89
71
  type: 'select',
90
- initial: findChoicesPosition(filters, config.listFilter),
91
- choices: filters
72
+ initial: findChoicesPosition(templates, config.listTemplate),
73
+ choices: templates
92
74
  }
93
75
  ]);
94
- if (listFilter.filter === undefined)
76
+ if (template.template === undefined)
95
77
  return;
96
- config.listFilter = listFilter.filter;
97
- const files = getFiles(`${TEMPLATES_FOLDER}/${config.modelTemplates}`, filterBash).map(filename => filename.split(".")[0]);
98
- if (files.length > 0) {
99
- const templates = valuesToChoices(files);
100
- const template = yield prompts([
101
- {
102
- message: 'Elija un template, o bien lo puede dejar en autoforce como listTemplate',
103
- name: 'template',
104
- type: 'select',
105
- initial: findChoicesPosition(templates, config.listTemplate),
106
- choices: templates
107
- }
108
- ]);
109
- if (template.template === undefined)
110
- return;
111
- config.listTemplate = template.template;
112
- }
113
- return config;
114
- });
78
+ config.listTemplate = template.template;
79
+ }
80
+ return config;
115
81
  }
116
- function getBaseConfig(config) {
117
- return __awaiter(this, void 0, void 0, function* () {
118
- // Todo: Chequear el repoOwner y repo
119
- const gitChoices = [{ title: 'Github', value: GitServices.GitHub }, { title: 'Gitlab', value: GitServices.GitLab }];
120
- // Preguntar por GitHub o GitLab
121
- const gitServices = yield prompts([{
122
- type: "select",
123
- name: "git",
124
- message: "Elija un servicio de Git",
125
- initial: findChoicesPosition(gitChoices, config.gitServices),
126
- choices: gitChoices
127
- }]);
128
- if (gitServices.git === undefined)
129
- process.exit(0);
130
- config.gitServices = gitServices.git;
131
- // Chequear las variables de entorno
132
- if (gitServices.git === GitServices.GitHub && !process.env.GITHUB_TOKEN) {
133
- logWarning('A fin de que la herramienta funcione debe configurar una variable de entorno GITHUB_TOKEN');
134
- }
135
- if (gitServices.git === GitServices.GitLab && !process.env.GITLAB_TOKEN) {
136
- logWarning('A fin de que la herramienta funcione debe configurar una variable de entorno GITLAB_TOKEN');
137
- }
138
- // Selecciona el modelo de automatizacion
139
- const models = readJsonSync(`${COMMAND_FOLDER}/models.json`);
140
- models.push({ title: 'Personalizado', value: 'custom', description: 'En este caso los comandos son configurados fuera de la herramienta y los lee de la carpeta commands en el root del repo' });
141
- const automationModel = yield prompts([{
82
+ async function getBaseConfig(config) {
83
+ // Todo: Chequear el repoOwner y repo
84
+ const gitChoices = [{ title: 'Github', value: GitServices.GitHub }, { title: 'Gitlab', value: GitServices.GitLab }];
85
+ // Preguntar por GitHub o GitLab
86
+ const gitServices = await prompts([{
87
+ type: "select",
88
+ name: "git",
89
+ message: "Elija un servicio de Git",
90
+ initial: findChoicesPosition(gitChoices, config.gitServices),
91
+ choices: gitChoices
92
+ }]);
93
+ if (gitServices.git === undefined)
94
+ process.exit(0);
95
+ config.gitServices = gitServices.git;
96
+ // Chequear las variables de entorno
97
+ if (gitServices.git === GitServices.GitHub && !process.env.GITHUB_TOKEN) {
98
+ logWarning('A fin de que la herramienta funcione debe configurar una variable de entorno GITHUB_TOKEN');
99
+ }
100
+ if (gitServices.git === GitServices.GitLab && !process.env.GITLAB_TOKEN) {
101
+ logWarning('A fin de que la herramienta funcione debe configurar una variable de entorno GITLAB_TOKEN');
102
+ }
103
+ // Selecciona los modelos de automatizacion
104
+ for (const prefix of ['dev', 'git', 'doc', 'project']) {
105
+ const contextProperty = prefix + 'Model';
106
+ const models = readJsonSync(`${MODELS_FOLDER}/${prefix}/models.json`);
107
+ const automationModel = await prompts([{
142
108
  type: "select",
143
109
  name: "model",
144
- message: "Elija un modelo de automatizacion",
145
- initial: findChoicesPosition(models, config.model),
110
+ message: `Elija un modelo de automatizacion para ${prefix}`,
111
+ initial: findChoicesPosition(models, config[contextProperty]),
146
112
  choices: models
147
113
  }]);
148
114
  if (automationModel.model === undefined)
149
115
  return;
150
- config.model = automationModel.model;
151
- // Si es custom pregunta si quiere tomar de base alguno existente
152
- if (automationModel.model === 'custom') {
153
- const baseModel = yield prompts([{
154
- type: "select",
155
- name: "model",
156
- message: "Quiere tomar algun modelo existente de base ? Este se copiara a la carpeta ",
157
- choices: models.concat([{ title: 'No quiero usar ningun modelo', value: 'none' }])
158
- }]);
159
- if (baseModel.model !== 'none') {
160
- console.log('copy archivos..');
161
- }
162
- }
116
+ config[contextProperty] = automationModel.model;
117
+ }
118
+ // Gestion del Proyecto
119
+ const projectChoices = [{ title: 'Github Projects', value: ProjectServices.GitHub }, { title: 'GitLab Projects', value: ProjectServices.GitLab }, { title: 'Jira', value: ProjectServices.Jira }, { title: 'None', value: ProjectServices.None }];
120
+ const projectServices = await prompts([{
121
+ type: "select",
122
+ name: "project",
123
+ message: "Gestion de proyecto",
124
+ initial: findChoicesPosition(projectChoices, config.projectServices),
125
+ choices: projectChoices
126
+ }]);
127
+ if (projectServices.project === undefined)
128
+ return;
129
+ config.projectServices = projectServices.project;
130
+ ;
131
+ if (projectServices.project === ProjectServices.GitHub || projectServices.project === ProjectServices.GitLab) {
163
132
  // Gestion del Proyecto
164
- const projectChoices = [{ title: 'Github Projects', value: ProjectServices.GitHub }, { title: 'GitLab Projects', value: ProjectServices.GitLab }, { title: 'Jira', value: ProjectServices.Jira }, { title: 'None', value: ProjectServices.None }];
165
- const projectServices = yield prompts([{
166
- type: "select",
167
- name: "project",
168
- message: "Gestion de proyecto",
169
- initial: findChoicesPosition(projectChoices, config.projectServices),
170
- choices: projectChoices
171
- }]);
172
- if (projectServices.project === undefined)
173
- return;
174
- config.projectServices = projectServices.project;
175
- ;
176
- if (projectServices.project === ProjectServices.GitHub || projectServices.project === ProjectServices.GitLab) {
177
- // Gestion del Proyecto
178
- const backlogColumn = yield prompts([{
179
- type: "text",
180
- name: "backlogColumn",
181
- initial: config.backlogColumn,
182
- message: "Nombre de la columna donde se crean nuevos issues"
183
- }]);
184
- if (backlogColumn.backlogColumn === undefined)
185
- return;
186
- config.backlogColumn = backlogColumn.backlogColumn;
187
- logInfo(`Por omision ser utilizan proyectos dentro de ${context.repositoryOwner} y ${context.repositoryRepo} `);
188
- }
189
- // Id de Projecto
190
- const projectId = yield prompts([{
133
+ const backlogColumn = await prompts([{
191
134
  type: "text",
192
- name: "projectId",
193
- initial: config.projectId,
194
- message: "Id del proyecto"
195
- }]);
196
- if (projectId.projectId === undefined)
197
- return;
198
- config.projectId = projectId.projectId;
199
- // Modelo de Dcumentacion
200
- const modelsTemplates = readJsonSync(`${TEMPLATES_FOLDER}/models.json`);
201
- const modelTemplates = yield prompts([{
202
- type: "select",
203
- name: "model",
204
- message: "Elija un modelo de documentacion",
205
- initial: findChoicesPosition(modelsTemplates, config.modelTemplates),
206
- choices: modelsTemplates
135
+ name: "backlogColumn",
136
+ initial: config.backlogColumn,
137
+ message: "Nombre de la columna donde se crean nuevos issues"
207
138
  }]);
208
- if (modelTemplates.model === undefined)
139
+ if (backlogColumn.backlogColumn === undefined)
209
140
  return;
210
- config.modelTemplates = modelTemplates.model;
211
- return config;
212
- });
141
+ config.backlogColumn = backlogColumn.backlogColumn;
142
+ logInfo(`Por omision ser utilizan proyectos dentro de ${context.repositoryOwner} y ${context.repositoryRepo} `);
143
+ }
144
+ // Id de Projecto
145
+ const projectId = await prompts([{
146
+ type: "text",
147
+ name: "projectId",
148
+ initial: config.projectId,
149
+ message: "Id del proyecto"
150
+ }]);
151
+ if (projectId.projectId === undefined)
152
+ return;
153
+ config.projectId = projectId.projectId;
154
+ return config;
213
155
  }
214
- export function createConfigurationFile(taskName) {
215
- return __awaiter(this, void 0, void 0, function* () {
216
- const baseConfig = { backlogColumn: context.backlogColumn, model: context.model, modelTemplates: context.modelTemplates, gitServices: context.gitServices, projectServices: context.projectServices, projectId: context.projectId, listFilter: context.listFilter, listTemplate: context.listTemplate };
217
- let config = taskName ? yield getTaskConfig(baseConfig) : yield getBaseConfig(baseConfig);
218
- if (!config)
219
- return false;
220
- storeConfig(config);
221
- return true;
222
- });
156
+ export async function createConfigurationFile(taskName) {
157
+ const baseConfig = { backlogColumn: context.backlogColumn, devModel: context.devModel, docModel: context.docModel, projectModel: context.projectModel, gitModel: context.gitModel, gitServices: context.gitServices, projectServices: context.projectServices, projectId: context.projectId, listFilter: context.listFilter, listTemplate: context.listTemplate };
158
+ let config = taskName ? await getTaskConfig(baseConfig) : await getBaseConfig(baseConfig);
159
+ if (!config)
160
+ return false;
161
+ storeConfig(config);
162
+ return true;
223
163
  }
224
164
  export function getConfigFile(file, variable, defaultValue) {
225
165
  if (fs.existsSync(file)) {
@@ -230,7 +170,7 @@ export function getConfigFile(file, variable, defaultValue) {
230
170
  return config[variable];
231
171
  }
232
172
  }
233
- catch (_a) {
173
+ catch {
234
174
  return defaultValue;
235
175
  }
236
176
  }
@@ -246,7 +186,7 @@ export function storeConfig(record) {
246
186
  try {
247
187
  config = JSON.parse(content);
248
188
  }
249
- catch (_a) {
189
+ catch {
250
190
  throw new Error(`Verifique que el ${CONFIG_FILE} sea json valido`);
251
191
  }
252
192
  }
@@ -256,7 +196,7 @@ export function storeConfig(record) {
256
196
  try {
257
197
  fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2));
258
198
  }
259
- catch (_b) {
199
+ catch {
260
200
  throw new Error(`No se pudo guardar la configuracion en ${CONFIG_FILE}`);
261
201
  }
262
202
  }
@@ -355,6 +295,10 @@ export function convertKeyToName(key) {
355
295
  }
356
296
  export function readJsonSync(filename) {
357
297
  const content = fs.readFileSync(filename, "utf8");
358
- const data = JSON.parse(content);
359
- return data;
298
+ try {
299
+ return JSON.parse(content);
300
+ }
301
+ catch {
302
+ throw new Error(`Verifique que el ${filename} sea json valido`);
303
+ }
360
304
  }
@@ -0,0 +1,19 @@
1
+ [
2
+ {
3
+ "title": "Salesforce con scratchs",
4
+ "value": "scratchs",
5
+ "default": true,
6
+ "description": "Desarrollos empresariales sobre Salesforce, usando una scracth para desarrollo de cada requerimiento"
7
+ },
8
+ {
9
+ "title": "Second Generation Packages con Scratch Orgs",
10
+ "value": "packages",
11
+ "description": "ISV o desarrollos de aplicaciones en Salesforce"
12
+ },
13
+ {
14
+ "title": "Paquetes de NPM",
15
+ "value": "npm",
16
+ "description": "Para herramientas complementarias como autoforce"
17
+ }
18
+ ]
19
+
@@ -0,0 +1,9 @@
1
+ [
2
+ {
3
+ "title": "Procesos de Negocio en Salesforce",
4
+ "value": "processes",
5
+ "default": true,
6
+ "description": "Documentacion Tecnica de procesos de negocio en Salesforce"
7
+ }
8
+ ]
9
+
@@ -0,0 +1,9 @@
1
+ [
2
+ {
3
+ "title": "Github flow branching model",
4
+ "value": "githubflow",
5
+ "default": true,
6
+ "description": "Cada feature se desarrolla en una feature branch y se mergea en main"
7
+ }
8
+ ]
9
+
@@ -0,0 +1,9 @@
1
+ [
2
+ {
3
+ "title": "Proyectos con releases",
4
+ "value": "github-releases",
5
+ "default": true,
6
+ "description": "Manejo de releases en Github proyects"
7
+ }
8
+ ]
9
+
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.17",
5
+ "version": "0.1.19",
6
6
  "keywords": [
7
7
  "Salesforce",
8
8
  "Automation",
@@ -15,8 +15,7 @@
15
15
  },
16
16
  "main": "./bin/index.js",
17
17
  "files": [
18
- "commands/**/*",
19
- "templates/**/*",
18
+ "models/**/*",
20
19
  "lib/**/*",
21
20
  ".autoforce.json",
22
21
  "bin/**/*"
@@ -30,27 +29,32 @@
30
29
  "build": "tsc --project tsconfig.build.json",
31
30
  "prettier": "prettier --write \"**/*.{css,html,js,json,ts,md,xml,yaml,yml}\"",
32
31
  "test:build": "yarn build && npm publish --dry-run && node ./bin/index.js",
33
- "test": "ts-jest --config jest.config.ts"
32
+ "test:package": "yarn build && npm publish --dry-run && node ./bin/index.js",
33
+ "test": "vitest"
34
34
  },
35
35
  "devDependencies": {
36
- "@eslint/js": "^9.9.1",
36
+ "@eslint/js": "^8.56.0",
37
37
  "@octokit/graphql": "^8.1.1",
38
38
  "@types/graphql": "^14.5.0",
39
- "@types/jest": "29.4.0",
39
+ "@types/jest": "^29.5.14",
40
+ "@types/mocha": "^10.0.10",
40
41
  "@types/node": "^22.8.1",
41
- "@typescript-eslint/eslint-plugin": "5.54.0",
42
- "@typescript-eslint/parser": "5.52.0",
43
- "eslint": "^9.9.1",
42
+ "@typescript-eslint/eslint-plugin": "^5.62.0",
43
+ "@typescript-eslint/parser": "^5.62.0",
44
+ "eslint": "^8.56.0",
44
45
  "eslint-plugin-import": "^2.25.4",
45
- "eslint-plugin-jest": "^26.1.2",
46
+ "eslint-plugin-jest": "^27.6.0",
46
47
  "husky": "^7.0.4",
47
48
  "jest": "29.4.3",
49
+ "jsdom": "^26.0.0",
48
50
  "lint-staged": "^12.3.7",
49
51
  "prettier": "^2.6.0",
50
52
  "ts-jest": "29.0.5",
53
+ "ts-jest-mock-import-meta": "^1.2.1",
51
54
  "ts-node": "^10.9.2",
52
- "typescript": "4.9.5",
53
- "typescript-eslint": "^8.3.0"
55
+ "typescript": "^5.7.3",
56
+ "typescript-eslint": "^8.3.0",
57
+ "vitest": "^3.0.5"
54
58
  },
55
59
  "dependencies": {
56
60
  "@types/jsforce": "^1.11.5",
@@ -1,24 +0,0 @@
1
- {
2
- "name": "issue",
3
- "guards": ["isGitApi"],
4
- "arguments": {
5
- "title": { "required": true },
6
- "label": {
7
- "type": "select",
8
- "values": "labels"
9
- },
10
- "milestone": {
11
- "type": "select",
12
- "values": "milestones"
13
- },
14
- "body": { "required": false }
15
- },
16
- "description": "Comando para crear un requerimiento nuevo",
17
- "steps": [
18
- {
19
- "name": "Crear un issue nuevo",
20
- "function": "createIssue",
21
- "arguments": ["${title}", "${label}", "${body}", "${milestone}"]
22
- }
23
- ]
24
- }
@@ -1,18 +0,0 @@
1
- [
2
- {
3
- "title": "Continious Delivery con Scratch Orgs",
4
- "value": "modelA",
5
- "description": "Github workflow pensado en soluciones para Clientes finales"
6
- },
7
- {
8
- "title": "Second Generation Packages con Scratch Orgs",
9
- "value": "modelB",
10
- "description": "Gitflow workflow pensado para ISV"
11
- },
12
- {
13
- "title": "Paquetes de NPM",
14
- "value": "modelC",
15
- "description": "Para herramientas complementarias como autoforce"
16
- }
17
- ]
18
-
@@ -1,4 +0,0 @@
1
- {{#each issues}}
2
- * #{{number}}: {{title}}
3
- {{milestone.title}}
4
- {{/each}}
@@ -1,8 +0,0 @@
1
- {{#with issue}}
2
- #{{number}}: {{title}}
3
- {{state}}
4
- {{#each labels}}{{this}}{{/each}}
5
- {{url}}
6
- {{milestone.title}}
7
- {{body}}
8
- {{/with}}
@@ -1,12 +0,0 @@
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"
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
- ]