@tywalk/pcf-helper 1.4.21 → 1.4.22
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/bin/build.js +2 -7
- package/dist/bin/deploy.js +3 -7
- package/dist/bin/import.js +4 -14
- package/dist/bin/init.js +8 -33
- package/dist/bin/upgrade.js +2 -7
- package/dist/package.json +1 -1
- package/dist/tasks/init-pcf.js +1 -0
- package/dist/util/argumentUtil.js +20 -0
- package/package.json +1 -1
- package/types/util/argumentUtil.d.ts +2 -0
package/dist/bin/build.js
CHANGED
|
@@ -41,6 +41,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
41
41
|
const task = __importStar(require("../tasks/build-pcf"));
|
|
42
42
|
const package_json_1 = require("../package.json");
|
|
43
43
|
const color_logger_1 = __importDefault(require("@tywalk/color-logger"));
|
|
44
|
+
const argumentUtil_1 = require("../util/argumentUtil");
|
|
44
45
|
const [, , ...args] = process.argv;
|
|
45
46
|
const commandArgument = (_b = (_a = args.at(0)) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== null && _b !== void 0 ? _b : '';
|
|
46
47
|
if (['-v', '--version'].includes(commandArgument)) {
|
|
@@ -52,13 +53,7 @@ if (typeof verboseArgument !== 'undefined') {
|
|
|
52
53
|
color_logger_1.default.setDebug(true);
|
|
53
54
|
}
|
|
54
55
|
color_logger_1.default.log('PCF Helper version', package_json_1.version);
|
|
55
|
-
const
|
|
56
|
-
if (typeof pathArgument === 'undefined') {
|
|
57
|
-
color_logger_1.default.error('Path argument is required. Use --path to specify the path to solution folder.');
|
|
58
|
-
process.exit(1);
|
|
59
|
-
}
|
|
60
|
-
const pathIndex = args.indexOf(pathArgument) + 1;
|
|
61
|
-
const path = args.at(pathIndex);
|
|
56
|
+
const path = (0, argumentUtil_1.getArgValue)(args, ['-p', '--path']);
|
|
62
57
|
if (typeof path === 'undefined') {
|
|
63
58
|
color_logger_1.default.error('Path argument is required. Use --path to specify the path to solution folder.');
|
|
64
59
|
process.exit(1);
|
package/dist/bin/deploy.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
|
|
39
|
+
var _a, _b, _c;
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
41
|
const upgradeTask = __importStar(require("../tasks/upgrade-pcf"));
|
|
42
42
|
const buildTask = __importStar(require("../tasks/build-pcf"));
|
|
@@ -44,6 +44,7 @@ const importTask = __importStar(require("../tasks/import-pcf"));
|
|
|
44
44
|
const performanceUtil_1 = require("../util/performanceUtil");
|
|
45
45
|
const package_json_1 = require("../package.json");
|
|
46
46
|
const color_logger_1 = __importDefault(require("@tywalk/color-logger"));
|
|
47
|
+
const argumentUtil_1 = require("../util/argumentUtil");
|
|
47
48
|
const [, , ...args] = process.argv;
|
|
48
49
|
const commandArgument = (_b = (_a = args.at(0)) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== null && _b !== void 0 ? _b : '';
|
|
49
50
|
if (['-v', '--version'].includes(commandArgument)) {
|
|
@@ -67,12 +68,7 @@ if (typeof path === 'undefined') {
|
|
|
67
68
|
process.exit(1);
|
|
68
69
|
}
|
|
69
70
|
const tick = performance.now();
|
|
70
|
-
const
|
|
71
|
-
let envIndex = args.indexOf(envArgument) + 1;
|
|
72
|
-
let env = '';
|
|
73
|
-
if (envIndex > 0) {
|
|
74
|
-
env = (_d = args.at(envIndex)) !== null && _d !== void 0 ? _d : '';
|
|
75
|
-
}
|
|
71
|
+
const env = (_c = (0, argumentUtil_1.getArgValue)(args, ['-env', '--environment'])) !== null && _c !== void 0 ? _c : '';
|
|
76
72
|
function executeTasks() {
|
|
77
73
|
const upgradeResult = upgradeTask.runUpgrade(path, typeof verboseArgument !== 'undefined');
|
|
78
74
|
if (upgradeResult === 1)
|
package/dist/bin/import.js
CHANGED
|
@@ -36,11 +36,12 @@ 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
|
|
39
|
+
var _a, _b, _c;
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
41
|
const task = __importStar(require("../tasks/import-pcf"));
|
|
42
42
|
const package_json_1 = require("../package.json");
|
|
43
43
|
const color_logger_1 = __importDefault(require("@tywalk/color-logger"));
|
|
44
|
+
const argumentUtil_1 = require("../util/argumentUtil");
|
|
44
45
|
const [, , ...args] = process.argv;
|
|
45
46
|
const commandArgument = (_b = (_a = args.at(0)) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== null && _b !== void 0 ? _b : '';
|
|
46
47
|
if (['-v', '--version'].includes(commandArgument)) {
|
|
@@ -52,21 +53,10 @@ if (typeof verboseArgument !== 'undefined') {
|
|
|
52
53
|
color_logger_1.default.setDebug(true);
|
|
53
54
|
}
|
|
54
55
|
color_logger_1.default.log('PCF Helper version', package_json_1.version);
|
|
55
|
-
const
|
|
56
|
-
if (typeof pathArgument === 'undefined') {
|
|
57
|
-
color_logger_1.default.error('Path argument is required. Use --path to specify the path to solution folder.');
|
|
58
|
-
process.exit(1);
|
|
59
|
-
}
|
|
60
|
-
const pathIndex = args.indexOf(pathArgument) + 1;
|
|
61
|
-
const path = args.at(pathIndex);
|
|
56
|
+
const path = (0, argumentUtil_1.getArgValue)(args, ['-p', '--path']);
|
|
62
57
|
if (typeof path === 'undefined') {
|
|
63
58
|
color_logger_1.default.error('Path argument is required. Use --path to specify the path to solution folder.');
|
|
64
59
|
process.exit(1);
|
|
65
60
|
}
|
|
66
|
-
const
|
|
67
|
-
let envIndex = args.indexOf(envArgument) + 1;
|
|
68
|
-
let env = '';
|
|
69
|
-
if (envIndex > 0) {
|
|
70
|
-
env = (_d = args.at(envIndex)) !== null && _d !== void 0 ? _d : '';
|
|
71
|
-
}
|
|
61
|
+
const env = (_c = (0, argumentUtil_1.getArgValue)(args, ['-env', '--environment'])) !== null && _c !== void 0 ? _c : '';
|
|
72
62
|
task.runImport(path, env);
|
package/dist/bin/init.js
CHANGED
|
@@ -36,11 +36,12 @@ 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;
|
|
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");
|
|
43
43
|
const color_logger_1 = __importDefault(require("@tywalk/color-logger"));
|
|
44
|
+
const argumentUtil_1 = require("../util/argumentUtil");
|
|
44
45
|
const [, , ...args] = process.argv;
|
|
45
46
|
const commandArgument = (_b = (_a = args.at(0)) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== null && _b !== void 0 ? _b : '';
|
|
46
47
|
if (['-v', '--version'].includes(commandArgument)) {
|
|
@@ -52,39 +53,13 @@ if (typeof verboseArgument !== 'undefined') {
|
|
|
52
53
|
color_logger_1.default.setDebug(true);
|
|
53
54
|
}
|
|
54
55
|
color_logger_1.default.log('PCF Helper version', package_json_1.version);
|
|
55
|
-
const
|
|
56
|
-
if (typeof nameArgument === 'undefined') {
|
|
57
|
-
color_logger_1.default.error('Name argument is required. Use --name to specify the name of the control.');
|
|
58
|
-
process.exit(1);
|
|
59
|
-
}
|
|
60
|
-
const nameIndex = args.indexOf(nameArgument) + 1;
|
|
61
|
-
const name = args.at(nameIndex);
|
|
56
|
+
const name = (0, argumentUtil_1.getArgValue)(args, ['-n', '--name']);
|
|
62
57
|
if (typeof name === 'undefined') {
|
|
63
|
-
color_logger_1.default.error('
|
|
58
|
+
color_logger_1.default.error('Name argument is required. Use --name to specify the name of the PCF control.');
|
|
64
59
|
process.exit(1);
|
|
65
60
|
}
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
publisherName = (_c = args.at(publisherNameIndex)) !== null && _c !== void 0 ? _c : '';
|
|
71
|
-
}
|
|
72
|
-
let publisherPrefix = '';
|
|
73
|
-
const publisherPrefixArgument = args.find(a => ['-pp', '--publisher-prefix'].includes(a));
|
|
74
|
-
if (typeof publisherPrefixArgument !== 'undefined') {
|
|
75
|
-
const publisherPrefixIndex = args.indexOf(publisherPrefixArgument) + 1;
|
|
76
|
-
publisherPrefix = (_d = args.at(publisherPrefixIndex)) !== null && _d !== void 0 ? _d : '';
|
|
77
|
-
}
|
|
78
|
-
let path = '';
|
|
79
|
-
const pathArgument = args.find(a => ['-p', '--path'].includes(a));
|
|
80
|
-
if (typeof pathArgument !== 'undefined') {
|
|
81
|
-
const pathIndex = args.indexOf(pathArgument) + 1;
|
|
82
|
-
path = (_e = args.at(pathIndex)) !== null && _e !== void 0 ? _e : '';
|
|
83
|
-
}
|
|
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
|
-
}
|
|
61
|
+
const publisherName = (_c = (0, argumentUtil_1.getArgValue)(args, ['-pn', '--publisher-name'])) !== null && _c !== void 0 ? _c : '';
|
|
62
|
+
const publisherPrefix = (_d = (0, argumentUtil_1.getArgValue)(args, ['-pp', '--publisher-prefix'])) !== null && _d !== void 0 ? _d : '';
|
|
63
|
+
const path = (_e = (0, argumentUtil_1.getArgValue)(args, ['-p', '--path'])) !== null && _e !== void 0 ? _e : '';
|
|
64
|
+
const npm = (0, argumentUtil_1.getArgValue)(args, ['-npm', '--run-npm-install'], 'true');
|
|
90
65
|
task.runInit(path, name, publisherName, publisherPrefix, npm === 'true', verboseArgument !== undefined);
|
package/dist/bin/upgrade.js
CHANGED
|
@@ -41,6 +41,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
41
41
|
const task = __importStar(require("../tasks/upgrade-pcf"));
|
|
42
42
|
const package_json_1 = require("../package.json");
|
|
43
43
|
const color_logger_1 = __importDefault(require("@tywalk/color-logger"));
|
|
44
|
+
const argumentUtil_1 = require("../util/argumentUtil");
|
|
44
45
|
const [, , ...args] = process.argv;
|
|
45
46
|
const commandArgument = (_b = (_a = args.at(0)) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== null && _b !== void 0 ? _b : '';
|
|
46
47
|
if (['-v', '--version'].includes(commandArgument)) {
|
|
@@ -52,13 +53,7 @@ if (typeof verboseArgument !== 'undefined') {
|
|
|
52
53
|
color_logger_1.default.setDebug(true);
|
|
53
54
|
}
|
|
54
55
|
color_logger_1.default.log('PCF Helper version', package_json_1.version);
|
|
55
|
-
const
|
|
56
|
-
if (typeof pathArgument === 'undefined') {
|
|
57
|
-
color_logger_1.default.error('Path argument is required. Use --path to specify the path to solution folder.');
|
|
58
|
-
process.exit(1);
|
|
59
|
-
}
|
|
60
|
-
const pathIndex = args.indexOf(pathArgument) + 1;
|
|
61
|
-
const path = args.at(pathIndex);
|
|
56
|
+
const path = (0, argumentUtil_1.getArgValue)(args, ['-p', '--path']);
|
|
62
57
|
if (typeof path === 'undefined') {
|
|
63
58
|
color_logger_1.default.error('Path argument is required. Use --path to specify the path to solution folder.');
|
|
64
59
|
process.exit(1);
|
package/dist/package.json
CHANGED
package/dist/tasks/init-pcf.js
CHANGED
|
@@ -37,6 +37,7 @@ function runInit(path, name, publisherName, publisherPrefix, npm, verbose) {
|
|
|
37
37
|
}
|
|
38
38
|
let pathFiles = fs_1.default.readdirSync(path);
|
|
39
39
|
let atRoot = pathFiles.some(file => (0, path_1.extname)(file).toLowerCase() === '.pcfproj');
|
|
40
|
+
name += 'PCF'; // Prevent cdsproj from conflicting with pcfproj
|
|
40
41
|
const cdsPath = atRoot ? (0, path_1.join)(path, 'Solutions', name) : (0, path_1.join)(path, name);
|
|
41
42
|
color_logger_1.default.log('[PCF Helper] ' + (0, performanceUtil_1.formatTime)(new Date()) + ' Initializing solution...\n');
|
|
42
43
|
const solutionTask = (0, child_process_1.spawnSync)('pac solution init', ['-pn', publisherName, '-pp', publisherPrefix, '-o', cdsPath], {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getArg = getArg;
|
|
4
|
+
exports.getArgValue = getArgValue;
|
|
5
|
+
function getArg(args, arg) {
|
|
6
|
+
const index = args.indexOf(arg);
|
|
7
|
+
if (index !== -1 && index + 1 < args.length) {
|
|
8
|
+
return args[index + 1];
|
|
9
|
+
}
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
function getArgValue(args, argOpts, defaultIfExists) {
|
|
13
|
+
var _a;
|
|
14
|
+
const arg = args.find(a => argOpts.includes(a));
|
|
15
|
+
if (typeof arg === 'undefined') {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
const argIndex = args.indexOf(arg) + 1;
|
|
19
|
+
return (_a = args.at(argIndex)) !== null && _a !== void 0 ? _a : defaultIfExists;
|
|
20
|
+
}
|
package/package.json
CHANGED