@tywalk/pcf-helper 1.3.4 → 1.3.5
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/deploy.js +23 -6
- package/package.json +1 -1
- package/tasks/build-pcf.js +15 -2
- package/tasks/import-pcf.js +15 -2
- package/tasks/upgrade-pcf.js +15 -2
package/bin/deploy.js
CHANGED
|
@@ -17,6 +17,8 @@ if (typeof path === 'undefined') {
|
|
|
17
17
|
return 1;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
const tick = performance.now();
|
|
21
|
+
|
|
20
22
|
const envArgument = args.find(a => ['-env', '--environment'].includes(a));
|
|
21
23
|
let envIndex = args.indexOf(envArgument) + 1;
|
|
22
24
|
let env = '';
|
|
@@ -24,9 +26,24 @@ if (envIndex > 0) {
|
|
|
24
26
|
env = args.at(envIndex);
|
|
25
27
|
}
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
function executeTasks() {
|
|
30
|
+
const upgradeResult = upgradeTask.run(path);
|
|
31
|
+
if (upgradeResult === 1) return 1;
|
|
32
|
+
const buildResult = buildTask.run(path);
|
|
33
|
+
if (buildResult === 1) return 1;
|
|
34
|
+
const importResult = importTask.run(path, env);
|
|
35
|
+
if (importResult === 1) return 1;
|
|
36
|
+
return 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
const result = executeTasks();
|
|
41
|
+
if (result === 0) {
|
|
42
|
+
console.log('Deploy complete!');
|
|
43
|
+
}
|
|
44
|
+
} catch (e) {
|
|
45
|
+
console.error('One or more tasks failed while deploying: ', (e && e.message) || 'unkown error');
|
|
46
|
+
} finally {
|
|
47
|
+
const tock = performance.now();
|
|
48
|
+
console.log('Deploy finished in %d ms.', tick - tock);
|
|
49
|
+
}
|
package/package.json
CHANGED
package/tasks/build-pcf.js
CHANGED
|
@@ -1,13 +1,26 @@
|
|
|
1
1
|
const { spawnSync } = require('child_process');
|
|
2
2
|
|
|
3
3
|
function run(path) {
|
|
4
|
+
const tick = performance.now();
|
|
4
5
|
const task = spawnSync('dotnet build', ['--restore', '-c', 'Release', path], {
|
|
5
6
|
cwd: process.cwd(),
|
|
6
7
|
stdio: 'inherit',
|
|
7
|
-
shell: true
|
|
8
|
+
shell: true,
|
|
9
|
+
timeout: 1000 * 60 * 5 // 5 minutes
|
|
8
10
|
});
|
|
11
|
+
const tock = performance.now();
|
|
9
12
|
|
|
10
|
-
|
|
13
|
+
if (task.status === 0) {
|
|
14
|
+
console.log('Build complete!');
|
|
15
|
+
} else {
|
|
16
|
+
if (task.error) {
|
|
17
|
+
console.error('Unable to complete build: ', task.error.message);
|
|
18
|
+
console.debug('Error details: ', task.error.name, task.error.stack);
|
|
19
|
+
} else {
|
|
20
|
+
console.error('Unable to complete build: One or more errors ocurred.');
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
console.log('Build finished in %d ms.', tick - tock);
|
|
11
24
|
return task.status;
|
|
12
25
|
}
|
|
13
26
|
|
package/tasks/import-pcf.js
CHANGED
|
@@ -3,6 +3,7 @@ const { join, extname } = require('path');
|
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
|
|
5
5
|
function run(path, env) {
|
|
6
|
+
const tick = performance.now();
|
|
6
7
|
if (!env) {
|
|
7
8
|
console.warn('Path argument not provided. Assuming active auth profile organization.');
|
|
8
9
|
}
|
|
@@ -16,10 +17,22 @@ function run(path, env) {
|
|
|
16
17
|
const task = spawnSync('pac solution import', ['-env', env, '-p', zipFilePath, '-pc'], {
|
|
17
18
|
cwd: process.cwd(),
|
|
18
19
|
stdio: 'inherit',
|
|
19
|
-
shell: true
|
|
20
|
+
shell: true,
|
|
21
|
+
timeout: 1000 * 60 * 2 // 2 minutes
|
|
20
22
|
});
|
|
23
|
+
const tock = performance.now();
|
|
21
24
|
|
|
22
|
-
|
|
25
|
+
if (task.status === 0) {
|
|
26
|
+
console.log('Import complete!');
|
|
27
|
+
} else {
|
|
28
|
+
if (task.error) {
|
|
29
|
+
console.error('Unable to complete import: ', task.error.message);
|
|
30
|
+
console.debug('Error details: ', task.error.name, task.error.stack);
|
|
31
|
+
} else {
|
|
32
|
+
console.error('Unable to complete import: One or more errors ocurred.');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
console.log('Import finished in %d ms.', tick - tock);
|
|
23
36
|
return task.status;
|
|
24
37
|
}
|
|
25
38
|
|
package/tasks/upgrade-pcf.js
CHANGED
|
@@ -1,13 +1,26 @@
|
|
|
1
1
|
const { spawnSync } = require('child_process');
|
|
2
2
|
|
|
3
3
|
function run(path) {
|
|
4
|
+
const tick = performance.now();
|
|
4
5
|
const task = spawnSync(`pac solution version -s Solution -sp ${path} && pac pcf version -s Manifest && npm version patch`, {
|
|
5
6
|
cwd: process.cwd(),
|
|
6
7
|
stdio: 'inherit',
|
|
7
|
-
shell: true
|
|
8
|
+
shell: true,
|
|
9
|
+
timeout: 1000 * 60 // 1 min
|
|
8
10
|
});
|
|
11
|
+
const tock = performance.now();
|
|
9
12
|
|
|
10
|
-
|
|
13
|
+
if (task.status === 0) {
|
|
14
|
+
console.log('Upgrade complete!');
|
|
15
|
+
} else {
|
|
16
|
+
if (task.error) {
|
|
17
|
+
console.error('Unable to complete upgrade: ', task.error.message);
|
|
18
|
+
console.debug('Error details: ', task.error.name, task.error.stack);
|
|
19
|
+
} else {
|
|
20
|
+
console.error('Unable to complete upgrade: One or more errors ocurred.');
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
console.log('Upgrade finished in %d ms.', tick - tock);
|
|
11
24
|
return task.status;
|
|
12
25
|
}
|
|
13
26
|
|