luca 1.1.1 → 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 CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Tiny [NPM package](https://www.npmjs.com/package/luca) to check urls by name list and getting statuses.
4
4
 
5
+ <img src="./logo.png" alt="luca" width="256"/>
6
+
5
7
  ## Installation
6
8
 
7
9
  - For cli usage install the package globally `npm i luca -g`
@@ -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(`Finished:\n> ${consts_1.LOG_PATH}`));
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) {
@@ -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;
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "dist"
17
17
  ],
18
18
  "license": "MIT",
19
- "version": "1.1.1",
19
+ "version": "1.1.2",
20
20
  "scripts": {
21
21
  "build": "tsc",
22
22
  "dev": "tsc-watch ./src/dev.ts --outDir ./dist/ --onSuccess \"node ./dist/dev.js\" --esModuleInterop",