@tywalk/pcf-helper-run 1.2.14 → 1.2.16

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/README.md CHANGED
@@ -250,6 +250,7 @@ pcf-helper-run session [options]
250
250
  - `-b, --bundle <path>` - Local bundle path
251
251
  - `-c, --css <path>` - Local CSS path
252
252
  - `-f, --config <path>` - Config file path (default: `session.config.json`)
253
+ - `-w, --watch` - Start pcf-scripts watch process to automatically rebuild on changes
253
254
 
254
255
  #### Examples
255
256
 
@@ -259,6 +260,9 @@ pcf-helper-run session
259
260
 
260
261
  # Session with custom configuration
261
262
  pcf-helper-run session -u "https://contoso.crm.dynamics.com" -s ./bundle.js
263
+
264
+ # Session with watch mode for automatic rebuilds
265
+ pcf-helper-run session --watch
262
266
  ```
263
267
 
264
268
  ## ⚙️ Global Options
@@ -390,8 +394,8 @@ pcf-helper-run deploy --help
390
394
 
391
395
  ### Documentation Links
392
396
 
393
- - [Power Platform Component Framework Documentation](https://docs.microsoft.com/en-us/powerapps/developer/component-framework/)
394
- - [Power Platform CLI Documentation](https://docs.microsoft.com/en-us/powerapps/developer/data-platform/powerapps-cli)
397
+ - [Power Platform Component Framework Documentation](https://learn.microsoft.com/en-us/power-apps/developer/component-framework/overview)
398
+ - [Power Platform CLI Documentation](https://learn.microsoft.com/en-us/power-platform/developer/cli/introduction)
395
399
  - [PCF Community Gallery](https://pcf.gallery/)
396
400
 
397
401
  ## 🔗 Related Packages
package/dist/index.js CHANGED
@@ -33,6 +33,15 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  return result;
34
34
  };
35
35
  })();
36
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ };
36
45
  Object.defineProperty(exports, "__esModule", { value: true });
37
46
  const commander_1 = require("commander");
38
47
  const tasks = __importStar(require("@tywalk/pcf-helper"));
@@ -113,7 +122,7 @@ const setupExecutionContext = (options) => {
113
122
  return { logger, tick: performance.now() };
114
123
  };
115
124
  // Helper function to execute tasks and handle results
116
- const executeTask = (taskName, logger, tick, result) => {
125
+ const handleResults = (taskName, logger, tick, result) => {
117
126
  if (taskName !== 'session') {
118
127
  if (result === 0) {
119
128
  logger.log(`[PCF Helper Run] ${taskName} completed successfully!`);
@@ -143,10 +152,10 @@ addPathOptions(commander_1.program.command('upgrade'))
143
152
  result = tasks.runUpgrade(options.path, options.verbose || false);
144
153
  }
145
154
  catch (e) {
146
- logger.error('[PCF Helper Run] One or more tasks failed while upgrading: ', (e && e.message) || 'unknown error');
155
+ logger.error('[PCF Helper Run] One or more tasks failed while upgrading: ', e instanceof Error ? e.message : 'unknown error');
147
156
  result = 1;
148
157
  }
149
- executeTask('upgrade', logger, tick, result);
158
+ handleResults('upgrade', logger, tick, result);
150
159
  });
151
160
  // Define the build command
152
161
  addPathOptions(commander_1.program.command('build'))
@@ -163,10 +172,10 @@ addPathOptions(commander_1.program.command('build'))
163
172
  result = tasks.runBuild(options.path, options.verbose || false, options.timeout ? Number(options.timeout) : undefined);
164
173
  }
165
174
  catch (e) {
166
- logger.error('[PCF Helper Run] One or more tasks failed while building: ', (e && e.message) || 'unknown error');
175
+ logger.error('[PCF Helper Run] One or more tasks failed while building: ', e instanceof Error ? e.message : 'unknown error');
167
176
  result = 1;
168
177
  }
169
- executeTask('build', logger, tick, result);
178
+ handleResults('build', logger, tick, result);
170
179
  });
171
180
  // Define the import command
172
181
  addPathOptions(commander_1.program.command('import'))
@@ -187,10 +196,10 @@ addPathOptions(commander_1.program.command('import'))
187
196
  result = tasks.runImport(options.path, env, options.verbose || false, options.timeout ? Number(options.timeout) : undefined);
188
197
  }
189
198
  catch (e) {
190
- logger.error('[PCF Helper Run] One or more tasks failed while importing: ', (e && e.message) || 'unknown error');
199
+ logger.error('[PCF Helper Run] One or more tasks failed while importing: ', e instanceof Error ? e.message : 'unknown error');
191
200
  result = 1;
192
201
  }
193
- executeTask('import', logger, tick, result);
202
+ handleResults('import', logger, tick, result);
194
203
  });
195
204
  // Define the deploy command (runs upgrade, build, and import)
196
205
  addPathOptions(commander_1.program.command('deploy'))
@@ -229,10 +238,10 @@ addPathOptions(commander_1.program.command('deploy'))
229
238
  }
230
239
  }
231
240
  catch (e) {
232
- logger.error('[PCF Helper Run] One or more tasks failed while deploying: ', (e && e.message) || 'unknown error');
241
+ logger.error('[PCF Helper Run] One or more tasks failed while deploying: ', e instanceof Error ? e.message : 'unknown error');
233
242
  result = 1;
234
243
  }
235
- executeTask('deploy', logger, tick, result);
244
+ handleResults('deploy', logger, tick, result);
236
245
  });
237
246
  // Define the init command
238
247
  addCommonOptions(commander_1.program.command('init'))
@@ -250,10 +259,10 @@ addCommonOptions(commander_1.program.command('init'))
250
259
  result = tasks.runInit(options.path, options.name, options.publisherName, options.publisherPrefix, options.runNpmInstall !== false, options.verbose || false);
251
260
  }
252
261
  catch (e) {
253
- logger.error('[PCF Helper Run] One or more tasks failed while initializing: ', (e && e.message) || 'unknown error');
262
+ logger.error('[PCF Helper Run] One or more tasks failed while initializing: ', e instanceof Error ? e.message : 'unknown error');
254
263
  result = 1;
255
264
  }
256
- executeTask('init', logger, tick, result);
265
+ handleResults('init', logger, tick, result);
257
266
  });
258
267
  // Define the session command
259
268
  addCommonOptions(commander_1.program.command('session'))
@@ -265,25 +274,24 @@ addCommonOptions(commander_1.program.command('session'))
265
274
  .option('-c, --local-css <path>', 'local CSS path')
266
275
  .option('-f, --config <path>', 'config file path', 'session.config.json')
267
276
  .option('-w, --watch', 'start pcf-scripts watch process')
268
- .action((options) => {
277
+ .action((options) => __awaiter(void 0, void 0, void 0, function* () {
269
278
  var _a, _b, _c, _d, _e;
270
279
  const { logger, tick } = setupExecutionContext(options);
271
- let result = 0;
272
280
  try {
273
281
  logger.log('[PCF Helper Run] ' + (0, performanceUtil_1.formatTime)(new Date()) + ' session started.\n');
274
282
  if (!options.url || options.config) {
275
283
  const config = tasks.loadConfig(options.config || 'session.config.json');
276
- tasks.runSession((_a = config.remoteEnvironmentUrl) !== null && _a !== void 0 ? _a : options.url, (_b = config.remoteScriptToIntercept) !== null && _b !== void 0 ? _b : options.script, (_c = config.remoteStylesheetToIntercept) !== null && _c !== void 0 ? _c : options.stylesheet, (_d = config.localBundlePath) !== null && _d !== void 0 ? _d : options.bundle, (_e = config.localCssPath) !== null && _e !== void 0 ? _e : options.css, config.startWatch || options.watch);
284
+ yield tasks.runSession((_a = config.remoteEnvironmentUrl) !== null && _a !== void 0 ? _a : options.url, (_b = config.remoteScriptToIntercept) !== null && _b !== void 0 ? _b : options.script, (_c = config.remoteStylesheetToIntercept) !== null && _c !== void 0 ? _c : options.stylesheet, (_d = config.localBundlePath) !== null && _d !== void 0 ? _d : options.bundle, (_e = config.localCssPath) !== null && _e !== void 0 ? _e : options.css, config.startWatch || options.watch);
277
285
  }
278
286
  else {
279
- tasks.runSession(options.url, options.script, options.stylesheet, options.bundle, options.css, options.watch);
287
+ yield tasks.runSession(options.url, options.script, options.stylesheet, options.bundle, options.css, options.watch);
280
288
  }
289
+ const tock = performance.now();
290
+ logger.log((0, performanceUtil_1.formatMsToSec)('Session started successfully in %is.', tock - tick));
281
291
  }
282
292
  catch (e) {
283
- logger.error('[PCF Helper Run] One or more tasks failed during session: ', (e && e.message) || 'unknown error');
284
- result = 1;
293
+ logger.error('[PCF Helper Run] One or more tasks failed during session or session startup: ', e instanceof Error ? e.message : 'unknown error');
285
294
  }
286
- executeTask('session', logger, tick, result);
287
- });
295
+ }));
288
296
  // Parse the command line arguments
289
297
  commander_1.program.parse();
package/dist/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@tywalk/pcf-helper-run",
3
- "version": "1.2.13",
4
- "description": "A simple command-line utility for building and publishing PCF controls to Dataverse.",
3
+ "version": "1.2.15",
4
+ "description": "Unified CLI interface for Power Platform Component Framework (PCF) development — init, build, import, deploy, and manage PCF controls in Dataverse.",
5
+ "main": "dist/index.js",
5
6
  "types": "./types/",
6
7
  "files": [
7
8
  "dist",
@@ -22,9 +23,30 @@
22
23
  "update": "npm run ready && npm publish --access public"
23
24
  },
24
25
  "keywords": [
25
- "pcf"
26
+ "pcf",
27
+ "pcf-control",
28
+ "pcf-component",
29
+ "power-platform",
30
+ "powerapps",
31
+ "power-apps",
32
+ "dataverse",
33
+ "dynamics-365",
34
+ "microsoft",
35
+ "cli",
36
+ "command-line",
37
+ "developer-tools",
38
+ "build-tool",
39
+ "deployment",
40
+ "automation",
41
+ "typescript",
42
+ "pac"
26
43
  ],
44
+ "license": "MIT",
27
45
  "author": "tywalk",
46
+ "homepage": "https://github.com/tywalk/pcf-helper#readme",
47
+ "engines": {
48
+ "node": ">=16.0.0"
49
+ },
28
50
  "bin": {
29
51
  "pcf-helper-run": "dist/index.js"
30
52
  },
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.formatMsToSec = formatMsToSec;
7
7
  exports.formatTime = formatTime;
8
8
  const util_1 = __importDefault(require("util"));
9
- var formatter = new Intl.DateTimeFormat('en-US', {
9
+ const formatter = new Intl.DateTimeFormat('en-US', {
10
10
  hour: '2-digit',
11
11
  minute: '2-digit',
12
12
  second: '2-digit',
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@tywalk/pcf-helper-run",
3
- "version": "1.2.14",
4
- "description": "A simple command-line utility for building and publishing PCF controls to Dataverse.",
3
+ "version": "1.2.16",
4
+ "description": "Unified CLI interface for Power Platform Component Framework (PCF) development — init, build, import, deploy, and manage PCF controls in Dataverse.",
5
+ "main": "dist/index.js",
5
6
  "types": "./types/",
6
7
  "files": [
7
8
  "dist",
@@ -22,9 +23,30 @@
22
23
  "update": "npm run ready && npm publish --access public"
23
24
  },
24
25
  "keywords": [
25
- "pcf"
26
+ "pcf",
27
+ "pcf-control",
28
+ "pcf-component",
29
+ "power-platform",
30
+ "powerapps",
31
+ "power-apps",
32
+ "dataverse",
33
+ "dynamics-365",
34
+ "microsoft",
35
+ "cli",
36
+ "command-line",
37
+ "developer-tools",
38
+ "build-tool",
39
+ "deployment",
40
+ "automation",
41
+ "typescript",
42
+ "pac"
26
43
  ],
44
+ "license": "MIT",
27
45
  "author": "tywalk",
46
+ "homepage": "https://github.com/tywalk/pcf-helper#readme",
47
+ "engines": {
48
+ "node": ">=16.0.0"
49
+ },
28
50
  "bin": {
29
51
  "pcf-helper-run": "dist/index.js"
30
52
  },
@@ -1,2 +1,2 @@
1
1
  export declare function getArg(args: string[], arg: string): string | undefined;
2
- export declare function getArgValue(args: string[], argOpts: string[], defaultIfExists?: any): string | undefined;
2
+ export declare function getArgValue(args: string[], argOpts: string[], defaultIfExists?: string): string | undefined;