@tywalk/pcf-helper 1.4.18 → 1.4.21
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/dist/__tests__/pcf-helper-init.test.js +37 -0
- package/dist/bin/build.js +1 -1
- package/dist/bin/deploy.js +3 -3
- package/dist/bin/import.js +1 -1
- package/dist/bin/init.js +8 -2
- package/dist/bin/upgrade.js +1 -1
- package/dist/package.json +2 -2
- package/dist/tasks/build-pcf.js +2 -2
- package/dist/tasks/import-pcf.js +2 -2
- package/dist/tasks/index.js +4 -1
- package/dist/tasks/init-pcf.js +19 -7
- package/dist/tasks/upgrade-pcf.js +2 -2
- package/package.json +2 -2
- package/types/__tests__/pcf-helper-init.test.d.ts +1 -0
- package/types/tasks/build-pcf.d.ts +2 -2
- package/types/tasks/import-pcf.d.ts +2 -2
- package/types/tasks/index.d.ts +4 -1
- package/types/tasks/init-pcf.d.ts +2 -2
- package/types/tasks/upgrade-pcf.d.ts +2 -2
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const child_process_1 = require("child_process");
|
|
4
|
+
const package_json_1 = require("../package.json");
|
|
5
|
+
test('init displays version', (done) => {
|
|
6
|
+
const task = (0, child_process_1.spawn)('node', ['./dist/bin/init.js', '-v']);
|
|
7
|
+
let output = '';
|
|
8
|
+
task.stdout.on('data', (data) => {
|
|
9
|
+
output += data.toString();
|
|
10
|
+
});
|
|
11
|
+
task.on('close', (code) => {
|
|
12
|
+
console.log(output);
|
|
13
|
+
expect(output).toContain(package_json_1.version);
|
|
14
|
+
expect(code).toBe(0);
|
|
15
|
+
done();
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
test('init errors if no path is provided', (done) => {
|
|
19
|
+
const task = (0, child_process_1.spawn)('node', ['./dist/bin/init.js', '-p']);
|
|
20
|
+
let output = '';
|
|
21
|
+
task.stdout.on('data', (data) => {
|
|
22
|
+
output += data.toString();
|
|
23
|
+
});
|
|
24
|
+
task.stderr.on('data', (data) => {
|
|
25
|
+
console.error(`stderr: ${data}`);
|
|
26
|
+
});
|
|
27
|
+
task.on('close', (code) => {
|
|
28
|
+
console.log(output);
|
|
29
|
+
expect(code).toBe(1);
|
|
30
|
+
done();
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
// test('init creates pcf', () => {
|
|
34
|
+
// logger.setDebug(true);
|
|
35
|
+
// const result = runInit('./tests', 'test', 'testpb', 'tb', false, true);
|
|
36
|
+
// expect(result).toBe(0);
|
|
37
|
+
// });
|
package/dist/bin/build.js
CHANGED
|
@@ -63,4 +63,4 @@ if (typeof path === 'undefined') {
|
|
|
63
63
|
color_logger_1.default.error('Path argument is required. Use --path to specify the path to solution folder.');
|
|
64
64
|
process.exit(1);
|
|
65
65
|
}
|
|
66
|
-
task.
|
|
66
|
+
task.runBuild(path, verboseArgument !== undefined);
|
package/dist/bin/deploy.js
CHANGED
|
@@ -74,13 +74,13 @@ if (envIndex > 0) {
|
|
|
74
74
|
env = (_d = args.at(envIndex)) !== null && _d !== void 0 ? _d : '';
|
|
75
75
|
}
|
|
76
76
|
function executeTasks() {
|
|
77
|
-
const upgradeResult = upgradeTask.
|
|
77
|
+
const upgradeResult = upgradeTask.runUpgrade(path, typeof verboseArgument !== 'undefined');
|
|
78
78
|
if (upgradeResult === 1)
|
|
79
79
|
return 1;
|
|
80
|
-
const buildResult = buildTask.
|
|
80
|
+
const buildResult = buildTask.runBuild(path, typeof verboseArgument !== 'undefined');
|
|
81
81
|
if (buildResult === 1)
|
|
82
82
|
return 1;
|
|
83
|
-
const importResult = importTask.
|
|
83
|
+
const importResult = importTask.runImport(path, env, typeof verboseArgument !== 'undefined');
|
|
84
84
|
if (importResult === 1)
|
|
85
85
|
return 1;
|
|
86
86
|
return 0;
|
package/dist/bin/import.js
CHANGED
package/dist/bin/init.js
CHANGED
|
@@ -36,7 +36,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
38
|
};
|
|
39
|
-
var _a, _b, _c, _d, _e;
|
|
39
|
+
var _a, _b, _c, _d, _e, _f;
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
41
|
const task = __importStar(require("../tasks/init-pcf"));
|
|
42
42
|
const package_json_1 = require("../package.json");
|
|
@@ -81,4 +81,10 @@ if (typeof pathArgument !== 'undefined') {
|
|
|
81
81
|
const pathIndex = args.indexOf(pathArgument) + 1;
|
|
82
82
|
path = (_e = args.at(pathIndex)) !== null && _e !== void 0 ? _e : '';
|
|
83
83
|
}
|
|
84
|
-
|
|
84
|
+
let npm = '';
|
|
85
|
+
const npmArgument = args.find(a => ['-npm', '--run-npm-install'].includes(a));
|
|
86
|
+
if (typeof npmArgument !== 'undefined') {
|
|
87
|
+
const pathIndex = args.indexOf(npmArgument) + 1;
|
|
88
|
+
npm = (_f = args.at(pathIndex)) !== null && _f !== void 0 ? _f : '';
|
|
89
|
+
}
|
|
90
|
+
task.runInit(path, name, publisherName, publisherPrefix, npm === 'true', verboseArgument !== undefined);
|
package/dist/bin/upgrade.js
CHANGED
|
@@ -63,4 +63,4 @@ if (typeof path === 'undefined') {
|
|
|
63
63
|
color_logger_1.default.error('Path argument is required. Use --path to specify the path to solution folder.');
|
|
64
64
|
process.exit(1);
|
|
65
65
|
}
|
|
66
|
-
task.
|
|
66
|
+
task.runUpgrade(path, verboseArgument !== undefined);
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tywalk/pcf-helper",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.21",
|
|
4
4
|
"description": "Command line helper for building and publishing PCF controls to Dataverse.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "./types/",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"test": "jest",
|
|
16
16
|
"build": "tsc",
|
|
17
17
|
"upgrade": "npm version patch --no-git-tag-version",
|
|
18
|
-
"ready": "npm run upgrade
|
|
18
|
+
"ready": "npm run upgrade"
|
|
19
19
|
},
|
|
20
20
|
"keywords": [
|
|
21
21
|
"pcf"
|
package/dist/tasks/build-pcf.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.runBuild = runBuild;
|
|
7
7
|
const child_process_1 = require("child_process");
|
|
8
8
|
const performanceUtil_1 = require("../util/performanceUtil");
|
|
9
9
|
const color_logger_1 = __importDefault(require("@tywalk/color-logger"));
|
|
@@ -15,7 +15,7 @@ const color_logger_1 = __importDefault(require("@tywalk/color-logger"));
|
|
|
15
15
|
*
|
|
16
16
|
* @returns {number} The exit code of the spawned process.
|
|
17
17
|
*/
|
|
18
|
-
function
|
|
18
|
+
function runBuild(path, verbose) {
|
|
19
19
|
color_logger_1.default.log('[PCF Helper] ' + (0, performanceUtil_1.formatTime)(new Date()) + ' Starting build...\n');
|
|
20
20
|
const tick = performance.now();
|
|
21
21
|
const task = (0, child_process_1.spawnSync)('dotnet build', ['--restore', '-c', 'Release', path], {
|
package/dist/tasks/import-pcf.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.runImport = runImport;
|
|
7
7
|
const child_process_1 = require("child_process");
|
|
8
8
|
const path_1 = require("path");
|
|
9
9
|
const fs_1 = __importDefault(require("fs"));
|
|
@@ -18,7 +18,7 @@ const performanceUtil_1 = require("../util/performanceUtil");
|
|
|
18
18
|
*
|
|
19
19
|
* @returns {number} The exit status of the import process.
|
|
20
20
|
*/
|
|
21
|
-
function
|
|
21
|
+
function runImport(path, env, verbose) {
|
|
22
22
|
var _a;
|
|
23
23
|
color_logger_1.default.log('[PCF Helper] ' + (0, performanceUtil_1.formatTime)(new Date()) + ' Starting import...\n');
|
|
24
24
|
const tick = performance.now();
|
package/dist/tasks/index.js
CHANGED
|
@@ -14,4 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("
|
|
17
|
+
__exportStar(require("./build-pcf"), exports);
|
|
18
|
+
__exportStar(require("./import-pcf"), exports);
|
|
19
|
+
__exportStar(require("./init-pcf"), exports);
|
|
20
|
+
__exportStar(require("./upgrade-pcf"), exports);
|
package/dist/tasks/init-pcf.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.runInit = runInit;
|
|
7
7
|
const child_process_1 = require("child_process");
|
|
8
8
|
const path_1 = require("path");
|
|
9
9
|
const fs_1 = __importDefault(require("fs"));
|
|
@@ -22,27 +22,39 @@ function pcfExistsInParent(path) {
|
|
|
22
22
|
}
|
|
23
23
|
throw new Error('PCF project not found.');
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function runInit(path, name, publisherName, publisherPrefix, npm, verbose) {
|
|
26
26
|
color_logger_1.default.log('[PCF Helper] ' + (0, performanceUtil_1.formatTime)(new Date()) + ' Starting init...\n');
|
|
27
27
|
const tick = performance.now();
|
|
28
28
|
path = path !== null && path !== void 0 ? path : process.cwd();
|
|
29
|
+
const initTask = (0, child_process_1.spawnSync)('pac pcf init', ['-ns', publisherPrefix, '-n', name, '-t', 'field', '-fw', 'react', '-o', path, '-npm', npm ? 'true' : 'false'], {
|
|
30
|
+
cwd: process.cwd(),
|
|
31
|
+
stdio: 'inherit',
|
|
32
|
+
shell: true,
|
|
33
|
+
timeout: 1000 * 60 * 5, // 5 minutes
|
|
34
|
+
});
|
|
35
|
+
if (initTask.status !== 0) {
|
|
36
|
+
return (0, performanceUtil_1.handleTaskCompletion)(initTask, 'init', performance.now() - tick, verbose);
|
|
37
|
+
}
|
|
29
38
|
let pathFiles = fs_1.default.readdirSync(path);
|
|
30
39
|
let atRoot = pathFiles.some(file => (0, path_1.extname)(file).toLowerCase() === '.pcfproj');
|
|
31
40
|
const cdsPath = atRoot ? (0, path_1.join)(path, 'Solutions', name) : (0, path_1.join)(path, name);
|
|
32
|
-
|
|
41
|
+
color_logger_1.default.log('[PCF Helper] ' + (0, performanceUtil_1.formatTime)(new Date()) + ' Initializing solution...\n');
|
|
42
|
+
const solutionTask = (0, child_process_1.spawnSync)('pac solution init', ['-pn', publisherName, '-pp', publisherPrefix, '-o', cdsPath], {
|
|
33
43
|
cwd: process.cwd(),
|
|
34
44
|
stdio: 'inherit',
|
|
35
45
|
shell: true,
|
|
36
46
|
timeout: 1000 * 60 * 5, // 5 minutes
|
|
37
47
|
});
|
|
38
|
-
if (
|
|
39
|
-
return (0, performanceUtil_1.handleTaskCompletion)(
|
|
48
|
+
if (solutionTask.status !== 0) {
|
|
49
|
+
return (0, performanceUtil_1.handleTaskCompletion)(solutionTask, 'init', performance.now() - tick, verbose);
|
|
40
50
|
}
|
|
41
51
|
if (!atRoot) {
|
|
42
52
|
path = pcfExistsInParent(path);
|
|
43
53
|
}
|
|
44
|
-
const
|
|
45
|
-
|
|
54
|
+
const pcfProjPath = fs_1.default.realpathSync(path);
|
|
55
|
+
color_logger_1.default.log('[PCF Helper] ' + (0, performanceUtil_1.formatTime)(new Date()) + ' Adding solution reference...', pcfProjPath);
|
|
56
|
+
const packageTask = (0, child_process_1.spawnSync)('pac solution add-reference', ['-p', pcfProjPath], {
|
|
57
|
+
cwd: cdsPath,
|
|
46
58
|
stdio: 'inherit',
|
|
47
59
|
shell: true,
|
|
48
60
|
timeout: 1000 * 60 * 5, // 5 minutes
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.runUpgrade = runUpgrade;
|
|
7
7
|
const child_process_1 = require("child_process");
|
|
8
8
|
const performanceUtil_1 = require("../util/performanceUtil");
|
|
9
9
|
const color_logger_1 = __importDefault(require("@tywalk/color-logger"));
|
|
@@ -15,7 +15,7 @@ const color_logger_1 = __importDefault(require("@tywalk/color-logger"));
|
|
|
15
15
|
*
|
|
16
16
|
* @returns {number} The exit code of the spawned process.
|
|
17
17
|
*/
|
|
18
|
-
function
|
|
18
|
+
function runUpgrade(path, verbose) {
|
|
19
19
|
color_logger_1.default.log('[PCF Helper] ' + (0, performanceUtil_1.formatTime)(new Date()) + ' Starting upgrade...\n');
|
|
20
20
|
const tick = performance.now();
|
|
21
21
|
const task = (0, child_process_1.spawnSync)(`pac solution version -s Solution -sp ${path} && pac pcf version -s Manifest && npm version patch --no-git-tag-version`, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tywalk/pcf-helper",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.21",
|
|
4
4
|
"description": "Command line helper for building and publishing PCF controls to Dataverse.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "./types/",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"test": "jest",
|
|
16
16
|
"build": "tsc",
|
|
17
17
|
"upgrade": "npm version patch --no-git-tag-version",
|
|
18
|
-
"ready": "npm run upgrade
|
|
18
|
+
"ready": "npm run upgrade"
|
|
19
19
|
},
|
|
20
20
|
"keywords": [
|
|
21
21
|
"pcf"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -7,5 +7,5 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @returns {number} The exit status of the import process.
|
|
9
9
|
*/
|
|
10
|
-
declare function
|
|
11
|
-
export {
|
|
10
|
+
declare function runImport(path: string, env: string, verbose?: boolean): number;
|
|
11
|
+
export { runImport };
|
package/types/tasks/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function
|
|
2
|
-
export {
|
|
1
|
+
declare function runInit(path: string, name: string, publisherName: string, publisherPrefix: string, npm: boolean, verbose: boolean): number;
|
|
2
|
+
export { runInit };
|