autoforce 0.1.22 → 0.1.23
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 +1 -1
- package/CHANGELOG.md +14 -0
- package/lib/auto.d.ts +1 -1
- package/lib/auto.js +15 -16
- package/lib/helpers/context.d.ts +2 -1
- package/lib/helpers/context.js +20 -14
- package/lib/helpers/taskFunctions.js +0 -1
- package/lib/helpers/util.d.ts +1 -0
- package/lib/helpers/util.js +4 -3
- package/models/dev/npm/tasks/publish.json +1 -1
- package/package.json +1 -1
package/.autoforce.json
CHANGED
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
# Versiones
|
2
2
|
|
3
|
+
0.1.23
|
4
|
+
## Version 0.1.23
|
5
|
+
- Fecha:
|
6
|
+
- Paquete: [Descargar](https://www.npmjs.com/package/autoforce/v/0.1.23)
|
7
|
+
- Cambios:
|
8
|
+
* Bugfixing para la suit de test autoforce-test
|
9
|
+
|
10
|
+
## Version 0.1.22
|
11
|
+
- Fecha:
|
12
|
+
- Paquete: [Descargar](https://www.npmjs.com/package/autoforce/v/0.1.22)
|
13
|
+
- Cambios:
|
14
|
+
* [publish] que cierre el milestone de la version
|
15
|
+
- https://github.com/sebastianclaros/autoforce/issues/35
|
16
|
+
|
3
17
|
## Version 0.1.20
|
4
18
|
- Fecha:
|
5
19
|
- Paquete: [Descargar](https://www.npmjs.com/package/autoforce/v/0.1.20)
|
package/lib/auto.d.ts
CHANGED
package/lib/auto.js
CHANGED
@@ -27,23 +27,22 @@ export default async function main() {
|
|
27
27
|
try {
|
28
28
|
const config = getConfigFromArgs(process.argv.slice(2));
|
29
29
|
const taskCommandKeys = Object.keys(taskCommand);
|
30
|
-
if (taskCommandKeys.includes(config.command)) {
|
31
|
-
const tasks = getTasks(config.subfolder);
|
32
|
-
const taskName = await askForTaskName(config.taskName, tasks);
|
33
|
-
if (taskName) {
|
34
|
-
const task = tasks[taskName];
|
35
|
-
context.options = config.arguments && task.arguments ? { ...config.options, ...createObject(task.arguments, config.arguments) } : config.options;
|
36
|
-
// Valida los json de task y subtask
|
37
|
-
if (validateTask(task)) {
|
38
|
-
await taskCommand[config.command](task, context.options);
|
39
|
-
}
|
40
|
-
else {
|
41
|
-
logError('Verifique que los json de task y subtask esten validos');
|
42
|
-
}
|
43
|
-
}
|
44
|
-
}
|
45
|
-
else {
|
30
|
+
if (!taskCommandKeys.includes(config.command)) {
|
46
31
|
await proxyCommand[config.command](config.taskName, config.options);
|
32
|
+
return true;
|
33
|
+
}
|
34
|
+
const tasks = getTasks(config.subfolder);
|
35
|
+
const taskName = await askForTaskName(config.taskName, tasks);
|
36
|
+
if (taskName) {
|
37
|
+
const task = tasks[taskName];
|
38
|
+
context.options = config.arguments && task.arguments ? { ...config.options, ...createObject(task.arguments, config.arguments) } : config.options;
|
39
|
+
// Valida los json de task y subtask
|
40
|
+
if (validateTask(task)) {
|
41
|
+
await taskCommand[config.command](task, context.options);
|
42
|
+
}
|
43
|
+
else {
|
44
|
+
logError('Verifique que los json de task y subtask esten validos');
|
45
|
+
}
|
47
46
|
}
|
48
47
|
}
|
49
48
|
catch (error) {
|
package/lib/helpers/context.d.ts
CHANGED
@@ -69,7 +69,8 @@ declare class Context implements IObjectRecord {
|
|
69
69
|
loadProjectApi(): void;
|
70
70
|
loadGitApi(): void;
|
71
71
|
loadPackage(): void;
|
72
|
-
|
72
|
+
createConfig(): Promise<boolean | undefined>;
|
73
|
+
loadConfig(): true | undefined;
|
73
74
|
init(): void;
|
74
75
|
get targetOrg(): string;
|
75
76
|
get existBranchScratch(): boolean;
|
package/lib/helpers/context.js
CHANGED
@@ -30,7 +30,7 @@ const filterProcesses = (fullPath) => fullPath.endsWith(".md"); // && !fullPath.
|
|
30
30
|
const ISSUES_TYPES = [{ value: 'feature', title: 'feature' }, { value: 'bug', title: 'bug' }, { value: 'documentation', title: 'documentation' }, { value: 'automation', title: 'automation' }];
|
31
31
|
function searchInFolderHierarchy(element, parentFolder) {
|
32
32
|
if (fs.existsSync(`${parentFolder}/${element}`)) {
|
33
|
-
return
|
33
|
+
return parentFolder;
|
34
34
|
}
|
35
35
|
else {
|
36
36
|
const lastIndex = parentFolder.lastIndexOf('/');
|
@@ -46,9 +46,10 @@ function searchInFolderHierarchy(element, parentFolder) {
|
|
46
46
|
function getDataFromPackage() {
|
47
47
|
const data = {};
|
48
48
|
try {
|
49
|
-
const
|
50
|
-
|
51
|
-
|
49
|
+
const PROJECT_FOLDER = searchInFolderHierarchy('package.json', process.cwd() || '.');
|
50
|
+
const filename = `${PROJECT_FOLDER}/package.json`;
|
51
|
+
if (!fs.existsSync(filename)) {
|
52
|
+
throw new Error("No se encontro el package.json en " + PROJECT_FOLDER);
|
52
53
|
}
|
53
54
|
const content = fs.readFileSync(filename, "utf8");
|
54
55
|
const packageJson = JSON.parse(content);
|
@@ -234,7 +235,7 @@ class Context {
|
|
234
235
|
this.repositoryOwner = data.repositoryOwner;
|
235
236
|
this.repositoryRepo = data.repositoryRepo;
|
236
237
|
}
|
237
|
-
async
|
238
|
+
async createConfig() {
|
238
239
|
if (!fs.existsSync(CONFIG_FILE)) {
|
239
240
|
logWarning('Bienvenido! La herramienta Autoforce necesita un primer paso de configuracion antes de usarla.');
|
240
241
|
logWarning('- Podes usar el asistente ejecutando npx autoforce config');
|
@@ -252,19 +253,24 @@ class Context {
|
|
252
253
|
}
|
253
254
|
return false;
|
254
255
|
}
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
256
|
+
}
|
257
|
+
loadConfig() {
|
258
|
+
if (fs.existsSync(CONFIG_FILE)) {
|
259
|
+
const content = fs.readFileSync(CONFIG_FILE, "utf8");
|
260
|
+
try {
|
261
|
+
const config = JSON.parse(content);
|
262
|
+
for (const key in config) {
|
263
|
+
this.set(key, config[key]);
|
264
|
+
}
|
260
265
|
}
|
266
|
+
catch {
|
267
|
+
throw new Error(`Verifique que el ${CONFIG_FILE} sea json valido`);
|
268
|
+
}
|
269
|
+
return true;
|
261
270
|
}
|
262
|
-
catch {
|
263
|
-
throw new Error(`Verifique que el ${CONFIG_FILE} sea json valido`);
|
264
|
-
}
|
265
|
-
return true;
|
266
271
|
}
|
267
272
|
init() {
|
273
|
+
this.createConfig();
|
268
274
|
this.loadProjectApi();
|
269
275
|
this.loadGitApi();
|
270
276
|
//
|
@@ -316,7 +316,6 @@ export const taskFunctions = {
|
|
316
316
|
if (context.projectApi === undefined || context.gitApi === undefined) {
|
317
317
|
return false;
|
318
318
|
}
|
319
|
-
console.log(title, state, description, dueOn);
|
320
319
|
const result = await context.gitApi.updateMilestone(title, state, description, dueOn);
|
321
320
|
return result?.id ? true : false;
|
322
321
|
},
|
package/lib/helpers/util.d.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import { Choice } from "prompts";
|
2
2
|
import { AnyValue, CommandOptions } from "../types/auto.js";
|
3
3
|
export declare const WORKING_FOLDER: string;
|
4
|
+
export declare const PROJECT_FOLDER: string;
|
4
5
|
export declare const CONFIG_FILE: string;
|
5
6
|
export declare const DICTIONARY_FOLDER: string;
|
6
7
|
export declare const filterJson: (fullPath: string) => boolean;
|
package/lib/helpers/util.js
CHANGED
@@ -3,9 +3,10 @@ import { fileURLToPath } from 'url';
|
|
3
3
|
import prompts from "prompts";
|
4
4
|
import context, { ProjectServices, GitServices } from "./context.js";
|
5
5
|
import { logInfo, logWarning } from "./color.js";
|
6
|
-
const MODELS_FOLDER = searchInFolderHierarchy('models', fileURLToPath(import.meta.url));
|
6
|
+
const MODELS_FOLDER = searchInFolderHierarchy('models', fileURLToPath(import.meta.url)) + '/models';
|
7
7
|
export const WORKING_FOLDER = process.env.INIT_CWD || ".";
|
8
|
-
export const
|
8
|
+
export const PROJECT_FOLDER = searchInFolderHierarchy('package.json', WORKING_FOLDER);
|
9
|
+
export const CONFIG_FILE = PROJECT_FOLDER + '/.autoforce.json';
|
9
10
|
export const DICTIONARY_FOLDER = process.cwd() + "/docs"; // context.dictionaryFolder;
|
10
11
|
export const filterJson = (fullPath) => fullPath.endsWith(".json");
|
11
12
|
export const filterDirectory = (fullPath) => fs.lstatSync(fullPath).isDirectory();
|
@@ -259,7 +260,7 @@ export function addNewItems(baseArray, newArray) {
|
|
259
260
|
}
|
260
261
|
export function searchInFolderHierarchy(element, parentFolder) {
|
261
262
|
if (fs.existsSync(`${parentFolder}/${element}`)) {
|
262
|
-
return
|
263
|
+
return parentFolder;
|
263
264
|
}
|
264
265
|
else {
|
265
266
|
const lastIndex = parentFolder.lastIndexOf('/');
|
@@ -8,8 +8,8 @@
|
|
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}"} },
|
11
12
|
{ "name": "Publica", "command": "yarn publish ", "arguments": {"--new-version": "${newVersion}"} },
|
12
|
-
{ "name": "Salida para el Changelog.md", "task": "list", "arguments": {"filter": "milestone", "template": "changelog", "milestone": "${newVersion}"} },
|
13
13
|
{ "name": "Actualiza el milestone", "function": "updateMilestone", "arguments": ["v${newVersion}", "closed"] }
|
14
14
|
]
|
15
15
|
}
|