autoforce 0.1.26 → 0.1.27

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.23",
2
+ "version": "0.1.27",
3
3
  "backlogColumn": "Todo",
4
4
  "gitServices": "github",
5
5
  "gitModel": "githubflow",
@@ -11,5 +11,6 @@
11
11
  "devModel": "npm",
12
12
  "docModel": "processes",
13
13
  "filter": "{states: OPEN}",
14
- "template": "openIssues"
14
+ "template": "openIssues",
15
+ "dictionaryFolder": "docs/docs"
15
16
  }
@@ -4,7 +4,7 @@ import { DICTIONARY_FOLDER, getModelFolders } from "./util.js";
4
4
  let _templateEngine;
5
5
  function getTemplateEngine() {
6
6
  if (!_templateEngine) {
7
- _templateEngine = templateGenerator(getModelFolders('dictionary'), "md");
7
+ _templateEngine = templateGenerator(getModelFolders('templates/dictionary'), "md");
8
8
  }
9
9
  return _templateEngine;
10
10
  }
@@ -30,7 +30,6 @@ declare class Context implements IObjectRecord {
30
30
  isGitApi: boolean;
31
31
  gitApi: IGitApi | undefined;
32
32
  version: string | undefined;
33
- dictionaryFolder: string;
34
33
  options: Record<string, AnyValue>;
35
34
  projectServices: ProjectServices;
36
35
  isProjectApi: boolean;
@@ -40,6 +39,7 @@ declare class Context implements IObjectRecord {
40
39
  branchName: string | undefined;
41
40
  issueNumber: string | undefined;
42
41
  issueType: string | undefined;
42
+ _dictionaryFolder: string | undefined;
43
43
  _process: string | undefined;
44
44
  _processesHeader: Record<string, IProcessHeader> | undefined;
45
45
  _newIssueNumber: string | undefined;
@@ -81,10 +81,12 @@ declare class Context implements IObjectRecord {
81
81
  [key: string]: any;
82
82
  };
83
83
  addProcessMetadata(component: string, items: string[]): void;
84
+ set dictionaryFolder(value: string);
85
+ get dictionaryFolder(): string;
84
86
  get processesHeader(): Record<string, IProcessHeader>;
85
87
  getProcessMetadata(): IProcessInfo[];
86
88
  getModules(): string[];
87
- get modules(): PromptChoices;
89
+ modules(): PromptChoices;
88
90
  get existScratch(): boolean;
89
91
  get scratch(): OrganizationInfo;
90
92
  validate(guards: string[]): Promise<void>;
@@ -100,7 +100,6 @@ class Context {
100
100
  isGitApi = false;
101
101
  gitApi;
102
102
  version;
103
- dictionaryFolder = process.cwd() + "/docs";
104
103
  options = {};
105
104
  projectServices = ProjectServices.None;
106
105
  isProjectApi = false;
@@ -110,6 +109,7 @@ class Context {
110
109
  branchName;
111
110
  issueNumber;
112
111
  issueType;
112
+ _dictionaryFolder;
113
113
  _process;
114
114
  _processesHeader;
115
115
  _newIssueNumber;
@@ -326,6 +326,12 @@ class Context {
326
326
  throw new Error(`No se pudo guardar la metadata`);
327
327
  }
328
328
  }
329
+ set dictionaryFolder(value) {
330
+ this._dictionaryFolder = value;
331
+ }
332
+ get dictionaryFolder() {
333
+ return this._dictionaryFolder ? this._dictionaryFolder : getProjectPath() + '/docs';
334
+ }
329
335
  get processesHeader() {
330
336
  if (!this._processesHeader) {
331
337
  this._processesHeader = {};
@@ -365,9 +371,9 @@ class Context {
365
371
  return retArray;
366
372
  }
367
373
  getModules() {
368
- return getFiles(this.dictionaryFolder, filterDirectory, false, ['diccionarios']);
374
+ return getFiles(this.dictionaryFolder, filterDirectory, false, ['diccionarios', 'src', '.docusaurus', 'node_modules']);
369
375
  }
370
- get modules() {
376
+ modules() {
371
377
  return this.getModules().map(module => { return { value: module, title: module }; });
372
378
  }
373
379
  get existScratch() {
@@ -553,7 +559,7 @@ class Context {
553
559
  }
554
560
  return inputsArray;
555
561
  }
556
- async askForExit() {
562
+ async askForExit( /* prompt: PromptObject */) {
557
563
  const answer = await prompts([
558
564
  {
559
565
  type: "confirm",
@@ -587,14 +593,19 @@ class Context {
587
593
  }
588
594
  async askForArguments(inputs) {
589
595
  // unifica los dos tipos de inputs (array y objeto) en un array de inputs
590
- const inputsArray = await this.convertToArrayOfInputs(inputs);
591
- for (const input of inputsArray) {
592
- const hasValue = await this.get(input.name);
593
- if (!hasValue) {
594
- const answer = await prompts([input], { onCancel: this.askForExit });
595
- this[input.name] = answer[input.name];
596
+ try {
597
+ const inputsArray = await this.convertToArrayOfInputs(inputs);
598
+ for (const input of inputsArray) {
599
+ const hasValue = await this.get(input.name);
600
+ if (!hasValue) {
601
+ const answer = await prompts([input], { onCancel: this.askForExit });
602
+ this[input.name] = answer[input.name];
603
+ }
596
604
  }
597
605
  }
606
+ catch {
607
+ throw new Error(`No se pudo obtener los argumentos para ${inputs}`);
608
+ }
598
609
  }
599
610
  setObject(obj) {
600
611
  for (const field in obj) {
@@ -4,7 +4,7 @@ import { DICTIONARY_FOLDER, getModelFolders } from "./util.js";
4
4
  let _templateEngine;
5
5
  function getTemplateEngine() {
6
6
  if (!_templateEngine) {
7
- _templateEngine = templateGenerator(getModelFolders('dictionary'), "md");
7
+ _templateEngine = templateGenerator(getModelFolders('templates/dictionary'), "md");
8
8
  }
9
9
  return _templateEngine;
10
10
  }
@@ -4,7 +4,7 @@ import { DICTIONARY_FOLDER, getModelFolders } from "./util.js";
4
4
  let _templateEngine;
5
5
  function getTemplateEngine() {
6
6
  if (!_templateEngine) {
7
- _templateEngine = templateGenerator(getModelFolders('dictionary'), "md");
7
+ _templateEngine = templateGenerator(getModelFolders('templates/dictionary'), "md");
8
8
  }
9
9
  return _templateEngine;
10
10
  }
@@ -18,11 +18,11 @@ function generateTemplate(templateFolder, templateExtension, template, context)
18
18
  templateEngine.render(view);
19
19
  return templateEngine.rendered;
20
20
  }
21
- function createTemplate(templateFolder, templateExtension, template, filename, folder, context) {
22
- if (!template || !filename || !templateFolder || !templateExtension) {
21
+ function createTemplate(templateFolders, templateExtension, template, filename, folder, context) {
22
+ if (!template || !filename || !templateFolders || !templateExtension) {
23
23
  return;
24
24
  }
25
- const templateEngine = templateGenerator([templateFolder], templateExtension);
25
+ const templateEngine = templateGenerator(templateFolders, templateExtension);
26
26
  const formulas = {
27
27
  today: Date.now(),
28
28
  filename
@@ -247,15 +247,15 @@ export const taskFunctions = {
247
247
  if (!tryToRetrieve) {
248
248
  return false;
249
249
  }
250
- executeShell(`sf project retrieve start`);
250
+ executeShell("sf project retrieve start");
251
251
  return await this.validateScratch();
252
252
  },
253
253
  async validateScratch() {
254
254
  const salida = executeShell("sf project retrieve preview");
255
255
  context.salida = salida;
256
- const noHayCambios = salida.indexOf('No files will be deleted') !== -1 && salida.indexOf('No files will be retrieved') !== -1 && salida.indexOf('No conflicts found') !== -1;
256
+ context.noHayCambios = salida.indexOf('No files will be deleted') !== -1 && salida.indexOf('No files will be retrieved') !== -1 && salida.indexOf('No conflicts found') !== -1;
257
257
  // Probar de bajarlos // sf project retrieve start
258
- return noHayCambios;
258
+ return context.noHayCambios;
259
259
  },
260
260
  async commitChanges() {
261
261
  const tryToCommit = await askForContinue("Desea commitear los cambios?");
@@ -371,7 +371,7 @@ export const taskFunctions = {
371
371
  },
372
372
  async createTemplate(template, folder, name, identifier) {
373
373
  const filename = name.toLocaleLowerCase().replaceAll(' ', '-') + '.md';
374
- createTemplate('.', 'md', template, filename, folder, { name, identifier });
374
+ createTemplate(getModelFolders('templates'), 'md', template, filename, folder, { name, identifier });
375
375
  return true;
376
376
  },
377
377
  async validateIssue(issueNumber, states) {
@@ -58,7 +58,7 @@ export class TemplateEngine {
58
58
  // Busca en las carpetas el archivo
59
59
  for (const currentFolder of this._sourceFolders) {
60
60
  folder = currentFolder;
61
- const filterWithExtension = (fileName) => fileName === `${name}.${extension}`;
61
+ const filterWithExtension = (fileName) => fileName.endsWith(`/${name}.${extension}`);
62
62
  const filterWithoutExtension = (fileName) => fileName.split(".")[0].endsWith(name);
63
63
  const filter = (extension === '*' || extension === '') ? filterWithoutExtension : filterWithExtension;
64
64
  const fileNames = getFiles(folder, filter);
@@ -141,6 +141,16 @@ async function getBaseConfig(config) {
141
141
  config.backlogColumn = backlogColumn.backlogColumn;
142
142
  logInfo(`Por omision ser utilizan proyectos dentro de ${context.repositoryOwner} y ${context.repositoryRepo} `);
143
143
  }
144
+ // dictionaryFolder
145
+ const dictionaryFolder = await prompts([{
146
+ type: "text",
147
+ name: "dictionaryFolder",
148
+ initial: config.dictionaryFolder,
149
+ message: "Ruta a los modulos de la documentacion (desde el root del proyecto)"
150
+ }]);
151
+ if (dictionaryFolder.dictionaryFolder === undefined)
152
+ return;
153
+ config.dictionaryFolder = dictionaryFolder.dictionaryFolder;
144
154
  // Id de Projecto
145
155
  const projectId = await prompts([{
146
156
  type: "text",
@@ -8,7 +8,6 @@
8
8
  "steps": [
9
9
  { "name": "Actualiza la version", "function": "storeConfig", "arguments": ["version", "${newVersion}"] },
10
10
  { "name": "Paquetiza", "subtask": "pack" },
11
- { "name": "Salida para el Changelog.md", "task": "list", "arguments": {"filter": "milestone", "template": "changelog", "milestone": "v${newVersion}"} },
12
11
  { "name": "Publica", "command": "yarn publish ", "arguments": {"--new-version": "${newVersion}"} },
13
12
  { "name": "Actualiza el milestone", "function": "updateMilestone", "arguments": ["v${newVersion}", "closed"] }
14
13
  ]
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "process",
3
3
  "arguments": {
4
- "folder": { "type": "select", "choices": "${modules}" },
4
+ "folder": { "type": "select", "values": "modules" },
5
5
  "name": { "required": true },
6
6
  "identifier": { "required": true }
7
7
  },
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.26",
5
+ "version": "0.1.27",
6
6
  "keywords": [
7
7
  "Salesforce",
8
8
  "Automation",
@@ -69,5 +69,6 @@
69
69
  "prompts": "^2.4.2"
70
70
  },
71
71
  "author": "Sebastian Claros <sclaros@gmail.com>",
72
- "license": "MIT"
72
+ "license": "MIT",
73
+ "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
73
74
  }