@tywalk/pcf-helper 1.0.0 → 1.2.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 ADDED
@@ -0,0 +1,26 @@
1
+ # PCF Helper
2
+
3
+ A simple command-line tool that upgrades, builds, and imports your PCF control into your Dataverse environment.
4
+
5
+ You can run commands separately or run `pcf-helper-deploy` to upgrade, build, and import with just one command.
6
+
7
+ ## Requirements
8
+
9
+ This tool requires the following:
10
+
11
+ * `pac` cli installed on your machine.
12
+ * `dotnet` cli or Visual Studio installed on your machine.
13
+
14
+ ## Instructions
15
+
16
+ 1. In your project, run `npm install --save @tywalk/pcf-helper`. Or, install globally `npm install --save --global @tywalk/pcf-helper`.
17
+ 2. In your project's `package.json` file, add commands as npm scripts:
18
+
19
+ ```json
20
+ "scripts": {
21
+ "upgrade": "pcf-helper-upgrade",
22
+ "build": "pcf-helper-build",
23
+ "import": "pcf-helper-import",
24
+ "deploy": "pcf-helper-deploy"
25
+ },
26
+ ```
package/bin/deploy.js CHANGED
@@ -22,7 +22,7 @@ if (typeof path === 'undefined') {
22
22
  const zipDirPath = join(path, '/bin/release');
23
23
  // const zipDirPath = join(path, '');
24
24
  const zipDirFiles = fs.readdirSync(zipDirPath);
25
- const zipFile = zipDirFiles.find(file => extname(file).toLowerCase() === '.js');
25
+ const zipFile = zipDirFiles.find(file => extname(file).toLowerCase() === '.zip');
26
26
  console.log(join(zipDirPath, zipFile));
27
27
 
28
28
  const envArgument = args.find(a => ['-env', '--environment'].includes(a));
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@tywalk/pcf-helper",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "Command line helper for building and publishing PCF controls to Dataverse.",
5
-
6
5
  "scripts": {
7
6
  "deploy": "node .\\deploy.js -p ."
8
7
  },
@@ -11,9 +10,9 @@
11
10
  ],
12
11
  "author": "tywalk",
13
12
  "bin": {
14
- "upgrade": "bin/upgrade.js",
15
- "build": "bin/build.js",
16
- "import": "bin/import.js",
17
- "deploy": "bin/deploy.js"
13
+ "pcf-helper-upgrade": "bin/upgrade.js",
14
+ "pcf-helper-build": "bin/build.js",
15
+ "pcf-helper-import": "bin/import.js",
16
+ "pcf-helper-deploy": "bin/deploy.js"
18
17
  }
19
18
  }
@@ -1,7 +1,13 @@
1
- const { exec } = require('child_process');
1
+ const { spawnSync } = require('child_process');
2
2
 
3
3
  function run(path) {
4
- exec(`dotnet build --restore -c Release ${path}`);
4
+ const task = spawnSync('dotnet build', ['--restore', '-c', 'Release', path], {
5
+ cwd: process.cwd,
6
+ detached: true,
7
+ stdio: 'inherit',
8
+ });
9
+
10
+ console.log('Build complete!: ', task.status);
5
11
  }
6
12
 
7
13
  exports.run = run;
@@ -1,10 +1,16 @@
1
- const { exec } = require('child_process');
1
+ const { spawnSync } = require('child_process');
2
2
 
3
3
  function run(path, env) {
4
4
  if (!env) {
5
5
  console.warn('Path argument not provided. Assuming active auth profile organization.');
6
6
  }
7
- exec(`pac solution import -env ${env} -p ${path} -pc`);
7
+ const task = spawnSync('pac solution import', ['-env', env, '-p', path, '-pc'], {
8
+ cwd: process.cwd,
9
+ detached: true,
10
+ stdio: 'inherit',
11
+ });
12
+
13
+ console.log('Import complete!: ', task.status);
8
14
  }
9
15
 
10
16
  exports.run = run;
@@ -1,7 +1,13 @@
1
- const { exec } = require('child_process');
1
+ const { spawnSync } = require('child_process');
2
2
 
3
3
  function run(path) {
4
- exec(`pac solution version -s Solution -sp ${path} && pac pcf version -s Manifest && npm version patch`);
4
+ const task = spawnSync(`pac solution version -s Solution -sp ${path} && pac pcf version -s Manifest && npm version patch`, {
5
+ cwd: process.cwd,
6
+ detached: true,
7
+ stdio: 'inherit',
8
+ });
9
+
10
+ console.log('Upgrade complete!: ', task.status);
5
11
  }
6
12
 
7
13
  exports.run = run;