@tywalk/pcf-helper 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.
- package/bin/build.js +18 -0
- package/bin/deploy.js +37 -0
- package/bin/import.js +25 -0
- package/bin/upgrade.js +18 -0
- package/package.json +19 -0
- package/tasks/build-pcf.js +7 -0
- package/tasks/import-pcf.js +10 -0
- package/tasks/upgrade-pcf.js +7 -0
package/bin/build.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const task = require('../tasks/build-pcf');
|
|
3
|
+
const [, , ...args] = process.argv;
|
|
4
|
+
|
|
5
|
+
const pathArgument = args.find(a => ['-p', '--path'].includes(a));
|
|
6
|
+
if (typeof pathArgument === 'undefined') {
|
|
7
|
+
console.error('Path argument is required. Use --path to specify the path to solution folder.');
|
|
8
|
+
return 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const pathIndex = args.indexOf(pathArgument) + 1;
|
|
12
|
+
const path = args.at(pathIndex);
|
|
13
|
+
if (typeof path === 'undefined') {
|
|
14
|
+
console.error('Path argument is required. Use --path to specify the path to solution folder.');
|
|
15
|
+
return 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
task.run(path);
|
package/bin/deploy.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
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 fs = require('fs');
|
|
6
|
+
const { join, extname } = require('path');
|
|
7
|
+
const [, , ...args] = process.argv;
|
|
8
|
+
|
|
9
|
+
const pathArgument = args.find(a => ['-p', '--path'].includes(a));
|
|
10
|
+
if (typeof pathArgument === 'undefined') {
|
|
11
|
+
console.error('Path argument is required. Use --path to specify the path to solution folder.');
|
|
12
|
+
return 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const pathIndex = args.indexOf(pathArgument) + 1;
|
|
16
|
+
const path = args.at(pathIndex);
|
|
17
|
+
if (typeof path === 'undefined') {
|
|
18
|
+
console.error('Path argument is required. Use --path to specify the path to solution folder.');
|
|
19
|
+
return 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const zipDirPath = join(path, '/bin/release');
|
|
23
|
+
// const zipDirPath = join(path, '');
|
|
24
|
+
const zipDirFiles = fs.readdirSync(zipDirPath);
|
|
25
|
+
const zipFile = zipDirFiles.find(file => extname(file).toLowerCase() === '.js');
|
|
26
|
+
console.log(join(zipDirPath, zipFile));
|
|
27
|
+
|
|
28
|
+
const envArgument = args.find(a => ['-env', '--environment'].includes(a));
|
|
29
|
+
let envIndex = args.indexOf(envArgument) + 1;
|
|
30
|
+
let env = '';
|
|
31
|
+
if (envIndex > 0) {
|
|
32
|
+
env = args.at(envIndex);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
upgradeTask.run(path);
|
|
36
|
+
buildTask.run(path);
|
|
37
|
+
importTask.run(path, env);
|
package/bin/import.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const task = require('../tasks/import-pcf');
|
|
3
|
+
const [, , ...args] = process.argv;
|
|
4
|
+
|
|
5
|
+
const pathArgument = args.find(a => ['-p', '--path'].includes(a));
|
|
6
|
+
if (typeof pathArgument === 'undefined') {
|
|
7
|
+
console.error('Path argument is required. Use --path to specify the path to solution folder.');
|
|
8
|
+
return 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const pathIndex = args.indexOf(pathArgument) + 1;
|
|
12
|
+
const path = args.at(pathIndex);
|
|
13
|
+
if (typeof path === 'undefined') {
|
|
14
|
+
console.error('Path argument is required. Use --path to specify the path to solution folder.');
|
|
15
|
+
return 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const envArgument = args.find(a => ['-env', '--environment'].includes(a));
|
|
19
|
+
let envIndex = args.indexOf(envArgument) + 1;
|
|
20
|
+
let env = '';
|
|
21
|
+
if (envIndex > 0) {
|
|
22
|
+
env = args.at(envIndex);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
task.run(path, env);
|
package/bin/upgrade.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const task = require('../tasks/upgrade-pcf');
|
|
3
|
+
const [, , ...args] = process.argv;
|
|
4
|
+
|
|
5
|
+
const pathArgument = args.find(a => ['-p', '--path'].includes(a));
|
|
6
|
+
if (typeof pathArgument === 'undefined') {
|
|
7
|
+
console.error('Path argument is required. Use --path to specify the path to solution folder.');
|
|
8
|
+
return 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const pathIndex = args.indexOf(pathArgument) + 1;
|
|
12
|
+
const path = args.at(pathIndex);
|
|
13
|
+
if (typeof path === 'undefined') {
|
|
14
|
+
console.error('Path argument is required. Use --path to specify the path to solution folder.');
|
|
15
|
+
return 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
task.run(path);
|
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tywalk/pcf-helper",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Command line helper for building and publishing PCF controls to Dataverse.",
|
|
5
|
+
|
|
6
|
+
"scripts": {
|
|
7
|
+
"deploy": "node .\\deploy.js -p ."
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"pcf"
|
|
11
|
+
],
|
|
12
|
+
"author": "tywalk",
|
|
13
|
+
"bin": {
|
|
14
|
+
"upgrade": "bin/upgrade.js",
|
|
15
|
+
"build": "bin/build.js",
|
|
16
|
+
"import": "bin/import.js",
|
|
17
|
+
"deploy": "bin/deploy.js"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const { exec } = require('child_process');
|
|
2
|
+
|
|
3
|
+
function run(path, env) {
|
|
4
|
+
if (!env) {
|
|
5
|
+
console.warn('Path argument not provided. Assuming active auth profile organization.');
|
|
6
|
+
}
|
|
7
|
+
exec(`pac solution import -env ${env} -p ${path} -pc`);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
exports.run = run;
|