@routr/common 2.0.31 → 2.1.0
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/dist/assertions.d.ts +5 -0
- package/dist/assertions.js +16 -1
- package/package.json +2 -2
package/dist/assertions.d.ts
CHANGED
|
@@ -4,3 +4,8 @@
|
|
|
4
4
|
* @param {string[]} variables environment variables to check
|
|
5
5
|
*/
|
|
6
6
|
export declare function assertEnvsAreSet(variables: string[]): void;
|
|
7
|
+
/**
|
|
8
|
+
* Function that asserts that the given file exists.
|
|
9
|
+
* @param {string} file file to check
|
|
10
|
+
*/
|
|
11
|
+
export declare function assertFileExist(file: string): void;
|
package/dist/assertions.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.assertEnvsAreSet = void 0;
|
|
6
|
+
exports.assertFileExist = exports.assertEnvsAreSet = void 0;
|
|
4
7
|
/*
|
|
5
8
|
* Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
|
|
6
9
|
* http://github.com/fonoster/routr
|
|
@@ -20,6 +23,7 @@ exports.assertEnvsAreSet = void 0;
|
|
|
20
23
|
* limitations under the License.
|
|
21
24
|
*/
|
|
22
25
|
const logger_1 = require("@fonoster/logger");
|
|
26
|
+
const fs_1 = __importDefault(require("fs"));
|
|
23
27
|
const logger = (0, logger_1.getLogger)({ service: "common", filePath: __filename });
|
|
24
28
|
/**
|
|
25
29
|
* Function that asserts that the given environment variable is set.
|
|
@@ -35,3 +39,14 @@ function assertEnvsAreSet(variables) {
|
|
|
35
39
|
});
|
|
36
40
|
}
|
|
37
41
|
exports.assertEnvsAreSet = assertEnvsAreSet;
|
|
42
|
+
/**
|
|
43
|
+
* Function that asserts that the given file exists.
|
|
44
|
+
* @param {string} file file to check
|
|
45
|
+
*/
|
|
46
|
+
function assertFileExist(file) {
|
|
47
|
+
if (!fs_1.default.existsSync(file)) {
|
|
48
|
+
logger.error(`the file ${file} does not exist`);
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.assertFileExist = assertFileExist;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@routr/common",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Common package",
|
|
5
5
|
"author": "Pedro Sanders <psanders@fonoster.com>",
|
|
6
6
|
"homepage": "https://github.com/fonoster/routr#readme",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/js-yaml": "^4.0.5"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "0e75c7950157dcb7701082655259a87da322c29d"
|
|
59
59
|
}
|