@vroskus/library-health 1.0.3 → 1.0.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vroskus/library-health",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Health",
5
5
  "author": "Vilius Roškus <vilius@regattas.eu>",
6
6
  "license": "MIT",
@@ -9,19 +9,22 @@
9
9
  "url": "git+https://github.com/vroskus/library-health.git"
10
10
  },
11
11
  "main": "dist/index.js",
12
+ "types": "dist/index.d.ts",
13
+ "files": [
14
+ "dist/"
15
+ ],
12
16
  "scripts": {
13
- "postinstall": "npm run build",
14
17
  "build": "tsc",
15
18
  "test": "npm run test:eslint && npm run test:e2e",
16
19
  "test:eslint": "eslint src --fix",
17
20
  "test:e2e": "echo 'No tests'"
18
21
  },
19
22
  "dependencies": {
23
+ "@types/express": "4.17.17",
20
24
  "express": "4.18.2",
21
25
  "node-os-utils": "1.3.7"
22
26
  },
23
27
  "devDependencies": {
24
- "@types/express": "4.17.17",
25
28
  "@types/jest": "29.5.0",
26
29
  "@types/node": "18.15.11",
27
30
  "@typescript-eslint/eslint-plugin": "5.58.0",
@@ -34,6 +37,6 @@
34
37
  "eslint-plugin-react": "7.32.2",
35
38
  "eslint-plugin-sort": "2.7.1",
36
39
  "npm-check": "6.0.1",
37
- "typescript": "4.9.5"
40
+ "typescript": "5.0.4"
38
41
  }
39
42
  }
package/.eslintrc DELETED
@@ -1,77 +0,0 @@
1
- {
2
- "root": true,
3
- "parser": "@typescript-eslint/parser",
4
- "parserOptions": {
5
- "requireConfigFile": false,
6
- "project": ["tsconfig.json"]
7
- },
8
- "extends": [
9
- "airbnb-base",
10
- "airbnb-typescript",
11
- "plugin:import/recommended",
12
- "plugin:@typescript-eslint/eslint-recommended",
13
- "plugin:@typescript-eslint/recommended",
14
- "plugin:sort/recommended"
15
- ],
16
- "plugins": [
17
- "@typescript-eslint",
18
- "import",
19
- "import-newlines",
20
- "react",
21
- "sort"
22
- ],
23
- "rules": {
24
- "complexity": ["error", 5],
25
- "@typescript-eslint/ban-ts-comment": [1],
26
- "@typescript-eslint/no-unused-vars": [2],
27
- "curly": ["error", "all"],
28
- "import/no-cycle": [0],
29
- "no-await-in-loop": 0,
30
- "no-console": "error",
31
- "no-duplicate-imports": [0],
32
- "no-loss-of-precision": [0],
33
- "no-restricted-syntax": 0,
34
- "no-unreachable-loop": [0],
35
- "no-useless-backreference": [0],
36
- "no-unused-private-class-members": [2],
37
- "padding-line-between-statements": ["error", {
38
- "blankLine": "always",
39
- "prev": ["const", "let"],
40
- "next": "*"
41
- }, {
42
- "blankLine": "any",
43
- "prev": ["const", "let"],
44
- "next": ["const", "let"]
45
- }, {
46
- "blankLine": "always",
47
- "prev": ["if", "function", "for"],
48
- "next": "*"
49
- }, {
50
- "blankLine": "always",
51
- "prev": "*",
52
- "next": "return"
53
- }],
54
- "object-curly-newline": ["error", {
55
- "ObjectExpression": "always",
56
- "ObjectPattern": "always",
57
- "ImportDeclaration": "always",
58
- "ExportDeclaration": "always"
59
- }],
60
- "function-call-argument-newline": ["error", "always"],
61
- "object-property-newline": ["error", {
62
- "allowMultiplePropertiesPerLine": false
63
- }],
64
- "import-newlines/enforce": ["error", {
65
- "items": 1,
66
- "forceSingleLine": false
67
- }],
68
- "sort/imports": [0],
69
- "sort/exports": [0]
70
- },
71
- "env": {
72
- "browser": true,
73
- "node": true,
74
- "jest": true,
75
- "es6": true
76
- }
77
- }
package/src/index.ts DELETED
@@ -1,62 +0,0 @@
1
- /* eslint-disable import/prefer-default-export */
2
- // Global Types
3
- import type {
4
- Request as $Request,
5
- Response as $Response,
6
- } from 'express';
7
-
8
- // Helpers
9
- import os from 'os';
10
- import osUtils from 'node-os-utils'; // Types
11
-
12
- type $LoadValue = Array<number>;
13
- type $DiskValue = {
14
- freeGb: string;
15
- freePercentage: string;
16
- totalGb: string;
17
- usedGb: string;
18
- usedPercentage: string;
19
- };
20
- type $MemValue = {
21
- freeMemMb: number;
22
- freeMemPercentage: number;
23
- totalMemMb: number;
24
- usedMemMb: number;
25
- };
26
- type $UptimeValue = {
27
- container: number;
28
- os: number;
29
- };
30
- type $SystemValues = {
31
- disk: $DiskValue;
32
- load: $LoadValue;
33
- mem: $MemValue;
34
- uptime: $UptimeValue;
35
- };
36
-
37
- type $GetSystemValues = () => Promise<$SystemValues>;
38
-
39
- const getSystemValues: $GetSystemValues = async () => {
40
- const load = await osUtils.cpu.loadavg();
41
- const disk = await osUtils.drive.info();
42
- const mem = await osUtils.mem.info();
43
- const uptime = {
44
- container: process.uptime(),
45
- os: os.uptime(),
46
- };
47
-
48
- return {
49
- disk,
50
- load,
51
- mem,
52
- uptime,
53
- };
54
- };
55
-
56
- type $HealthRoute = (req: $Request, res: $Response) => Promise<void>;
57
-
58
- export const healthRoute: $HealthRoute = async (req, res) => {
59
- const output = await getSystemValues();
60
-
61
- res.json(output);
62
- };
package/tsconfig.json DELETED
@@ -1,25 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "outDir": "./dist/",
4
- "module": "commonjs",
5
- "esModuleInterop": true,
6
- "declaration": true,
7
- "noImplicitAny": false,
8
- "removeComments": true,
9
- "noLib": false,
10
- "emitDecoratorMetadata": true,
11
- "experimentalDecorators": true,
12
- "target": "es6",
13
- "sourceMap": true,
14
- "lib": [
15
- "es6"
16
- ]
17
- },
18
- "exclude": [
19
- "node_modules",
20
- "./dist/**/*"
21
- ],
22
- "include": [
23
- "./src"
24
- ]
25
- }