@tywalk/pcf-helper 1.4.1 → 1.4.2

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/bin/deploy.js CHANGED
@@ -2,6 +2,7 @@
2
2
  const upgradeTask = require('../tasks/upgrade-pcf');
3
3
  const buildTask = require('../tasks/build-pcf');
4
4
  const importTask = require('../tasks/import-pcf');
5
+ const { formatMsToSec } = require('../util/performanceUtil');
5
6
  const [, , ...args] = process.argv;
6
7
 
7
8
  const pathArgument = args.find(a => ['-p', '--path'].includes(a));
@@ -36,14 +37,18 @@ function executeTasks() {
36
37
  return 0;
37
38
  }
38
39
 
40
+ var result = 0;
39
41
  try {
40
- const result = executeTasks();
42
+ result = executeTasks();
41
43
  if (result === 0) {
42
44
  console.log('Deploy complete!');
43
45
  }
44
46
  } catch (e) {
45
47
  console.error('One or more tasks failed while deploying: ', (e && e.message) || 'unkown error');
48
+ result = 1;
46
49
  } finally {
47
50
  const tock = performance.now();
48
- console.log('Deploy finished in %i ms.', tock - tick);
49
- }
51
+ console.log('Deploy finished in %is.', formatMsToSec(tock - tick));
52
+ }
53
+
54
+ return result;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tywalk/pcf-helper",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "description": "Command line helper for building and publishing PCF controls to Dataverse.",
5
5
  "scripts": {
6
6
  "test": "node test.js"
@@ -1,4 +1,5 @@
1
1
  const { spawnSync } = require('child_process');
2
+ const { formatMsToSec } = require('../util/performanceUtil');
2
3
 
3
4
  function run(path) {
4
5
  const tick = performance.now();
@@ -24,7 +25,7 @@ function run(path) {
24
25
  console.error('Unable to complete build: One or more errors ocurred.');
25
26
  }
26
27
  }
27
- console.log('Build finished in %i ms.', tock - tick);
28
+ console.log('Build finished in %is.', formatMsToSec(tock - tick));
28
29
  return task.status;
29
30
  }
30
31
 
@@ -1,6 +1,7 @@
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
5
 
5
6
  function run(path, env, verbose) {
6
7
  const tick = performance.now();
@@ -38,7 +39,7 @@ function run(path, env, verbose) {
38
39
  console.error('Unable to complete import: One or more errors ocurred.');
39
40
  }
40
41
  }
41
- console.log('Import finished in %i ms.', tock - tick);
42
+ console.log('Import finished in %is.', formatMsToSec(tock - tick));
42
43
  return task.status;
43
44
  }
44
45
 
@@ -1,4 +1,5 @@
1
1
  const { spawnSync } = require('child_process');
2
+ const { formatMsToSec } = require('../util/performanceUtil');
2
3
 
3
4
  function run(path) {
4
5
  const tick = performance.now();
@@ -24,7 +25,7 @@ function run(path) {
24
25
  console.error('Unable to complete upgrade: One or more errors ocurred.');
25
26
  }
26
27
  }
27
- console.log('Upgrade finished in %i ms.', tock - tick);
28
+ console.log('Upgrade finished in %is.', formatMsToSec(tock - tick));
28
29
  return task.status;
29
30
  }
30
31
 
@@ -0,0 +1,10 @@
1
+ const util = require('node:util');
2
+
3
+ function formatMsToSec(ms, format) {
4
+ const seconds = ms / 1000;
5
+ return util.format(format, seconds);
6
+ }
7
+
8
+ module.exports = {
9
+ formatMsToSec
10
+ }