@tywalk/pcf-helper-run 1.2.9 → 1.2.12

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
@@ -1,22 +1,408 @@
1
- # PCF Helper Run
1
+ # PCF Helper Run 🎯
2
2
 
3
- A simple command-line utility for building and publishing PCF controls to Dataverse.
3
+ [![npm version](https://badge.fury.io/js/%40tywalk%2Fpcf-helper-run.svg)](https://badge.fury.io/js/%40tywalk%2Fpcf-helper-run)
4
+ [![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
4
5
 
5
- ## Requirements
6
+ **Unified CLI interface for all Power Platform Component Framework (PCF) operations.**
6
7
 
7
- This tool requires the following:
8
+ This package provides a single, consolidated command-line interface that brings together all PCF Helper functionality under one roof. Perfect for developers who prefer a unified experience and simplified command structure.
8
9
 
9
- * `pac` cli installed on your machine.
10
- * `dotnet` cli or Visual Studio installed on your machine.
10
+ ## 📋 Table of Contents
11
11
 
12
- ## Instructions
12
+ - [Installation](#-installation)
13
+ - [Quick Start](#-quick-start)
14
+ - [Command Structure](#️-command-structure)
15
+ - [Available Subcommands](#️-available-subcommands)
16
+ - [Usage Examples](#-detailed-command-reference)
17
+ - [Workflow Examples](#-workflow-examples)
18
+ - [Global Options](#️-global-options)
19
+ - [Troubleshooting](#-troubleshooting)
13
20
 
14
- 1. In a terminal, install globally `npm install --save --global @tywalk/pcf-helper-run`. Or,
15
- 2. In a terminal, run `npx @tywalk/pcf-helper-run [command] --path <path to pcf project folder> --environment <environment guid or url>`.
21
+ ## 📦 Installation
16
22
 
17
- ### Commands
23
+ ### Global Installation (Recommended)
18
24
 
19
- * `upgrade` - Upgrades PCF manifest and solution versions (--environment is not required). `npx @tywalk/pcf-helper-run upgrade --path <path to pcf project folder>`
20
- * `build` - Builds PCF control (--environment is not required). `npx @tywalk/pcf-helper-run build --path <path to pcf project folder>`
21
- * `import` - Imports PCF control into specified environment. Defaults to auth profile environment. `npx @tywalk/pcf-helper-run import --path <path to pcf project folder> --environment <environment guid or url>`
22
- * `deploy` - Upgrades, builds, and imports PCF control. `npx @tywalk/pcf-helper-run deploy--path <path to pcf project folder> --environment <environment guid or url>`
25
+ ```bash
26
+ npm install -g @tywalk/pcf-helper-run
27
+ ```
28
+
29
+ ### Local Installation
30
+
31
+ ```bash
32
+ npm install @tywalk/pcf-helper-run
33
+ ```
34
+
35
+ ### Verify Installation
36
+
37
+ ```bash
38
+ pcf-helper-run --version
39
+ pcf-helper-run --help
40
+ ```
41
+
42
+ ## 🚀 Quick Start
43
+
44
+ ### Basic Usage Pattern
45
+
46
+ ```bash
47
+ pcf-helper-run <subcommand> [options]
48
+ ```
49
+
50
+ ### Your First PCF Control
51
+
52
+ ```bash
53
+ # 1. Initialize a new PCF project
54
+ pcf-helper-run init -n "MyFirstControl" --publisher-name "My Company"
55
+
56
+ # 2. Navigate to the created project
57
+ cd MyFirstControl
58
+
59
+ # 3. Build the control
60
+ pcf-helper-run build -p .
61
+
62
+ # 4. Import to your solution
63
+ pcf-helper-run import -p .
64
+ ```
65
+
66
+ ## 🏗️ Command Structure
67
+
68
+ PCF Helper Run uses a subcommand structure for organized functionality:
69
+
70
+ ```bash
71
+ pcf-helper-run <subcommand> [options]
72
+ ```
73
+
74
+ Each subcommand corresponds to a specific PCF operation, with consistent option patterns across all commands.
75
+
76
+ ## 🛠️ Available Subcommands
77
+
78
+ | Subcommand | Description | Equivalent Individual Command |
79
+ |------------|-------------|-------------------------------|
80
+ | `init` | Initialize new PCF project | `pcf-helper-init` |
81
+ | `build` | Build and compile controls | `pcf-helper-build` |
82
+ | `import` | Import controls to solution | `pcf-helper-import` |
83
+ | `deploy` | Deploy to environment (upgrade + build + import) | `pcf-helper-deploy` |
84
+ | `upgrade` | Upgrade project dependencies | `pcf-helper-upgrade` |
85
+ | `session` | Manage development sessions | `pcf-helper-session` |
86
+
87
+ ## 📖 Detailed Command Reference
88
+
89
+ ### 🏗️ init - Initialize New Project
90
+
91
+ Create a new PCF project with proper scaffolding.
92
+
93
+ ```bash
94
+ pcf-helper-run init -n <control-name> [options]
95
+ ```
96
+
97
+ #### Required Parameters
98
+
99
+ - `-n, --name <name>` - Name of the PCF control
100
+
101
+ #### Optional Parameters
102
+
103
+ - `--publisher-name <name>` - Publisher name
104
+ - `--publisher-prefix <prefix>` - Publisher prefix
105
+ - `-p, --path <path>` - Creation path (default: current directory)
106
+ - `--run-npm-install` - Run npm install after creation (default: true)
107
+
108
+ #### Examples
109
+
110
+ ```bash
111
+ # Simple initialization
112
+ pcf-helper-run init -n "CustomerLookup"
113
+
114
+ # Full configuration
115
+ pcf-helper-run init -n "CustomerLookup" \
116
+ --publisher-name "Contoso Corporation" \
117
+ --publisher-prefix "con" \
118
+ -p ./my-controls \
119
+ --verbose
120
+
121
+ # Skip npm install for faster scaffolding
122
+ pcf-helper-run init -n "QuickControl" --run-npm-install false
123
+ ```
124
+
125
+ ### ⚡ build - Build Controls
126
+
127
+ Compile and build your PCF controls for deployment.
128
+
129
+ ```bash
130
+ pcf-helper-run build -p <solution-path> [options]
131
+ ```
132
+
133
+ #### Required Parameters
134
+
135
+ - `-p, --path <path>` - Path to the solution folder
136
+
137
+ #### Optional Parameters
138
+
139
+ - `-e, --environment <environment>` - Target environment configuration
140
+ - `--env <environment>` - (Deprecated: use `--environment`) Target environment
141
+ - `-t, --timeout <milliseconds>` - Build timeout (default: 300000)
142
+
143
+ #### Examples
144
+
145
+ ```bash
146
+ # Basic build
147
+ pcf-helper-run build -p ./MySolution
148
+
149
+ # Build with environment and extended timeout
150
+ pcf-helper-run build -p ./MySolution --environment Production --timeout 120000
151
+
152
+ # Verbose build for debugging
153
+ pcf-helper-run build -p ./MySolution --verbose
154
+ ```
155
+
156
+ ### 📦 import - Import to Solution
157
+
158
+ Import your built PCF controls into a Dataverse solution.
159
+
160
+ ```bash
161
+ pcf-helper-run import -p <solution-path> [options]
162
+ ```
163
+
164
+ #### Required Parameters
165
+
166
+ - `-p, --path <path>` - Path to the solution folder
167
+
168
+ #### Optional Parameters
169
+
170
+ - `-e, --environment <environment>` - Target environment
171
+ - `--env <environment>` - (Deprecated: use `--environment`) Target environment
172
+ - `-t, --timeout <milliseconds>` - Import timeout
173
+
174
+ #### Examples
175
+
176
+ ```bash
177
+ # Import to default environment
178
+ pcf-helper-run import -p .
179
+
180
+ # Import to specific environment
181
+ pcf-helper-run import -p . --environment "Test Environment"
182
+
183
+ # Extended timeout for large solutions
184
+ pcf-helper-run import -p . --timeout 180000
185
+ ```
186
+
187
+ ### 🚀 deploy - Deploy to Environment
188
+
189
+ Deploy your PCF controls to the target Dataverse environment. This command runs upgrade, build, and import in sequence.
190
+
191
+ ```bash
192
+ pcf-helper-run deploy -p <solution-path> [options]
193
+ ```
194
+
195
+ #### Required Parameters
196
+
197
+ - `-p, --path <path>` - Path to the solution folder
198
+
199
+ #### Optional Parameters
200
+
201
+ - `-e, --environment <environment>` - Target environment for deployment
202
+ - `--env <environment>` - (Deprecated: use `--environment`) Target environment
203
+ - `-t, --timeout <milliseconds>` - Deployment timeout
204
+
205
+ #### Examples
206
+
207
+ ```bash
208
+ # Deploy to default environment
209
+ pcf-helper-run deploy -p .
210
+
211
+ # Deploy to production with extended timeout
212
+ pcf-helper-run deploy -p . --environment "Production" --timeout 300000
213
+ ```
214
+
215
+ ### 🔄 upgrade - Upgrade Project
216
+
217
+ Upgrade your PCF project dependencies and framework versions.
218
+
219
+ ```bash
220
+ pcf-helper-run upgrade -p <solution-path> [options]
221
+ ```
222
+
223
+ #### Required Parameters
224
+
225
+ - `-p, --path <path>` - Path to the solution folder
226
+
227
+ #### Examples
228
+
229
+ ```bash
230
+ # Upgrade project dependencies
231
+ pcf-helper-run upgrade -p .
232
+
233
+ # Upgrade with verbose output
234
+ pcf-helper-run upgrade -p . --verbose
235
+ ```
236
+
237
+ ### 🎯 session - Manage Development Sessions
238
+
239
+ Manage development sessions with live reloading capabilities.
240
+
241
+ ```bash
242
+ pcf-helper-run session [options]
243
+ ```
244
+
245
+ #### Optional Parameters
246
+
247
+ - `-u, --url <url>` - Remote environment URL
248
+ - `-s, --script <path>` - Remote script to intercept
249
+ - `-t, --stylesheet <path>` - Remote stylesheet to intercept
250
+ - `-b, --bundle <path>` - Local bundle path
251
+ - `-c, --css <path>` - Local CSS path
252
+ - `-f, --config <path>` - Config file path (default: `session.config.json`)
253
+
254
+ #### Examples
255
+
256
+ ```bash
257
+ # Start session with default config
258
+ pcf-helper-run session
259
+
260
+ # Session with custom configuration
261
+ pcf-helper-run session -u "https://contoso.crm.dynamics.com" -s ./bundle.js
262
+ ```
263
+
264
+ ## ⚙️ Global Options
265
+
266
+ These options are available for all subcommands:
267
+
268
+ | Option | Description | Default |
269
+ |--------|-------------|---------|
270
+ | `-v, --verbose` | Enable detailed logging | `false` |
271
+ | `--version` | Display version information | - |
272
+ | `-h, --help` | Show help for command | - |
273
+ | `-t, --timeout <ms>` | Operation timeout in milliseconds | `300000` |
274
+
275
+ ### Global Usage Examples
276
+
277
+ ```bash
278
+ # Enable verbose logging for any command
279
+ pcf-helper-run build -p . --verbose
280
+
281
+ # Set custom timeout
282
+ pcf-helper-run import -p . --timeout 120000
283
+
284
+ # Get help for specific subcommand
285
+ pcf-helper-run build --help
286
+ ```
287
+
288
+ ## 💼 Workflow Examples
289
+
290
+ ### Complete Development Workflow
291
+
292
+ ```bash
293
+ #!/bin/bash
294
+ # Complete PCF development and deployment script
295
+
296
+ set -e # Exit on any error
297
+
298
+ echo "🏗️ Initializing PCF project..."
299
+ pcf-helper-run init -n "SalesCalculator" \
300
+ --publisher-name "Contoso Sales" \
301
+ --publisher-prefix "cs" \
302
+ -p ./sales-calculator
303
+
304
+ echo "📂 Navigating to project directory..."
305
+ cd ./sales-calculator
306
+
307
+ echo "⚡ Building the control..."
308
+ pcf-helper-run build -p . --verbose
309
+
310
+ echo "📦 Importing to solution..."
311
+ pcf-helper-run import -p . --timeout 120000
312
+
313
+ echo "🚀 Deploying to test environment..."
314
+ pcf-helper-run deploy -p . --environment "Test"
315
+
316
+ echo "✅ Deployment complete!"
317
+ ```
318
+
319
+ ### Development with Multiple Environments
320
+
321
+ ```bash
322
+ # Build and test locally
323
+ pcf-helper-run build -p .
324
+
325
+ # Deploy to development environment
326
+ pcf-helper-run deploy -p . --environment "Development"
327
+
328
+ # After testing, deploy to staging
329
+ pcf-helper-run deploy -p . --environment "Staging"
330
+
331
+ # Finally, deploy to production
332
+ pcf-helper-run deploy -p . --environment "Production"
333
+ ```
334
+
335
+ ## 🐛 Troubleshooting
336
+
337
+ ### Common Issues and Solutions
338
+
339
+ #### Command Not Found
340
+
341
+ ```bash
342
+ # Verify installation
343
+ npm list -g @tywalk/pcf-helper-run
344
+
345
+ # Reinstall if necessary
346
+ npm uninstall -g @tywalk/pcf-helper-run
347
+ npm install -g @tywalk/pcf-helper-run
348
+ ```
349
+
350
+ #### Build Failures
351
+
352
+ ```bash
353
+ # Enable verbose mode for detailed error info
354
+ pcf-helper-run build -p . --verbose
355
+
356
+ # Clear node_modules and reinstall
357
+ rm -rf node_modules package-lock.json
358
+ npm install
359
+
360
+ # Verify prerequisites
361
+ pac --version
362
+ dotnet --version
363
+ ```
364
+
365
+ #### Timeout Errors
366
+
367
+ ```bash
368
+ # Increase timeout for large projects
369
+ pcf-helper-run build -p . --timeout 120000 # 2 minutes
370
+ ```
371
+
372
+ #### Deprecated Flag Warnings
373
+
374
+ ```bash
375
+ # Replace deprecated --env with --environment
376
+ pcf-helper-run deploy -p . --environment "Production"
377
+ ```
378
+
379
+ ### Debug Information
380
+
381
+ ```bash
382
+ # Show detailed version and environment information
383
+ pcf-helper-run --version --verbose
384
+
385
+ # Get help for specific command
386
+ pcf-helper-run deploy --help
387
+ ```
388
+
389
+ ## 📚 Additional Resources
390
+
391
+ ### Documentation Links
392
+
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)
395
+ - [PCF Community Gallery](https://pcf.gallery/)
396
+
397
+ ## 🔗 Related Packages
398
+
399
+ - **[@tywalk/pcf-helper](../pcf-helper/README.md)** - Individual CLI commands and core library
400
+ - **[@tywalk/color-logger](https://www.npmjs.com/package/@tywalk/color-logger)** - Enhanced logging utilities
401
+
402
+ ---
403
+
404
+ ## 🏠 [← Back to Main Package](../../README.md)
405
+
406
+ For questions, feature requests, or bug reports, please visit our [GitHub Issues](https://github.com/tywalk/pcf-helper/issues) page.
407
+
408
+ **Happy PCF development! 🎉**
@@ -37,20 +37,31 @@ const child_process_1 = require("child_process");
37
37
  const package_json_1 = require("../package.json");
38
38
  const tasks = __importStar(require("@tywalk/pcf-helper"));
39
39
  test('displays version', (done) => {
40
- const task = (0, child_process_1.spawn)('node', ['./dist/index.js', '-v']);
40
+ const task = (0, child_process_1.spawn)('node', ['./dist/index.js', '--version']);
41
+ // Add timeout
42
+ const timeout = setTimeout(() => {
43
+ task.kill();
44
+ done.fail('Test timed out');
45
+ }, 5000);
41
46
  let output = '';
42
47
  task.stdout.on('data', (data) => {
43
48
  output += data.toString();
44
49
  });
45
50
  task.on('close', (code) => {
51
+ clearTimeout(timeout);
46
52
  console.log(output);
47
53
  expect(output).toContain(package_json_1.version);
48
54
  expect(code).toBe(0);
49
55
  done();
50
56
  });
51
- });
57
+ }, 10000);
52
58
  test('errors if no path is provided', (done) => {
53
- const task = (0, child_process_1.spawn)('node', ['./index.js', '-p']);
59
+ const task = (0, child_process_1.spawn)('node', ['./dist/index.js', 'build']);
60
+ // Add timeout
61
+ const timeout = setTimeout(() => {
62
+ task.kill();
63
+ done.fail('Test timed out');
64
+ }, 5000);
54
65
  let output = '';
55
66
  task.stdout.on('data', (data) => {
56
67
  output += data.toString();
@@ -59,13 +70,20 @@ test('errors if no path is provided', (done) => {
59
70
  console.error(`stderr: ${data}`);
60
71
  });
61
72
  task.on('close', (code) => {
73
+ clearTimeout(timeout);
62
74
  console.log(output);
63
- expect(code).toBe(1);
75
+ // The command should exit with non-zero code when required path is missing
76
+ expect(code).not.toBe(0);
64
77
  done();
65
78
  });
66
- });
79
+ }, 10000);
67
80
  test('errors if incorrect command is provided', (done) => {
68
- const task = (0, child_process_1.spawn)('node', ['./index.js', '-p', 'test', 'invalid']);
81
+ const task = (0, child_process_1.spawn)('node', ['./dist/index.js', 'invalidcommand']);
82
+ // Add timeout
83
+ const timeout = setTimeout(() => {
84
+ task.kill();
85
+ done.fail('Test timed out');
86
+ }, 5000);
69
87
  let output = '';
70
88
  task.stdout.on('data', (data) => {
71
89
  output += data.toString();
@@ -74,11 +92,13 @@ test('errors if incorrect command is provided', (done) => {
74
92
  console.error(`stderr: ${data}`);
75
93
  });
76
94
  task.on('close', (code) => {
95
+ clearTimeout(timeout);
77
96
  console.log(output);
78
- expect(code).toBe(1);
97
+ // Invalid command should exit with non-zero code
98
+ expect(code).not.toBe(0);
79
99
  done();
80
100
  });
81
- });
101
+ }, 10000);
82
102
  test('runBuild exists', () => {
83
103
  const exists = typeof (tasks === null || tasks === void 0 ? void 0 : tasks.runBuild) === 'function';
84
104
  expect(exists).toBe(true);
package/dist/index.js CHANGED
@@ -263,14 +263,14 @@ addCommonOptions(commander_1.program.command('session'))
263
263
  .option('-s, --intercept-stylesheet <stylesheet>', 'remote stylesheet to intercept')
264
264
  .option('-b, --local-bundle <path>', 'local bundle path')
265
265
  .option('-c, --local-css <path>', 'local CSS path')
266
- .option('-f, --config <path>', 'config file path', 'dev-config.json')
266
+ .option('-f, --config <path>', 'config file path', 'session.config.json')
267
267
  .action((options) => {
268
268
  const { logger, tick } = setupExecutionContext(options);
269
269
  let result = 0;
270
270
  try {
271
271
  logger.log('[PCF Helper Run] ' + (0, performanceUtil_1.formatTime)(new Date()) + ' session started.\n');
272
272
  if (!options.url) {
273
- const config = tasks.loadConfig(options.config || 'dev-config.json');
273
+ const config = tasks.loadConfig(options.config || 'session.config.json');
274
274
  options.url = config.remoteEnvironmentUrl;
275
275
  options.script = config.remoteScriptToIntercept;
276
276
  options.stylesheet = config.remoteStylesheetToIntercept;
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tywalk/pcf-helper-run",
3
- "version": "1.2.9",
3
+ "version": "1.2.0",
4
4
  "description": "A simple command-line utility for building and publishing PCF controls to Dataverse.",
5
5
  "types": "./types/",
6
6
  "files": [
@@ -10,11 +10,16 @@
10
10
  "repository": {
11
11
  "url": "git+https://github.com/tywalk/pcf-helper.git"
12
12
  },
13
+ "publishConfig": {
14
+ "access": "public",
15
+ "provenance": true
16
+ },
13
17
  "scripts": {
14
18
  "test": "jest",
15
19
  "build": "tsc",
16
20
  "upgrade": "npm version patch --no-git-tag-version",
17
- "ready": "npm run upgrade && npm run build && npm publish --access public"
21
+ "ready": "npm run upgrade && npm run build",
22
+ "update": "npm run ready && npm publish --access public"
18
23
  },
19
24
  "keywords": [
20
25
  "pcf"
@@ -25,12 +30,16 @@
25
30
  },
26
31
  "dependencies": {
27
32
  "@tywalk/color-logger": "^1.0.3",
28
- "@tywalk/pcf-helper": "^1.5.5"
33
+ "@tywalk/pcf-helper": "^1.5.6"
29
34
  },
30
35
  "devDependencies": {
36
+ "@semantic-release/git": "^10.0.1",
37
+ "@semantic-release/github": "^12.0.6",
38
+ "@semantic-release/npm": "^13.1.5",
31
39
  "@types/jest": "^29.5.14",
32
40
  "@types/node": "^22.19.3",
33
41
  "jest": "^29.7.0",
42
+ "semantic-release": "^25.0.3",
34
43
  "ts-jest": "^29.4.6",
35
44
  "typescript": "^5.9.3"
36
45
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tywalk/pcf-helper-run",
3
- "version": "1.2.9",
3
+ "version": "1.2.12",
4
4
  "description": "A simple command-line utility for building and publishing PCF controls to Dataverse.",
5
5
  "types": "./types/",
6
6
  "files": [
@@ -10,11 +10,16 @@
10
10
  "repository": {
11
11
  "url": "git+https://github.com/tywalk/pcf-helper.git"
12
12
  },
13
+ "publishConfig": {
14
+ "access": "public",
15
+ "provenance": true
16
+ },
13
17
  "scripts": {
14
18
  "test": "jest",
15
19
  "build": "tsc",
16
20
  "upgrade": "npm version patch --no-git-tag-version",
17
- "ready": "npm run upgrade && npm run build && npm publish --access public"
21
+ "ready": "npm run upgrade && npm run build",
22
+ "update": "npm run ready && npm publish --access public"
18
23
  },
19
24
  "keywords": [
20
25
  "pcf"
@@ -25,12 +30,16 @@
25
30
  },
26
31
  "dependencies": {
27
32
  "@tywalk/color-logger": "^1.0.3",
28
- "@tywalk/pcf-helper": "^1.5.5"
33
+ "@tywalk/pcf-helper": "^1.5.6"
29
34
  },
30
35
  "devDependencies": {
36
+ "@semantic-release/git": "^10.0.1",
37
+ "@semantic-release/github": "^12.0.6",
38
+ "@semantic-release/npm": "^13.1.5",
31
39
  "@types/jest": "^29.5.14",
32
40
  "@types/node": "^22.19.3",
33
41
  "jest": "^29.7.0",
42
+ "semantic-release": "^25.0.3",
34
43
  "ts-jest": "^29.4.6",
35
44
  "typescript": "^5.9.3"
36
45
  }