@tywalk/pcf-helper-run 1.1.21 → 1.1.23
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-run.test.js +38 -0
- package/dist/index.js +37 -25
- package/dist/package.json +2 -2
- package/dist/util/argumentUtil.js +19 -0
- package/package.json +2 -2
- package/types/util/argumentUtil.d.ts +2 -0
|
@@ -1,7 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
const child_process_1 = require("child_process");
|
|
4
37
|
const package_json_1 = require("../package.json");
|
|
38
|
+
const tasks = __importStar(require("@tywalk/pcf-helper"));
|
|
5
39
|
test('displays version', (done) => {
|
|
6
40
|
const task = (0, child_process_1.spawn)('node', ['./dist/index.js', '-v']);
|
|
7
41
|
let output = '';
|
|
@@ -45,3 +79,7 @@ test('errors if incorrect command is provided', (done) => {
|
|
|
45
79
|
done();
|
|
46
80
|
});
|
|
47
81
|
});
|
|
82
|
+
test('runBuild exists', () => {
|
|
83
|
+
const exists = typeof (tasks === null || tasks === void 0 ? void 0 : tasks.runBuild) === 'function';
|
|
84
|
+
expect(exists).toBe(true);
|
|
85
|
+
});
|
package/dist/index.js
CHANGED
|
@@ -33,15 +33,13 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
return result;
|
|
34
34
|
};
|
|
35
35
|
})();
|
|
36
|
-
var _a, _b, _c
|
|
36
|
+
var _a, _b, _c;
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
const
|
|
39
|
-
const buildTask = __importStar(require("@tywalk/pcf-helper/dist/tasks/build-pcf"));
|
|
40
|
-
const importTask = __importStar(require("@tywalk/pcf-helper/dist/tasks/import-pcf"));
|
|
41
|
-
const initTask = __importStar(require("@tywalk/pcf-helper/dist/tasks/init-pcf"));
|
|
38
|
+
const tasks = __importStar(require("@tywalk/pcf-helper"));
|
|
42
39
|
const color_logger_1 = require("@tywalk/color-logger");
|
|
43
40
|
const package_json_1 = require("./package.json");
|
|
44
41
|
const performanceUtil_1 = require("./util/performanceUtil");
|
|
42
|
+
const argumentUtil_1 = require("./util/argumentUtil");
|
|
45
43
|
const [, , ...args] = process.argv;
|
|
46
44
|
const commandArgument = (_b = (_a = args.at(0)) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== null && _b !== void 0 ? _b : '';
|
|
47
45
|
if (['-v', '--version'].includes(commandArgument)) {
|
|
@@ -50,52 +48,66 @@ if (['-v', '--version'].includes(commandArgument)) {
|
|
|
50
48
|
}
|
|
51
49
|
const logger = new color_logger_1.Logger('log');
|
|
52
50
|
const verboseArgument = args.find(a => ['-v', '--verbose'].includes(a));
|
|
53
|
-
|
|
51
|
+
const isVerbose = verboseArgument !== undefined;
|
|
52
|
+
if (isVerbose) {
|
|
54
53
|
logger.setDebug(true);
|
|
55
54
|
}
|
|
56
55
|
logger.log('PCF Helper Run version\n', package_json_1.version);
|
|
57
56
|
if (typeof commandArgument === 'undefined' || !['upgrade', 'build', 'import', 'deploy', 'init'].includes(commandArgument)) {
|
|
58
|
-
logger.error('Command [command] (upgrade, build, import, deploy) is required.');
|
|
57
|
+
logger.error('Command [command] (upgrade, build, import, deploy, init) is required.');
|
|
59
58
|
process.exit(1);
|
|
60
59
|
}
|
|
61
60
|
const runAll = commandArgument === 'deploy';
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
logger.error('Path argument is required. Use --path to specify the path to solution folder.');
|
|
65
|
-
process.exit(1);
|
|
66
|
-
}
|
|
67
|
-
const pathIndex = args.indexOf(pathArgument) + 1;
|
|
68
|
-
const path = args.at(pathIndex);
|
|
61
|
+
const runInit = commandArgument === 'init';
|
|
62
|
+
const path = (0, argumentUtil_1.getArgValue)(args, ['-p', '--path']);
|
|
69
63
|
if (typeof path === 'undefined') {
|
|
70
|
-
|
|
64
|
+
if (runInit) {
|
|
65
|
+
logger.error('Path argument is required. Use --path to specify the PCF folder.');
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
logger.error('Path argument is required. Use --path to specify the path to solution folder.');
|
|
69
|
+
}
|
|
71
70
|
process.exit(1);
|
|
72
71
|
}
|
|
73
72
|
const tick = performance.now();
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if (envIndex > 0) {
|
|
78
|
-
env = (_d = args.at(envIndex)) !== null && _d !== void 0 ? _d : '';
|
|
73
|
+
const env = (_c = (0, argumentUtil_1.getArgValue)(args, ['-env', '--environment'])) !== null && _c !== void 0 ? _c : '';
|
|
74
|
+
if (env === '' && !runInit) {
|
|
75
|
+
logger.warn('No environment specified. Defaulting to "local".');
|
|
79
76
|
}
|
|
80
77
|
function executeTasks() {
|
|
81
78
|
if (commandArgument === 'upgrade' || runAll) {
|
|
82
|
-
const upgradeResult =
|
|
79
|
+
const upgradeResult = tasks.runUpgrade(path, isVerbose);
|
|
83
80
|
if (upgradeResult === 1)
|
|
84
81
|
return 1;
|
|
85
82
|
}
|
|
86
83
|
if (commandArgument === 'build' || runAll) {
|
|
87
|
-
const buildResult =
|
|
84
|
+
const buildResult = tasks.runBuild(path, isVerbose);
|
|
88
85
|
if (buildResult === 1)
|
|
89
86
|
return 1;
|
|
90
87
|
}
|
|
91
88
|
if (commandArgument === 'import' || runAll) {
|
|
92
|
-
const importResult =
|
|
89
|
+
const importResult = tasks.runImport(path, env, isVerbose);
|
|
93
90
|
if (importResult === 1)
|
|
94
91
|
return 1;
|
|
95
92
|
}
|
|
96
93
|
if (commandArgument === 'init') {
|
|
97
|
-
const
|
|
98
|
-
|
|
94
|
+
const name = (0, argumentUtil_1.getArgValue)(args, ['-n', '--name']);
|
|
95
|
+
const publisherName = (0, argumentUtil_1.getArgValue)(args, ['-pn', '--publisher-name']);
|
|
96
|
+
const publisherPrefix = (0, argumentUtil_1.getArgValue)(args, ['-pp', '--publisher-prefix']);
|
|
97
|
+
if (typeof name === 'undefined') {
|
|
98
|
+
logger.error('Name argument is required. Use --name to specify the name of the control.');
|
|
99
|
+
process.exit(1);
|
|
100
|
+
}
|
|
101
|
+
if (typeof publisherName === 'undefined') {
|
|
102
|
+
logger.error('Publisher Name argument is required. Use --publisher-name to specify the name of the control.');
|
|
103
|
+
process.exit(1);
|
|
104
|
+
}
|
|
105
|
+
if (typeof publisherPrefix === 'undefined') {
|
|
106
|
+
logger.error('Publisher Prefix argument is required. Use --publisher-prefix to specify the name of the control.');
|
|
107
|
+
process.exit(1);
|
|
108
|
+
}
|
|
109
|
+
const initResult = tasks.runInit(path, name, publisherName, publisherPrefix, isVerbose);
|
|
110
|
+
if (initResult === 1)
|
|
99
111
|
return 1;
|
|
100
112
|
}
|
|
101
113
|
return 0;
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tywalk/pcf-helper-run",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.23",
|
|
4
4
|
"description": "A simple command-line utility for building and publishing PCF controls to Dataverse.",
|
|
5
5
|
"types": "./types/",
|
|
6
6
|
"files": [
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@tywalk/color-logger": "^1.0.3",
|
|
28
|
-
"@tywalk/pcf-helper": "^1.4.
|
|
28
|
+
"@tywalk/pcf-helper": "^1.4.20"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/jest": "^29.5.14",
|
|
@@ -0,0 +1,19 @@
|
|
|
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) {
|
|
13
|
+
const arg = args.find(a => argOpts.includes(a));
|
|
14
|
+
if (typeof arg === 'undefined') {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
const argIndex = args.indexOf(arg) + 1;
|
|
18
|
+
return args.at(argIndex);
|
|
19
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tywalk/pcf-helper-run",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.23",
|
|
4
4
|
"description": "A simple command-line utility for building and publishing PCF controls to Dataverse.",
|
|
5
5
|
"types": "./types/",
|
|
6
6
|
"files": [
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@tywalk/color-logger": "^1.0.3",
|
|
28
|
-
"@tywalk/pcf-helper": "^1.4.
|
|
28
|
+
"@tywalk/pcf-helper": "^1.4.20"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/jest": "^29.5.14",
|