qase-javascript-commons 2.2.2 → 2.2.3
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/changelog.md +6 -0
- package/dist/state/state.d.ts +1 -0
- package/dist/state/state.js +9 -5
- package/package.json +1 -1
package/changelog.md
CHANGED
package/dist/state/state.d.ts
CHANGED
package/dist/state/state.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
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
6
|
exports.StateManager = void 0;
|
|
4
7
|
const fs_1 = require("fs");
|
|
5
|
-
const
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
6
9
|
class StateManager {
|
|
7
10
|
static getState() {
|
|
8
11
|
let state = {
|
|
@@ -11,7 +14,7 @@ class StateManager {
|
|
|
11
14
|
IsModeChanged: undefined,
|
|
12
15
|
};
|
|
13
16
|
try {
|
|
14
|
-
const data = (0, fs_1.readFileSync)(statePath, 'utf8');
|
|
17
|
+
const data = (0, fs_1.readFileSync)(this.statePath, 'utf8');
|
|
15
18
|
state = JSON.parse(data);
|
|
16
19
|
}
|
|
17
20
|
catch (err) {
|
|
@@ -38,7 +41,7 @@ class StateManager {
|
|
|
38
41
|
static setState(state) {
|
|
39
42
|
try {
|
|
40
43
|
const data = JSON.stringify(state);
|
|
41
|
-
(0, fs_1.writeFileSync)(statePath, data);
|
|
44
|
+
(0, fs_1.writeFileSync)(this.statePath, data);
|
|
42
45
|
}
|
|
43
46
|
catch (err) {
|
|
44
47
|
console.error('Error writing state file:', err);
|
|
@@ -46,14 +49,15 @@ class StateManager {
|
|
|
46
49
|
}
|
|
47
50
|
static clearState() {
|
|
48
51
|
try {
|
|
49
|
-
(0, fs_1.unlinkSync)(statePath);
|
|
52
|
+
(0, fs_1.unlinkSync)(this.statePath);
|
|
50
53
|
}
|
|
51
54
|
catch (err) {
|
|
52
55
|
console.error('Error clearing state file:', err);
|
|
53
56
|
}
|
|
54
57
|
}
|
|
55
58
|
static isStateExists() {
|
|
56
|
-
return (0, fs_1.existsSync)(statePath);
|
|
59
|
+
return (0, fs_1.existsSync)(this.statePath);
|
|
57
60
|
}
|
|
58
61
|
}
|
|
59
62
|
exports.StateManager = StateManager;
|
|
63
|
+
StateManager.statePath = path_1.default.resolve(__dirname, 'reporterState.json');
|