autoforce 0.1.26 → 0.1.28
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 +3 -2
- package/CHANGELOG.md +7 -0
- package/README.md +4 -4
- package/lib/helpers/class.js +1 -1
- package/lib/helpers/context.d.ts +4 -3
- package/lib/helpers/context.js +22 -13
- package/lib/helpers/lwc.js +1 -1
- package/lib/helpers/object.js +1 -1
- package/lib/helpers/taskFunctions.js +7 -7
- package/lib/helpers/template.js +1 -1
- package/lib/helpers/util.js +10 -0
- package/models/dev/npm/subtasks/postpack.json +11 -0
- package/models/dev/npm/subtasks/{pack.json → prepack.json} +7 -12
- package/models/doc/processes/new/process.json +1 -1
- package/package.json +6 -4
- /package/models/doc/processes/{subtask → subtasks}/update-documentation.json +0 -0
package/.autoforce.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
{
|
2
|
-
"version": "0.1.
|
2
|
+
"version": "0.1.28",
|
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
|
}
|
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
@@ -126,14 +126,14 @@ La guia del readme sirve de ejemplo.
|
|
126
126
|
|
127
127
|
## Testear una version en forma local
|
128
128
|
|
129
|
-
Para hacer un testeo local se puede generar una version nueva
|
129
|
+
Para hacer un testeo local se puede generar una version nueva. Esto pide un nro de version arma el package en root como autoforce-latest.tgz
|
130
130
|
|
131
131
|
```
|
132
|
-
yarn
|
132
|
+
yarn pack
|
133
133
|
```
|
134
134
|
|
135
|
-
|
135
|
+
Despues en el repositorio local autoforce-test, hay un script que lo instala.
|
136
136
|
|
137
137
|
```
|
138
|
-
|
138
|
+
./scripts/test/upgrade-local.sh
|
139
139
|
```
|
package/lib/helpers/class.js
CHANGED
@@ -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
|
}
|
package/lib/helpers/context.d.ts
CHANGED
@@ -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,11 @@ 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
|
-
|
87
|
-
get modules(): PromptChoices;
|
88
|
+
modulesFolders(): PromptChoices;
|
88
89
|
get existScratch(): boolean;
|
89
90
|
get scratch(): OrganizationInfo;
|
90
91
|
validate(guards: string[]): Promise<void>;
|
package/lib/helpers/context.js
CHANGED
@@ -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 = {};
|
@@ -364,11 +370,9 @@ class Context {
|
|
364
370
|
}
|
365
371
|
return retArray;
|
366
372
|
}
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
get modules() {
|
371
|
-
return this.getModules().map(module => { return { value: module, title: module }; });
|
373
|
+
modulesFolders() {
|
374
|
+
const folders = getFiles(this.dictionaryFolder, filterDirectory, true, ['diccionarios', 'src', '.docusaurus', 'node_modules']).sort();
|
375
|
+
return folders.map(module => { return { value: this.dictionaryFolder + '/' + module, title: module.replaceAll('/', ' > ') }; });
|
372
376
|
}
|
373
377
|
get existScratch() {
|
374
378
|
return typeof this.scratch !== 'undefined';
|
@@ -553,7 +557,7 @@ class Context {
|
|
553
557
|
}
|
554
558
|
return inputsArray;
|
555
559
|
}
|
556
|
-
async askForExit() {
|
560
|
+
async askForExit( /* prompt: PromptObject */) {
|
557
561
|
const answer = await prompts([
|
558
562
|
{
|
559
563
|
type: "confirm",
|
@@ -587,14 +591,19 @@ class Context {
|
|
587
591
|
}
|
588
592
|
async askForArguments(inputs) {
|
589
593
|
// unifica los dos tipos de inputs (array y objeto) en un array de inputs
|
590
|
-
|
591
|
-
|
592
|
-
const
|
593
|
-
|
594
|
-
|
595
|
-
|
594
|
+
try {
|
595
|
+
const inputsArray = await this.convertToArrayOfInputs(inputs);
|
596
|
+
for (const input of inputsArray) {
|
597
|
+
const hasValue = await this.get(input.name);
|
598
|
+
if (!hasValue) {
|
599
|
+
const answer = await prompts([input], { onCancel: this.askForExit });
|
600
|
+
this[input.name] = answer[input.name];
|
601
|
+
}
|
596
602
|
}
|
597
603
|
}
|
604
|
+
catch {
|
605
|
+
throw new Error(`No se pudo obtener los argumentos para ${inputs}`);
|
606
|
+
}
|
598
607
|
}
|
599
608
|
setObject(obj) {
|
600
609
|
for (const field in obj) {
|
package/lib/helpers/lwc.js
CHANGED
@@ -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
|
}
|
package/lib/helpers/object.js
CHANGED
@@ -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(
|
22
|
-
if (!template || !filename || !
|
21
|
+
function createTemplate(templateFolders, templateExtension, template, filename, folder, context) {
|
22
|
+
if (!template || !filename || !templateFolders || !templateExtension) {
|
23
23
|
return;
|
24
24
|
}
|
25
|
-
const templateEngine = templateGenerator(
|
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(
|
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
|
-
|
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('
|
374
|
+
createTemplate(getModelFolders('templates'), 'md', template, filename, folder, { name, identifier });
|
375
375
|
return true;
|
376
376
|
},
|
377
377
|
async validateIssue(issueNumber, states) {
|
package/lib/helpers/template.js
CHANGED
@@ -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
|
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);
|
package/lib/helpers/util.js
CHANGED
@@ -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",
|
@@ -1,10 +1,14 @@
|
|
1
1
|
{
|
2
|
-
"name": "
|
3
|
-
"
|
2
|
+
"name": "prepack",
|
3
|
+
"arguments": {
|
4
|
+
"newVersion": { "required": true, "default": "${version}" }
|
5
|
+
},
|
6
|
+
"description": "Comando para previo al pack",
|
4
7
|
"steps": [
|
8
|
+
{ "name": "Actualiza la version", "function": "storeConfig", "arguments": ["version", "${newVersion}"] },
|
5
9
|
{
|
6
10
|
"name": "Borra el paquete",
|
7
|
-
"command": "rm autoforce*.tgz",
|
11
|
+
"command": "rm -f autoforce*.tgz",
|
8
12
|
"onError": "skip"
|
9
13
|
},
|
10
14
|
{
|
@@ -15,15 +19,6 @@
|
|
15
19
|
{
|
16
20
|
"name": "Compila el typescript",
|
17
21
|
"command": "tsc --project tsconfig.build.json"
|
18
|
-
},
|
19
|
-
{
|
20
|
-
"name": "Arma el paquete",
|
21
|
-
"command": "yarn pack"
|
22
|
-
},
|
23
|
-
{
|
24
|
-
"name": "Renombra paquete",
|
25
|
-
"command": "mv autoforce*.tgz autoforce.tgz"
|
26
22
|
}
|
27
23
|
]
|
28
24
|
}
|
29
|
-
|
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.28",
|
6
6
|
"keywords": [
|
7
7
|
"Salesforce",
|
8
8
|
"Automation",
|
@@ -27,9 +27,10 @@
|
|
27
27
|
"scripts": {
|
28
28
|
"prebuild": "rm -rf ./lib/",
|
29
29
|
"build": "tsc --project tsconfig.build.json",
|
30
|
+
"prepack": "npx autoforce subtask prepack",
|
31
|
+
"postpack": "npx autoforce subtask postpack",
|
30
32
|
"prettier": "prettier --write \"**/*.{css,html,js,json,ts,md,xml,yaml,yml}\"",
|
31
|
-
"test:build": "yarn build &&
|
32
|
-
"test:package": "yarn build && npm publish --dry-run && node ./bin/index.js",
|
33
|
+
"test:build": "yarn build && node ./bin/index.js",
|
33
34
|
"test": "vitest"
|
34
35
|
},
|
35
36
|
"devDependencies": {
|
@@ -69,5 +70,6 @@
|
|
69
70
|
"prompts": "^2.4.2"
|
70
71
|
},
|
71
72
|
"author": "Sebastian Claros <sclaros@gmail.com>",
|
72
|
-
"license": "MIT"
|
73
|
+
"license": "MIT",
|
74
|
+
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
73
75
|
}
|
File without changes
|