@tywalk/pcf-helper 1.4.22 → 1.4.24

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/bin/build.js CHANGED
@@ -48,6 +48,14 @@ if (['-v', '--version'].includes(commandArgument)) {
48
48
  console.log('v%s', package_json_1.version);
49
49
  process.exit(0);
50
50
  }
51
+ const timeout = (0, argumentUtil_1.getArgValue)(args, ['-t', '--timeout']);
52
+ if (typeof timeout !== 'undefined') {
53
+ const timeoutNumber = Number(timeout);
54
+ if (isNaN(timeoutNumber) || timeoutNumber <= 0) {
55
+ color_logger_1.default.error('Timeout argument must be a positive number representing milliseconds.');
56
+ process.exit(1);
57
+ }
58
+ }
51
59
  const verboseArgument = args.find(a => ['-v', '--verbose'].includes(a));
52
60
  if (typeof verboseArgument !== 'undefined') {
53
61
  color_logger_1.default.setDebug(true);
@@ -58,4 +66,4 @@ if (typeof path === 'undefined') {
58
66
  color_logger_1.default.error('Path argument is required. Use --path to specify the path to solution folder.');
59
67
  process.exit(1);
60
68
  }
61
- task.runBuild(path, verboseArgument !== undefined);
69
+ task.runBuild(path, verboseArgument !== undefined, typeof timeout !== 'undefined' ? Number(timeout) : undefined);
@@ -48,6 +48,14 @@ if (['-v', '--version'].includes(commandArgument)) {
48
48
  console.log('v%s', package_json_1.version);
49
49
  process.exit(0);
50
50
  }
51
+ const timeout = (0, argumentUtil_1.getArgValue)(args, ['-t', '--timeout']);
52
+ if (typeof timeout !== 'undefined') {
53
+ const timeoutNumber = Number(timeout);
54
+ if (isNaN(timeoutNumber) || timeoutNumber <= 0) {
55
+ color_logger_1.default.error('Timeout argument must be a positive number representing milliseconds.');
56
+ process.exit(1);
57
+ }
58
+ }
51
59
  const verboseArgument = args.find(a => ['-v', '--verbose'].includes(a));
52
60
  if (typeof verboseArgument !== 'undefined') {
53
61
  color_logger_1.default.setDebug(true);
@@ -59,4 +67,4 @@ if (typeof path === 'undefined') {
59
67
  process.exit(1);
60
68
  }
61
69
  const env = (_c = (0, argumentUtil_1.getArgValue)(args, ['-env', '--environment'])) !== null && _c !== void 0 ? _c : '';
62
- task.runImport(path, env);
70
+ task.runImport(path, env, verboseArgument !== undefined, typeof timeout !== 'undefined' ? Number(timeout) : undefined);
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tywalk/pcf-helper",
3
- "version": "1.4.22",
3
+ "version": "1.4.23",
4
4
  "description": "Command line helper for building and publishing PCF controls to Dataverse.",
5
5
  "main": "dist/index.js",
6
6
  "types": "./types/",
@@ -12,17 +12,18 @@ const color_logger_1 = __importDefault(require("@tywalk/color-logger"));
12
12
  *
13
13
  * @param {string} path The path to the project folder containing the pcfproj.json file.
14
14
  * @param {boolean} verbose - If true, additional debug information is logged.
15
+ * @param {number} [timeout] - Optional timeout in milliseconds for the build process.
15
16
  *
16
17
  * @returns {number} The exit code of the spawned process.
17
18
  */
18
- function runBuild(path, verbose) {
19
+ function runBuild(path, verbose, timeout) {
19
20
  color_logger_1.default.log('[PCF Helper] ' + (0, performanceUtil_1.formatTime)(new Date()) + ' Starting build...\n');
20
21
  const tick = performance.now();
21
22
  const task = (0, child_process_1.spawnSync)('dotnet build', ['--restore', '-c', 'Release', path], {
22
23
  cwd: process.cwd(),
23
24
  stdio: 'inherit',
24
25
  shell: true,
25
- timeout: 1000 * 60 * 5 // 5 minutes
26
+ timeout: timeout !== null && timeout !== void 0 ? timeout : 1000 * 60 * 5 // 5 minutes
26
27
  });
27
28
  return (0, performanceUtil_1.handleTaskCompletion)(task, 'build', performance.now() - tick, verbose);
28
29
  }
@@ -15,10 +15,11 @@ const performanceUtil_1 = require("../util/performanceUtil");
15
15
  * @param {string} path - The path to the solution folder containing the build output.
16
16
  * @param {string} env - The environment identifier (GUID or URL) where the solution will be imported.
17
17
  * @param {boolean} verbose - If true, additional debug information is logged.
18
+ * @param {number} [timeout] - Optional timeout in milliseconds for the import process.
18
19
  *
19
20
  * @returns {number} The exit status of the import process.
20
21
  */
21
- function runImport(path, env, verbose) {
22
+ function runImport(path, env, verbose, timeout) {
22
23
  var _a;
23
24
  color_logger_1.default.log('[PCF Helper] ' + (0, performanceUtil_1.formatTime)(new Date()) + ' Starting import...\n');
24
25
  const tick = performance.now();
@@ -34,7 +35,7 @@ function runImport(path, env, verbose) {
34
35
  cwd: process.cwd(),
35
36
  stdio: 'inherit',
36
37
  shell: true,
37
- timeout: 1000 * 60 * 5, // 5 minutes
38
+ timeout: timeout !== null && timeout !== void 0 ? timeout : 1000 * 60 * 5, // 5 minutes
38
39
  });
39
40
  return (0, performanceUtil_1.handleTaskCompletion)(task, 'import', performance.now() - tick, verbose);
40
41
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tywalk/pcf-helper",
3
- "version": "1.4.22",
3
+ "version": "1.4.24",
4
4
  "description": "Command line helper for building and publishing PCF controls to Dataverse.",
5
5
  "main": "dist/index.js",
6
6
  "types": "./types/",
@@ -3,8 +3,9 @@
3
3
  *
4
4
  * @param {string} path The path to the project folder containing the pcfproj.json file.
5
5
  * @param {boolean} verbose - If true, additional debug information is logged.
6
+ * @param {number} [timeout] - Optional timeout in milliseconds for the build process.
6
7
  *
7
8
  * @returns {number} The exit code of the spawned process.
8
9
  */
9
- declare function runBuild(path: string, verbose: boolean): number;
10
+ declare function runBuild(path: string, verbose: boolean, timeout?: number): number;
10
11
  export { runBuild };
@@ -4,8 +4,9 @@
4
4
  * @param {string} path - The path to the solution folder containing the build output.
5
5
  * @param {string} env - The environment identifier (GUID or URL) where the solution will be imported.
6
6
  * @param {boolean} verbose - If true, additional debug information is logged.
7
+ * @param {number} [timeout] - Optional timeout in milliseconds for the import process.
7
8
  *
8
9
  * @returns {number} The exit status of the import process.
9
10
  */
10
- declare function runImport(path: string, env: string, verbose?: boolean): number;
11
+ declare function runImport(path: string, env: string, verbose?: boolean, timeout?: number): number;
11
12
  export { runImport };