proceger 2.0.6 → 2.0.8
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/.eslintrc.js +4 -1
- package/.github/workflows/node.js.yml +1 -1
- package/.github/workflows/npm-publish.yml +2 -2
- package/lib/git.js +16 -7
- package/lib/task.js +9 -4
- package/package.json +3 -2
package/.eslintrc.js
CHANGED
|
@@ -14,7 +14,7 @@ jobs:
|
|
|
14
14
|
- uses: actions/checkout@v2
|
|
15
15
|
- uses: actions/setup-node@v1
|
|
16
16
|
with:
|
|
17
|
-
node-version:
|
|
17
|
+
node-version: 25
|
|
18
18
|
- run: npm ci
|
|
19
19
|
- run: npm test
|
|
20
20
|
|
|
@@ -25,7 +25,7 @@ jobs:
|
|
|
25
25
|
- uses: actions/checkout@v2
|
|
26
26
|
- uses: actions/setup-node@v1
|
|
27
27
|
with:
|
|
28
|
-
node-version:
|
|
28
|
+
node-version: 25
|
|
29
29
|
registry-url: https://registry.npmjs.org/
|
|
30
30
|
- run: npm ci
|
|
31
31
|
- run: npm publish
|
package/lib/git.js
CHANGED
|
@@ -27,6 +27,7 @@ class GitRepo {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
async init() {
|
|
30
|
+
let newRepo = false;
|
|
30
31
|
try {
|
|
31
32
|
await fs.readdir(this.#repoPath);
|
|
32
33
|
} catch (e) {
|
|
@@ -37,8 +38,11 @@ class GitRepo {
|
|
|
37
38
|
`Directory does not exist, cloning repostory from ${this.#url}.`);
|
|
38
39
|
await fs.mkdir(path.dirname(this.#repoPath), {recursive: true});
|
|
39
40
|
await git(path.dirname(this.#repoPath)).clone(this.#url);
|
|
41
|
+
newRepo = true;
|
|
40
42
|
}
|
|
41
43
|
this.#git = git(this.#repoPath);
|
|
44
|
+
this.#revision = await this.#git.revparse('HEAD');
|
|
45
|
+
return newRepo;
|
|
42
46
|
}
|
|
43
47
|
|
|
44
48
|
async update() {
|
|
@@ -48,14 +52,19 @@ class GitRepo {
|
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
logger.info(`Pulling updates for "${this.#repoPath}" from "${this.#url}".`);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
try {
|
|
56
|
+
await this.#git.pull();
|
|
57
|
+
const revision = await this.#git.revparse('HEAD');
|
|
58
|
+
if (revision === this.#revision) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
logger.info(`Got new revision, old=${this.revision}, new=${revision}.`);
|
|
62
|
+
this.#revision = revision;
|
|
63
|
+
return true;
|
|
64
|
+
} catch (e) {
|
|
65
|
+
logger.error('Unable to pull update from git repo.', e);
|
|
55
66
|
}
|
|
56
|
-
|
|
57
|
-
this.#revision = revision;
|
|
58
|
-
return true;
|
|
67
|
+
return false;
|
|
59
68
|
}
|
|
60
69
|
}
|
|
61
70
|
|
package/lib/task.js
CHANGED
|
@@ -47,6 +47,10 @@ class Task {
|
|
|
47
47
|
logger.info(`Task(${this.#name}): ${message}`);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
logDebug(message) {
|
|
51
|
+
logger.debug(`Task(${this.#name}): ${message}`);
|
|
52
|
+
}
|
|
53
|
+
|
|
50
54
|
updateStatus(status) {
|
|
51
55
|
this.logInfo(`Transisting from ${this.#status} to ${status}.`);
|
|
52
56
|
this.#status = status;
|
|
@@ -74,9 +78,10 @@ class Task {
|
|
|
74
78
|
async startImpl() {
|
|
75
79
|
this.updateStatus('STARTING');
|
|
76
80
|
this.logInfo(`Initializing git repository...`);
|
|
77
|
-
await this.#git.init();
|
|
78
|
-
|
|
79
|
-
|
|
81
|
+
const newRepo = await this.#git.init();
|
|
82
|
+
if (newRepo) {
|
|
83
|
+
await this.runCommand('npm ci', true);
|
|
84
|
+
}
|
|
80
85
|
if (this.#child !== null) {
|
|
81
86
|
kill(this.#child.pid);
|
|
82
87
|
this.#child = null;
|
|
@@ -155,7 +160,7 @@ class Task {
|
|
|
155
160
|
child.stdout.on('data', (data) => {
|
|
156
161
|
for (const line of data.toString().split('\n')) {
|
|
157
162
|
if (line) {
|
|
158
|
-
this.
|
|
163
|
+
this.logDebug(`${command} > ${line}`);
|
|
159
164
|
}
|
|
160
165
|
}
|
|
161
166
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "proceger",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.8",
|
|
4
4
|
"description": "A process manager with web interface.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -33,7 +33,8 @@
|
|
|
33
33
|
"winston-daily-rotate-file": "^4.5.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"babel
|
|
36
|
+
"@babel/core": "^7.28.5",
|
|
37
|
+
"@babel/eslint-parser": "^7.28.5",
|
|
37
38
|
"chai": "^3.5.0",
|
|
38
39
|
"chai-as-promised": "^5.3.0",
|
|
39
40
|
"eslint": "^7.19.0",
|