@tywalk/pcf-helper-run 1.0.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.
Files changed (3) hide show
  1. package/README.md +22 -0
  2. package/index.js +42 -0
  3. package/package.json +15 -0
package/README.md ADDED
@@ -0,0 +1,22 @@
1
+ # PCF Helper Run
2
+
3
+ A simple command-line utility for building and publishing PCF controls to Dataverse.
4
+
5
+ ## Requirements
6
+
7
+ This tool requires the following:
8
+
9
+ * `pac` cli installed on your machine.
10
+ * `dotnet` cli or Visual Studio installed on your machine.
11
+
12
+ ## Instructions
13
+
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>`.
16
+
17
+ ### Commands
18
+
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>`
package/index.js ADDED
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env node
2
+ const upgradeTask = require('../../../tasks/upgrade-pcf');
3
+ const buildTask = require('../../../tasks/build-pcf');
4
+ const importTask = require('../../../tasks/import-pcf');
5
+ const [, , ...args] = process.argv;
6
+
7
+ const commandArgument = args.at(0)?.toLowerCase();
8
+ if (typeof commandArgument === 'undefined' || !['upgrade', 'build', 'import', 'deploy'].includes(commandArgument)) {
9
+ console.error('Command [command] (upgrade, build, import, deploy) is required.');
10
+ return 0;
11
+ }
12
+ const runAll = commandArgument === 'deploy';
13
+
14
+ const pathArgument = args.find(a => ['-p', '--path'].includes(a));
15
+ if (typeof pathArgument === 'undefined') {
16
+ console.error('Path argument is required. Use --path to specify the path to solution folder.');
17
+ return 0;
18
+ }
19
+
20
+ const pathIndex = args.indexOf(pathArgument) + 1;
21
+ const path = args.at(pathIndex);
22
+ if (typeof path === 'undefined') {
23
+ console.error('Path argument is required. Use --path to specify the path to solution folder.');
24
+ return 0;
25
+ }
26
+
27
+ const envArgument = args.find(a => ['-env', '--environment'].includes(a));
28
+ let envIndex = args.indexOf(envArgument) + 1;
29
+ let env = '';
30
+ if (envIndex > 0) {
31
+ env = args.at(envIndex);
32
+ }
33
+
34
+ if (commandArgument === 'upgrade' || runAll) {
35
+ upgradeTask.run(path);
36
+ }
37
+ if (commandArgument === 'build' || runAll) {
38
+ buildTask.run(path);
39
+ }
40
+ if (commandArgument === 'import' || runAll) {
41
+ importTask.run(path, env);
42
+ }
package/package.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "@tywalk/pcf-helper-run",
3
+ "version": "1.0.0",
4
+ "description": "A simple command-line utility for building and publishing PCF controls to Dataverse.",
5
+ "scripts": {
6
+ "test": "node test.js"
7
+ },
8
+ "keywords": [
9
+ "pcf"
10
+ ],
11
+ "author": "tywalk",
12
+ "bin": {
13
+ "pcf-helper-run": "./index.js"
14
+ }
15
+ }