@tywalk/pcf-helper 1.4.10 → 1.4.11
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 +1 -1
- package/tasks/build-pcf.js +4 -5
- package/tasks/import-pcf.js +4 -5
- package/tasks/upgrade-pcf.js +4 -5
- package/util/performanceUtil.js +13 -1
package/package.json
CHANGED
package/tasks/build-pcf.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const { spawnSync } = require('child_process');
|
|
2
|
-
const { formatMsToSec } = require('../util/performanceUtil');
|
|
2
|
+
const { formatMsToSec, formatTime } = require('../util/performanceUtil');
|
|
3
3
|
|
|
4
4
|
function run(path) {
|
|
5
|
-
console.log('[PCF Helper] Starting build...\n');
|
|
5
|
+
console.log('[PCF Helper] ' + formatTime(new Date()) + ' Starting build...\n');
|
|
6
6
|
const tick = performance.now();
|
|
7
7
|
const task = spawnSync('dotnet build', ['--restore', '-c', 'Release', path], {
|
|
8
8
|
cwd: process.cwd(),
|
|
@@ -14,6 +14,7 @@ function run(path) {
|
|
|
14
14
|
|
|
15
15
|
if (task.status === 0) {
|
|
16
16
|
console.log('[PCF Helper] Build complete!');
|
|
17
|
+
console.log(formatMsToSec('[PCF Helper] ' + formatTime(new Date()) + ' Build finished in %is.\n', tock - tick));
|
|
17
18
|
} else {
|
|
18
19
|
if (task.error) {
|
|
19
20
|
if (task.signal === 'SIGTERM') {
|
|
@@ -25,10 +26,8 @@ function run(path) {
|
|
|
25
26
|
} else {
|
|
26
27
|
console.error('[PCF Helper] Unable to complete build: One or more errors ocurred.');
|
|
27
28
|
}
|
|
28
|
-
|
|
29
|
-
// process.kill(task.pid);
|
|
29
|
+
console.log(formatMsToSec('[PCF Helper] ' + formatTime(new Date()) + ' Build finished with errors in %is.\n', tock - tick));
|
|
30
30
|
}
|
|
31
|
-
console.log(formatMsToSec('[PCF Helper] Build finished in %is.\n', tock - tick));
|
|
32
31
|
return task.status;
|
|
33
32
|
}
|
|
34
33
|
|
package/tasks/import-pcf.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
const { spawnSync } = require('child_process');
|
|
2
2
|
const { join, extname } = require('path');
|
|
3
3
|
const fs = require('fs');
|
|
4
|
-
const { formatMsToSec } = require('../util/performanceUtil');
|
|
4
|
+
const { formatMsToSec, formatTime } = require('../util/performanceUtil');
|
|
5
5
|
|
|
6
6
|
function run(path, env, verbose) {
|
|
7
|
-
console.log('[PCF Helper] Starting import...\n');
|
|
7
|
+
console.log('[PCF Helper] ' + formatTime(new Date()) + ' Starting import...\n');
|
|
8
8
|
const tick = performance.now();
|
|
9
9
|
if (!env) {
|
|
10
10
|
console.warn('Path argument not provided. Assuming active auth profile organization.');
|
|
@@ -26,6 +26,7 @@ function run(path, env, verbose) {
|
|
|
26
26
|
|
|
27
27
|
if (task.status === 0) {
|
|
28
28
|
console.log('[PCF Helper] Import complete!');
|
|
29
|
+
console.log(formatMsToSec('[PCF Helper] ' + formatTime(new Date()) + ' Import finished in %is.\n', tock - tick));
|
|
29
30
|
} else {
|
|
30
31
|
if (task.error) {
|
|
31
32
|
if (task.signal === 'SIGTERM') {
|
|
@@ -39,10 +40,8 @@ function run(path, env, verbose) {
|
|
|
39
40
|
} else {
|
|
40
41
|
console.error('[PCF Helper] Unable to complete import: One or more errors ocurred.');
|
|
41
42
|
}
|
|
42
|
-
|
|
43
|
-
// process.kill(task.pid);
|
|
43
|
+
console.log(formatMsToSec('[PCF Helper] ' + formatTime(new Date()) + ' Import finished with errors in %is.\n', tock - tick));
|
|
44
44
|
}
|
|
45
|
-
console.log(formatMsToSec('[PCF Helper] Import finished in %is.\n', tock - tick));
|
|
46
45
|
return task.status;
|
|
47
46
|
}
|
|
48
47
|
|
package/tasks/upgrade-pcf.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const { spawnSync } = require('child_process');
|
|
2
|
-
const { formatMsToSec } = require('../util/performanceUtil');
|
|
2
|
+
const { formatMsToSec, formatTime } = require('../util/performanceUtil');
|
|
3
3
|
|
|
4
4
|
function run(path) {
|
|
5
|
-
console.log('[PCF Helper] Starting upgrade...\n');
|
|
5
|
+
console.log('[PCF Helper] ' + formatTime(new Date()) + ' Starting upgrade...\n');
|
|
6
6
|
const tick = performance.now();
|
|
7
7
|
const task = spawnSync(`pac solution version -s Solution -sp ${path} && pac pcf version -s Manifest && npm version patch --no-git-tag-version`, {
|
|
8
8
|
cwd: process.cwd(),
|
|
@@ -14,6 +14,7 @@ function run(path) {
|
|
|
14
14
|
|
|
15
15
|
if (task.status === 0) {
|
|
16
16
|
console.log('[PCF Helper] Upgrade complete!');
|
|
17
|
+
console.log(formatMsToSec('[PCF Helper] ' + formatTime(new Date()) + ' Upgrade finished in %is.\n', tock - tick));
|
|
17
18
|
} else {
|
|
18
19
|
if (task.error) {
|
|
19
20
|
if (task.signal === 'SIGTERM') {
|
|
@@ -25,10 +26,8 @@ function run(path) {
|
|
|
25
26
|
} else {
|
|
26
27
|
console.error('[PCF Helper] Unable to complete upgrade: One or more errors ocurred.');
|
|
27
28
|
}
|
|
28
|
-
|
|
29
|
-
// process.kill(task.pid);
|
|
29
|
+
console.log(formatMsToSec('[PCF Helper] ' + formatTime(new Date()) + ' Upgrade finished with errors in %is.\n', tock - tick));
|
|
30
30
|
}
|
|
31
|
-
console.log(formatMsToSec('[PCF Helper] Upgrade finished in %is.\n', tock - tick));
|
|
32
31
|
return task.status;
|
|
33
32
|
}
|
|
34
33
|
|
package/util/performanceUtil.js
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
const util = require('node:util');
|
|
2
2
|
|
|
3
|
+
var formatter = new Intl.DateTimeFormat('en-US', {
|
|
4
|
+
hour: '2-digit',
|
|
5
|
+
minute: '2-digit',
|
|
6
|
+
second: '2-digit',
|
|
7
|
+
hour12: false
|
|
8
|
+
});
|
|
9
|
+
|
|
3
10
|
function formatMsToSec(format, ms) {
|
|
4
11
|
const seconds = ms / 1000;
|
|
5
12
|
return util.format(format, seconds);
|
|
6
13
|
}
|
|
7
14
|
|
|
15
|
+
function formatTime(date) {
|
|
16
|
+
return formatter.format(date);
|
|
17
|
+
}
|
|
18
|
+
|
|
8
19
|
module.exports = {
|
|
9
|
-
formatMsToSec
|
|
20
|
+
formatMsToSec,
|
|
21
|
+
formatTime
|
|
10
22
|
}
|