luca 1.1.0 → 1.1.2
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/README.md +2 -0
- package/dist/config/initConfig.js +1 -1
- package/dist/config/runConfig.js +6 -3
- package/dist/config/types.d.ts +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ const path = __importStar(require("path"));
|
|
|
42
42
|
const consts_1 = require("./consts");
|
|
43
43
|
const initConfig = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
44
44
|
try {
|
|
45
|
-
yield fs.copyFile(path.resolve(
|
|
45
|
+
yield fs.copyFile(path.resolve(__dirname, `default.js`), consts_1.CONFIG_PATH);
|
|
46
46
|
console.log(chalk_1.default.green(`Configuration file was created:\n> ${consts_1.CONFIG_PATH}`));
|
|
47
47
|
}
|
|
48
48
|
catch (e) {
|
package/dist/config/runConfig.js
CHANGED
|
@@ -82,13 +82,16 @@ const writeToLog = (...strs) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
82
82
|
yield fs.appendFile(consts_1.LOG_PATH, '\n' + strs.join('\n'));
|
|
83
83
|
});
|
|
84
84
|
// TODO: run from last log element
|
|
85
|
+
// TODO: add log name --name
|
|
85
86
|
const runConfig = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
86
87
|
try {
|
|
87
88
|
const config = (0, openConfig_1.openConfig)();
|
|
88
89
|
const { baseUrl, items, query } = config;
|
|
89
|
-
log(chalk_1.default.blue('Luca is running...'));
|
|
90
|
-
yield writeToLog('Start session', `time: ${new Date()}`);
|
|
91
90
|
const total = items.length;
|
|
91
|
+
const axmTime = total * (config.delay + 300);
|
|
92
|
+
const axmMin = Math.floor(axmTime / 60000);
|
|
93
|
+
log(chalk_1.default.blue('Luca starts a session'), `approximate end in ${axmMin} minutes`);
|
|
94
|
+
yield writeToLog('Start session', `time: ${new Date()}`);
|
|
92
95
|
let index = 0;
|
|
93
96
|
for (const item of items) {
|
|
94
97
|
const num = (index += 1);
|
|
@@ -104,7 +107,7 @@ const runConfig = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
104
107
|
yield (0, utils_1.wait)(config.delay);
|
|
105
108
|
}
|
|
106
109
|
}
|
|
107
|
-
log(chalk_1.default.green(`
|
|
110
|
+
log(chalk_1.default.green(`Luca finished:\n> ${consts_1.LOG_PATH}`));
|
|
108
111
|
writeToLog(`\nEnd session`, `time: ${new Date()}`, '');
|
|
109
112
|
}
|
|
110
113
|
catch (e) {
|
package/dist/config/types.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { AxiosResponse } from 'axios';
|
|
2
2
|
export interface TConfig<T = unknown> {
|
|
3
3
|
baseUrl: string;
|
|
4
|
-
items: T[];
|
|
5
|
-
delay: number;
|
|
6
4
|
query: (baseUrl: string, item: T) => string;
|
|
5
|
+
/** ms delay after request */
|
|
6
|
+
delay: number;
|
|
7
7
|
handler: (response: AxiosResponse | null, item: T) => any;
|
|
8
|
+
items: T[];
|
|
8
9
|
}
|
|
9
10
|
export interface THandledData<T = unknown> {
|
|
10
11
|
status: number | null;
|