@tywalk/pcf-helper 1.3.2 → 1.3.4
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 +1 -1
- package/bin/deploy.js +11 -8
- package/bin/import.js +1 -1
- package/bin/upgrade.js +3 -3
- package/package.json +1 -1
- package/tasks/build-pcf.js +14 -0
- package/tasks/import-pcf.js +26 -0
- package/tasks/upgrade-pcf.js +14 -0
package/bin/build.js
CHANGED
package/bin/deploy.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const upgradeTask = require('
|
|
3
|
-
const buildTask = require('
|
|
4
|
-
const importTask = require('
|
|
2
|
+
const upgradeTask = require('../tasks/upgrade-pcf');
|
|
3
|
+
const buildTask = require('../tasks/build-pcf');
|
|
4
|
+
const importTask = require('../tasks/import-pcf');
|
|
5
5
|
const [, , ...args] = process.argv;
|
|
6
6
|
|
|
7
7
|
const pathArgument = args.find(a => ['-p', '--path'].includes(a));
|
|
8
8
|
if (typeof pathArgument === 'undefined') {
|
|
9
9
|
console.error('Path argument is required. Use --path to specify the path to solution folder.');
|
|
10
|
-
return
|
|
10
|
+
return 1;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
const pathIndex = args.indexOf(pathArgument) + 1;
|
|
14
14
|
const path = args.at(pathIndex);
|
|
15
15
|
if (typeof path === 'undefined') {
|
|
16
16
|
console.error('Path argument is required. Use --path to specify the path to solution folder.');
|
|
17
|
-
return
|
|
17
|
+
return 1;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
const envArgument = args.find(a => ['-env', '--environment'].includes(a));
|
|
@@ -24,6 +24,9 @@ if (envIndex > 0) {
|
|
|
24
24
|
env = args.at(envIndex);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
upgradeTask.run(path);
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
const upgradeResult = upgradeTask.run(path);
|
|
28
|
+
if (upgradeResult === 1) return;
|
|
29
|
+
const buildResult = buildTask.run(path);
|
|
30
|
+
if (buildResult === 1) return;
|
|
31
|
+
const importResult = importTask.run(path, env);
|
|
32
|
+
if (importResult === 1) return;
|
package/bin/import.js
CHANGED
package/bin/upgrade.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const task = require('
|
|
2
|
+
const task = require('../tasks/upgrade-pcf');
|
|
3
3
|
const [, , ...args] = process.argv;
|
|
4
4
|
|
|
5
5
|
const pathArgument = args.find(a => ['-p', '--path'].includes(a));
|
|
6
6
|
if (typeof pathArgument === 'undefined') {
|
|
7
7
|
console.error('Path argument is required. Use --path to specify the path to solution folder.');
|
|
8
|
-
return
|
|
8
|
+
return 1;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
const pathIndex = args.indexOf(pathArgument) + 1;
|
|
12
12
|
const path = args.at(pathIndex);
|
|
13
13
|
if (typeof path === 'undefined') {
|
|
14
14
|
console.error('Path argument is required. Use --path to specify the path to solution folder.');
|
|
15
|
-
return
|
|
15
|
+
return 1;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
task.run(path);
|
package/package.json
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const { spawnSync } = require('child_process');
|
|
2
|
+
|
|
3
|
+
function run(path) {
|
|
4
|
+
const task = spawnSync('dotnet build', ['--restore', '-c', 'Release', path], {
|
|
5
|
+
cwd: process.cwd(),
|
|
6
|
+
stdio: 'inherit',
|
|
7
|
+
shell: true
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
console.log('Build complete!: ', task.status);
|
|
11
|
+
return task.status;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
exports.run = run;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const { spawnSync } = require('child_process');
|
|
2
|
+
const { join, extname } = require('path');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
|
|
5
|
+
function run(path, env) {
|
|
6
|
+
if (!env) {
|
|
7
|
+
console.warn('Path argument not provided. Assuming active auth profile organization.');
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const zipDirPath = join(path, '/bin/release');
|
|
11
|
+
// const zipDirPath = join(path, '');
|
|
12
|
+
const zipDirFiles = fs.readdirSync(zipDirPath);
|
|
13
|
+
const zipFile = zipDirFiles.find(file => extname(file).toLowerCase() === '.zip');
|
|
14
|
+
const zipFilePath = join(zipDirPath, zipFile);
|
|
15
|
+
|
|
16
|
+
const task = spawnSync('pac solution import', ['-env', env, '-p', zipFilePath, '-pc'], {
|
|
17
|
+
cwd: process.cwd(),
|
|
18
|
+
stdio: 'inherit',
|
|
19
|
+
shell: true
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
console.log('Import complete!: ', task.status);
|
|
23
|
+
return task.status;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
exports.run = run;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const { spawnSync } = require('child_process');
|
|
2
|
+
|
|
3
|
+
function run(path) {
|
|
4
|
+
const task = spawnSync(`pac solution version -s Solution -sp ${path} && pac pcf version -s Manifest && npm version patch`, {
|
|
5
|
+
cwd: process.cwd(),
|
|
6
|
+
stdio: 'inherit',
|
|
7
|
+
shell: true
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
console.log('Upgrade complete!: ', task.status);
|
|
11
|
+
return task.status;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
exports.run = run;
|