@tywalk/pcf-helper-run 1.3.7 → 1.4.0
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 +3 -1
- package/dist/__tests__/pcf-helper-run.test.js +14 -0
- package/dist/index.js +28 -4
- package/dist/package.json +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -251,6 +251,7 @@ pcf-helper-run session [options]
|
|
|
251
251
|
- `-c, --css <path>` - Local CSS path
|
|
252
252
|
- `-f, --config <path>` - Config file path (default: `session.config.json`)
|
|
253
253
|
- `-w, --watch` - Start pcf-scripts watch process to automatically rebuild on changes
|
|
254
|
+
- `--watch-retry <true|false>` - Controls watch failure behavior when `--watch` is enabled: `true` auto-retries, `false` prompts for manual restart (default: `true`)
|
|
254
255
|
|
|
255
256
|
#### Configuration File
|
|
256
257
|
|
|
@@ -263,7 +264,8 @@ Create a `session.config.json` file in your project root to avoid passing parame
|
|
|
263
264
|
"remoteStylesheetToIntercept": "/webresources/pub_MyControl/css/MyControl.css",
|
|
264
265
|
"localBundlePath": "./out/controls/MyControl/bundle.js",
|
|
265
266
|
"localCssPath": "./out/controls/MyControl/css/MyControl.css",
|
|
266
|
-
"startWatch": false
|
|
267
|
+
"startWatch": false,
|
|
268
|
+
"watchRetry": true
|
|
267
269
|
}
|
|
268
270
|
```
|
|
269
271
|
|
|
@@ -99,3 +99,17 @@ test('runBuild exists', () => {
|
|
|
99
99
|
const exists = typeof (tasks === null || tasks === void 0 ? void 0 : tasks.runBuild) === 'function';
|
|
100
100
|
expect(exists).toBe(true);
|
|
101
101
|
});
|
|
102
|
+
test('session errors when watch retry flag is used without watch', (done) => {
|
|
103
|
+
const task = (0, child_process_1.spawn)('node', ['./dist/index.js', 'session', '--watch-retry', 'false']);
|
|
104
|
+
let output = '';
|
|
105
|
+
task.stdout.on('data', (data) => {
|
|
106
|
+
output += data.toString();
|
|
107
|
+
});
|
|
108
|
+
task.stderr.on('data', (data) => {
|
|
109
|
+
output += data.toString();
|
|
110
|
+
});
|
|
111
|
+
task.on('close', (code) => {
|
|
112
|
+
expect(code).toBe(1);
|
|
113
|
+
done();
|
|
114
|
+
});
|
|
115
|
+
}, 10000);
|
package/dist/index.js
CHANGED
|
@@ -64,6 +64,16 @@ const preprocessArgs = (args) => {
|
|
|
64
64
|
// Preprocess arguments and track if deprecated flags were used
|
|
65
65
|
const { args: processedArgs, hadDeprecatedEnv } = preprocessArgs(process.argv.slice(2));
|
|
66
66
|
process.argv = [...process.argv.slice(0, 2), ...processedArgs];
|
|
67
|
+
const parseWatchRetry = (value) => {
|
|
68
|
+
const normalized = value.trim().toLowerCase();
|
|
69
|
+
if (normalized === 'true') {
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
if (normalized === 'false') {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
throw new Error('watch-retry must be either true or false');
|
|
76
|
+
};
|
|
67
77
|
// Configure the CLI program
|
|
68
78
|
commander_1.program
|
|
69
79
|
.name('pcf-helper-run')
|
|
@@ -280,18 +290,32 @@ withCommonOptions(commander_1.program.command('session'))
|
|
|
280
290
|
.option('-c, --local-css <path>', 'local CSS path')
|
|
281
291
|
.option('-f, --config <path>', 'config file path', 'session.config.json')
|
|
282
292
|
.option('-w, --watch', 'start pcf-scripts watch process')
|
|
283
|
-
.
|
|
284
|
-
|
|
293
|
+
.option('--watch-retry <enabled>', 'automatically retry watch process on failure (true|false)', parseWatchRetry)
|
|
294
|
+
.action((options, command) => __awaiter(void 0, void 0, void 0, function* () {
|
|
295
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
285
296
|
const { logger, tick } = setupExecutionContext(options);
|
|
286
297
|
try {
|
|
287
298
|
logger.log('[PCF Helper Run] ' + (0, performanceUtil_1.formatTime)(new Date()) + ' session started.\n');
|
|
288
299
|
if (!options.url || options.config) {
|
|
289
300
|
const config = tasks.loadConfig(options.config || 'session.config.json');
|
|
301
|
+
const configWithWatchRetry = config;
|
|
302
|
+
const startWatch = (_b = (_a = options.watch) !== null && _a !== void 0 ? _a : config.startWatch) !== null && _b !== void 0 ? _b : false;
|
|
303
|
+
const watchRetryFlagWasSet = command.getOptionValueSource('watchRetry') === 'cli';
|
|
304
|
+
if (watchRetryFlagWasSet && !startWatch) {
|
|
305
|
+
logger.error('❌ --watch-retry can only be used when --watch is enabled.');
|
|
306
|
+
process.exit(1);
|
|
307
|
+
}
|
|
308
|
+
const watchRetry = (_d = (_c = options.watchRetry) !== null && _c !== void 0 ? _c : configWithWatchRetry.watchRetry) !== null && _d !== void 0 ? _d : true;
|
|
290
309
|
// Use the config values from the config file, falling back to the CLI options if the config values are not set
|
|
291
|
-
yield tasks.runSession((
|
|
310
|
+
yield tasks.runSession((_e = config.remoteEnvironmentUrl) !== null && _e !== void 0 ? _e : options.url, (_f = config.remoteScriptToIntercept) !== null && _f !== void 0 ? _f : options.script, (_g = config.remoteStylesheetToIntercept) !== null && _g !== void 0 ? _g : options.stylesheet, (_h = config.localBundlePath) !== null && _h !== void 0 ? _h : options.bundle, (_j = config.localCssPath) !== null && _j !== void 0 ? _j : options.css, startWatch, watchRetry);
|
|
292
311
|
}
|
|
293
312
|
else {
|
|
294
|
-
|
|
313
|
+
const watchRetryFlagWasSet = command.getOptionValueSource('watchRetry') === 'cli';
|
|
314
|
+
if (watchRetryFlagWasSet && !options.watch) {
|
|
315
|
+
logger.error('❌ --watch-retry can only be used when --watch is enabled.');
|
|
316
|
+
process.exit(1);
|
|
317
|
+
}
|
|
318
|
+
yield tasks.runSession(options.url, options.script, options.stylesheet, options.bundle, options.css, options.watch, (_k = options.watchRetry) !== null && _k !== void 0 ? _k : true);
|
|
295
319
|
}
|
|
296
320
|
const tock = performance.now();
|
|
297
321
|
logger.log((0, performanceUtil_1.formatMsToSec)('Session started successfully in %is.', tock - tick));
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tywalk/pcf-helper-run",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.7",
|
|
4
4
|
"description": "Unified CLI interface for Power Platform Component Framework (PCF) development — init, build, import, deploy, and manage PCF controls in Dataverse.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "./types/",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@tywalk/color-logger": "^1.0.3",
|
|
55
|
-
"@tywalk/pcf-helper": "^1.
|
|
55
|
+
"@tywalk/pcf-helper": "^1.13.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@semantic-release/git": "^10.0.1",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tywalk/pcf-helper-run",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Unified CLI interface for Power Platform Component Framework (PCF) development — init, build, import, deploy, and manage PCF controls in Dataverse.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "./types/",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@tywalk/color-logger": "^1.0.3",
|
|
55
|
-
"@tywalk/pcf-helper": "^1.
|
|
55
|
+
"@tywalk/pcf-helper": "^1.13.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@semantic-release/git": "^10.0.1",
|