@unisphere/cli 1.13.1
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/CHANGELOG.md +13 -0
- package/README.md +17 -0
- package/bundler/context/rollup.js +199 -0
- package/bundler/package/bundled-dependencies.js +15 -0
- package/bundler/package/fix-package-json-dependencies.js +104 -0
- package/bundler/package/rollup.js +116 -0
- package/package.json +49 -0
- package/src/index.d.ts +2 -0
- package/src/index.js +12 -0
- package/src/index.js.map +1 -0
- package/src/lib/commands/context/activate/check-availability.d.ts +7 -0
- package/src/lib/commands/context/activate/check-availability.js +29 -0
- package/src/lib/commands/context/activate/check-availability.js.map +1 -0
- package/src/lib/commands/context/activate/command.d.ts +2 -0
- package/src/lib/commands/context/activate/command.js +16 -0
- package/src/lib/commands/context/activate/command.js.map +1 -0
- package/src/lib/commands/context/activate/element/command.d.ts +2 -0
- package/src/lib/commands/context/activate/element/command.js +73 -0
- package/src/lib/commands/context/activate/element/command.js.map +1 -0
- package/src/lib/commands/context/activate/loader/command.d.ts +2 -0
- package/src/lib/commands/context/activate/loader/command.js +55 -0
- package/src/lib/commands/context/activate/loader/command.js.map +1 -0
- package/src/lib/commands/context/activate/runtime-file-utils.d.ts +20 -0
- package/src/lib/commands/context/activate/runtime-file-utils.js +39 -0
- package/src/lib/commands/context/activate/runtime-file-utils.js.map +1 -0
- package/src/lib/commands/context/activate/update-runtime-version.d.ts +23 -0
- package/src/lib/commands/context/activate/update-runtime-version.js +78 -0
- package/src/lib/commands/context/activate/update-runtime-version.js.map +1 -0
- package/src/lib/commands/context/activate/verify-env-readiness.d.ts +8 -0
- package/src/lib/commands/context/activate/verify-env-readiness.js +54 -0
- package/src/lib/commands/context/activate/verify-env-readiness.js.map +1 -0
- package/src/lib/commands/context/activate/workspace/command.d.ts +2 -0
- package/src/lib/commands/context/activate/workspace/command.js +60 -0
- package/src/lib/commands/context/activate/workspace/command.js.map +1 -0
- package/src/lib/commands/context/build-command.d.ts +2 -0
- package/src/lib/commands/context/build-command.js +74 -0
- package/src/lib/commands/context/build-command.js.map +1 -0
- package/src/lib/commands/context/context-command.d.ts +2 -0
- package/src/lib/commands/context/context-command.js +19 -0
- package/src/lib/commands/context/context-command.js.map +1 -0
- package/src/lib/commands/context/publish/command.d.ts +2 -0
- package/src/lib/commands/context/publish/command.js +82 -0
- package/src/lib/commands/context/publish/command.js.map +1 -0
- package/src/lib/commands/context/publish/execute/execute.d.ts +2 -0
- package/src/lib/commands/context/publish/execute/execute.js +118 -0
- package/src/lib/commands/context/publish/execute/execute.js.map +1 -0
- package/src/lib/commands/context/publish/execute/sync-element.d.ts +8 -0
- package/src/lib/commands/context/publish/execute/sync-element.js +58 -0
- package/src/lib/commands/context/publish/execute/sync-element.js.map +1 -0
- package/src/lib/commands/context/publish/prepare/build-nx-runtimes.d.ts +11 -0
- package/src/lib/commands/context/publish/prepare/build-nx-runtimes.js +112 -0
- package/src/lib/commands/context/publish/prepare/build-nx-runtimes.js.map +1 -0
- package/src/lib/commands/context/publish/prepare/prepare.d.ts +2 -0
- package/src/lib/commands/context/publish/prepare/prepare.js +122 -0
- package/src/lib/commands/context/publish/prepare/prepare.js.map +1 -0
- package/src/lib/commands/context/publish/types.d.ts +15 -0
- package/src/lib/commands/context/publish/types.js +3 -0
- package/src/lib/commands/context/publish/types.js.map +1 -0
- package/src/lib/commands/context/serve-command.d.ts +2 -0
- package/src/lib/commands/context/serve-command.js +76 -0
- package/src/lib/commands/context/serve-command.js.map +1 -0
- package/src/lib/commands/info/command.d.ts +2 -0
- package/src/lib/commands/info/command.js +51 -0
- package/src/lib/commands/info/command.js.map +1 -0
- package/src/lib/commands/init/command.d.ts +2 -0
- package/src/lib/commands/init/command.js +46 -0
- package/src/lib/commands/init/command.js.map +1 -0
- package/src/lib/commands/package/build-command.d.ts +2 -0
- package/src/lib/commands/package/build-command.js +70 -0
- package/src/lib/commands/package/build-command.js.map +1 -0
- package/src/lib/commands/package/link/command.d.ts +2 -0
- package/src/lib/commands/package/link/command.js +110 -0
- package/src/lib/commands/package/link/command.js.map +1 -0
- package/src/lib/commands/package/package-command.d.ts +2 -0
- package/src/lib/commands/package/package-command.js +15 -0
- package/src/lib/commands/package/package-command.js.map +1 -0
- package/src/lib/commands/package/publish/command.d.ts +2 -0
- package/src/lib/commands/package/publish/command.js +37 -0
- package/src/lib/commands/package/publish/command.js.map +1 -0
- package/src/lib/commands/package/publish/deploy-to-github.d.ts +13 -0
- package/src/lib/commands/package/publish/deploy-to-github.js +151 -0
- package/src/lib/commands/package/publish/deploy-to-github.js.map +1 -0
- package/src/lib/commands/package/publish/deploy-to-npm.d.ts +13 -0
- package/src/lib/commands/package/publish/deploy-to-npm.js +151 -0
- package/src/lib/commands/package/publish/deploy-to-npm.js.map +1 -0
- package/src/lib/commands/package/publish/publish.d.ts +2 -0
- package/src/lib/commands/package/publish/publish.js +133 -0
- package/src/lib/commands/package/publish/publish.js.map +1 -0
- package/src/lib/commands/package/publish/types.d.ts +7 -0
- package/src/lib/commands/package/publish/types.js +3 -0
- package/src/lib/commands/package/publish/types.js.map +1 -0
- package/src/lib/unisphere.d.ts +2 -0
- package/src/lib/unisphere.js +19 -0
- package/src/lib/unisphere.js.map +1 -0
- package/src/lib/utils/artifacts.d.ts +6 -0
- package/src/lib/utils/artifacts.js +44 -0
- package/src/lib/utils/artifacts.js.map +1 -0
- package/src/lib/utils/aws/copy-s3-folder.d.ts +7 -0
- package/src/lib/utils/aws/copy-s3-folder.js +43 -0
- package/src/lib/utils/aws/copy-s3-folder.js.map +1 -0
- package/src/lib/utils/aws/download-json-from-bucket.d.ts +8 -0
- package/src/lib/utils/aws/download-json-from-bucket.js +42 -0
- package/src/lib/utils/aws/download-json-from-bucket.js.map +1 -0
- package/src/lib/utils/aws/get-s3-client.d.ts +2 -0
- package/src/lib/utils/aws/get-s3-client.js +39 -0
- package/src/lib/utils/aws/get-s3-client.js.map +1 -0
- package/src/lib/utils/aws/is-s3-file-exists.d.ts +6 -0
- package/src/lib/utils/aws/is-s3-file-exists.js +36 -0
- package/src/lib/utils/aws/is-s3-file-exists.js.map +1 -0
- package/src/lib/utils/aws/is-s3-folder-exists.d.ts +8 -0
- package/src/lib/utils/aws/is-s3-folder-exists.js +33 -0
- package/src/lib/utils/aws/is-s3-folder-exists.js.map +1 -0
- package/src/lib/utils/aws/list-s3-folders.d.ts +8 -0
- package/src/lib/utils/aws/list-s3-folders.js +32 -0
- package/src/lib/utils/aws/list-s3-folders.js.map +1 -0
- package/src/lib/utils/aws/mime-type-mapping.d.ts +2 -0
- package/src/lib/utils/aws/mime-type-mapping.js +8624 -0
- package/src/lib/utils/aws/mime-type-mapping.js.map +1 -0
- package/src/lib/utils/aws/upload-json-to-bucket.d.ts +9 -0
- package/src/lib/utils/aws/upload-json-to-bucket.js +31 -0
- package/src/lib/utils/aws/upload-json-to-bucket.js.map +1 -0
- package/src/lib/utils/aws/upload-to-aws-bucket.d.ts +9 -0
- package/src/lib/utils/aws/upload-to-aws-bucket.js +60 -0
- package/src/lib/utils/aws/upload-to-aws-bucket.js.map +1 -0
- package/src/lib/utils/github/tags.d.ts +10 -0
- package/src/lib/utils/github/tags.js +71 -0
- package/src/lib/utils/github/tags.js.map +1 -0
- package/src/lib/utils/listr2/create-exec-task.d.ts +8 -0
- package/src/lib/utils/listr2/create-exec-task.js +38 -0
- package/src/lib/utils/listr2/create-exec-task.js.map +1 -0
- package/src/lib/utils/listr2/defaults.d.ts +4 -0
- package/src/lib/utils/listr2/defaults.js +25 -0
- package/src/lib/utils/listr2/defaults.js.map +1 -0
- package/src/lib/utils/prompts/prompts.d.ts +24 -0
- package/src/lib/utils/prompts/prompts.js +184 -0
- package/src/lib/utils/prompts/prompts.js.map +1 -0
- package/src/lib/utils/prompts/vendor/prompts/elements/confirm.d.ts +19 -0
- package/src/lib/utils/prompts/vendor/prompts/elements/confirm.js +75 -0
- package/src/lib/utils/prompts/vendor/prompts/elements/confirm.js.map +1 -0
- package/src/lib/utils/prompts/vendor/prompts/elements/index.d.ts +4 -0
- package/src/lib/utils/prompts/vendor/prompts/elements/index.js +12 -0
- package/src/lib/utils/prompts/vendor/prompts/elements/index.js.map +1 -0
- package/src/lib/utils/prompts/vendor/prompts/elements/prompt.d.ts +12 -0
- package/src/lib/utils/prompts/vendor/prompts/elements/prompt.js +55 -0
- package/src/lib/utils/prompts/vendor/prompts/elements/prompt.js.map +1 -0
- package/src/lib/utils/prompts/vendor/prompts/elements/select.d.ts +30 -0
- package/src/lib/utils/prompts/vendor/prompts/elements/select.js +106 -0
- package/src/lib/utils/prompts/vendor/prompts/elements/select.js.map +1 -0
- package/src/lib/utils/prompts/vendor/prompts/elements/text.d.ts +35 -0
- package/src/lib/utils/prompts/vendor/prompts/elements/text.js +130 -0
- package/src/lib/utils/prompts/vendor/prompts/elements/text.js.map +1 -0
- package/src/lib/utils/prompts/vendor/prompts/index.d.ts +9 -0
- package/src/lib/utils/prompts/vendor/prompts/index.js +66 -0
- package/src/lib/utils/prompts/vendor/prompts/index.js.map +1 -0
- package/src/lib/utils/prompts/vendor/prompts/prompts.d.ts +27 -0
- package/src/lib/utils/prompts/vendor/prompts/prompts.js +52 -0
- package/src/lib/utils/prompts/vendor/prompts/prompts.js.map +1 -0
- package/src/lib/utils/prompts/vendor/prompts/util/action.d.ts +1 -0
- package/src/lib/utils/prompts/vendor/prompts/util/action.js +39 -0
- package/src/lib/utils/prompts/vendor/prompts/util/action.js.map +1 -0
- package/src/lib/utils/prompts/vendor/prompts/util/clear.d.ts +1 -0
- package/src/lib/utils/prompts/vendor/prompts/util/clear.js +17 -0
- package/src/lib/utils/prompts/vendor/prompts/util/clear.js.map +1 -0
- package/src/lib/utils/prompts/vendor/prompts/util/figures.d.ts +9 -0
- package/src/lib/utils/prompts/vendor/prompts/util/figures.js +21 -0
- package/src/lib/utils/prompts/vendor/prompts/util/figures.js.map +1 -0
- package/src/lib/utils/prompts/vendor/prompts/util/index.d.ts +6 -0
- package/src/lib/utils/prompts/vendor/prompts/util/index.js +14 -0
- package/src/lib/utils/prompts/vendor/prompts/util/index.js.map +1 -0
- package/src/lib/utils/prompts/vendor/prompts/util/strip.d.ts +1 -0
- package/src/lib/utils/prompts/vendor/prompts/util/strip.js +12 -0
- package/src/lib/utils/prompts/vendor/prompts/util/strip.js.map +1 -0
- package/src/lib/utils/prompts/vendor/prompts/util/style.d.ts +27 -0
- package/src/lib/utils/prompts/vendor/prompts/util/style.js +30 -0
- package/src/lib/utils/prompts/vendor/prompts/util/style.js.map +1 -0
- package/src/lib/utils/read-json-file.d.ts +6 -0
- package/src/lib/utils/read-json-file.js +19 -0
- package/src/lib/utils/read-json-file.js.map +1 -0
- package/src/lib/utils/unisphere/augment-workspace-config.d.ts +2 -0
- package/src/lib/utils/unisphere/augment-workspace-config.js +212 -0
- package/src/lib/utils/unisphere/augment-workspace-config.js.map +1 -0
- package/src/lib/utils/unisphere/build-unisphere-elements.d.ts +16 -0
- package/src/lib/utils/unisphere/build-unisphere-elements.js +67 -0
- package/src/lib/utils/unisphere/build-unisphere-elements.js.map +1 -0
- package/src/lib/utils/unisphere/find-unisphere-workspace-file.d.ts +2 -0
- package/src/lib/utils/unisphere/find-unisphere-workspace-file.js +35 -0
- package/src/lib/utils/unisphere/find-unisphere-workspace-file.js.map +1 -0
- package/src/lib/utils/unisphere/get-global-file.d.ts +2 -0
- package/src/lib/utils/unisphere/get-global-file.js +27 -0
- package/src/lib/utils/unisphere/get-global-file.js.map +1 -0
- package/src/lib/utils/unisphere/types.d.ts +88 -0
- package/src/lib/utils/unisphere/types.js +97 -0
- package/src/lib/utils/unisphere/types.js.map +1 -0
- package/src/lib/utils/unisphere/workspace.d.ts +5 -0
- package/src/lib/utils/unisphere/workspace.js +50 -0
- package/src/lib/utils/unisphere/workspace.js.map +1 -0
- package/src/lib/utils/unisphere-utils.d.ts +7 -0
- package/src/lib/utils/unisphere-utils.js +33 -0
- package/src/lib/utils/unisphere-utils.js.map +1 -0
- package/src/lib/utils/utils.d.ts +9 -0
- package/src/lib/utils/utils.js +33 -0
- package/src/lib/utils/utils.js.map +1 -0
- package/src/lib/utils/validator.d.ts +33 -0
- package/src/lib/utils/validator.js +109 -0
- package/src/lib/utils/validator.js.map +1 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.augmentWorkspaceConfig = void 0;
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const read_json_file_1 = require("../read-json-file");
|
|
6
|
+
const debug_1 = require("debug");
|
|
7
|
+
const tags_1 = require("../github/tags");
|
|
8
|
+
const unisphere_utils_1 = require("../unisphere-utils");
|
|
9
|
+
const prompts_1 = require("../prompts/prompts");
|
|
10
|
+
const debug = (0, debug_1.default)('unisphere:utils:unisphere');
|
|
11
|
+
const allowedElementTypes = ['workspace', 'loader'];
|
|
12
|
+
const allowedDynamicElementTypes = [
|
|
13
|
+
'contexts',
|
|
14
|
+
'components',
|
|
15
|
+
'packages',
|
|
16
|
+
'apps',
|
|
17
|
+
];
|
|
18
|
+
const areAllValuesSame = (versions) => {
|
|
19
|
+
const values = Object.values(versions);
|
|
20
|
+
if (values.length === 0)
|
|
21
|
+
return true; // Return true if the object is empty
|
|
22
|
+
const firstValue = values[0];
|
|
23
|
+
return values.every((value) => value === firstValue);
|
|
24
|
+
};
|
|
25
|
+
function validateVersionConstraints(workspaceConfig) {
|
|
26
|
+
var _a;
|
|
27
|
+
if (!((_a = workspaceConfig.constraints) === null || _a === void 0 ? void 0 : _a.length))
|
|
28
|
+
return;
|
|
29
|
+
const constraint = workspaceConfig.constraints[0];
|
|
30
|
+
if (constraint.type !== 'same-version') {
|
|
31
|
+
debug(`Warning! unsupported constraint type: ${constraint.type}, skipping`);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
debug(`Applying same-version constraint for elements`);
|
|
35
|
+
const versions = {};
|
|
36
|
+
try {
|
|
37
|
+
collectVersions(constraint, workspaceConfig, versions);
|
|
38
|
+
if (!areAllValuesSame(versions)) {
|
|
39
|
+
(0, prompts_1.logErrorAndExit)(`Version mismatch found for the following elements: ${JSON.stringify(versions)}. Did you forget to update the versions or apply a constraint to an element with no distribution channel?`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
debug(`Failed to verify versions: ${error}`);
|
|
44
|
+
(0, prompts_1.logErrorAndExit)(`Failed to run the versions verification, please ensure the workspace '.unisphere > constraints' are correct`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function collectVersions(constraint, workspaceConfig, versions) {
|
|
48
|
+
const { contexts, components, packages } = constraint;
|
|
49
|
+
if (contexts) {
|
|
50
|
+
contexts.forEach((context) => {
|
|
51
|
+
var _a, _b, _c;
|
|
52
|
+
versions[context] =
|
|
53
|
+
(_c = (_b = (_a = workspaceConfig.elements['contexts']) === null || _a === void 0 ? void 0 : _a[context]) === null || _b === void 0 ? void 0 : _b.version) !== null && _c !== void 0 ? _c : 'n/a';
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
if (components) {
|
|
57
|
+
components.forEach((component) => {
|
|
58
|
+
var _a, _b, _c;
|
|
59
|
+
versions[component] =
|
|
60
|
+
(_c = (_b = (_a = workspaceConfig.elements['components']) === null || _a === void 0 ? void 0 : _a[component]) === null || _b === void 0 ? void 0 : _b.version) !== null && _c !== void 0 ? _c : 'n/a';
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
if (packages) {
|
|
64
|
+
packages.forEach((packageName) => {
|
|
65
|
+
var _a, _b, _c;
|
|
66
|
+
versions[packageName] =
|
|
67
|
+
(_c = (_b = (_a = workspaceConfig.elements['packages']) === null || _a === void 0 ? void 0 : _a[packageName]) === null || _b === void 0 ? void 0 : _b.version) !== null && _c !== void 0 ? _c : 'n/a';
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function readElementFiles(rootPath, sourceRoot, elementType) {
|
|
72
|
+
const packageJsonPath = path.join(rootPath, sourceRoot, 'package.json');
|
|
73
|
+
const projectJsonPath = path.join(rootPath, sourceRoot, 'project.json');
|
|
74
|
+
debug(`Checking for package.json and project.json at ${sourceRoot}`);
|
|
75
|
+
const packageJson = (0, read_json_file_1.readJsonFile)(packageJsonPath);
|
|
76
|
+
const projectJson = (0, read_json_file_1.readJsonFile)(projectJsonPath);
|
|
77
|
+
if (!packageJson || !projectJson) {
|
|
78
|
+
(0, prompts_1.logErrorAndExit)(`Failed to read package.json or project.json for element ${elementType}`);
|
|
79
|
+
}
|
|
80
|
+
return { packageJson, projectJson };
|
|
81
|
+
}
|
|
82
|
+
function augmentWorkspaceConfig(rootPath, repositoryFile) {
|
|
83
|
+
const newConfig = Object.assign(Object.assign({}, repositoryFile), { elements: {} });
|
|
84
|
+
const versionsCheckFailures = [];
|
|
85
|
+
const githubTags = (0, tags_1.extractTags)(rootPath);
|
|
86
|
+
function validateElementInfo({ elementName, version, }) {
|
|
87
|
+
if (!(0, unisphere_utils_1.isValidElementVersion)(version)) {
|
|
88
|
+
versionsCheckFailures.push(elementName);
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
function processDynamicElement({ unisphereElement, elementTypeFromConfig, elementNameFromConfig, widgetName, githubTags, }) {
|
|
94
|
+
debug(`extracting information for element ${elementNameFromConfig} (${elementTypeFromConfig})'`);
|
|
95
|
+
const packageJsonPath = path.join(rootPath, unisphereElement.sourceRoot, 'package.json');
|
|
96
|
+
const projectJsonPath = path.join(rootPath, unisphereElement.sourceRoot, 'project.json');
|
|
97
|
+
debug(`Checking for package.json and project.json at ${unisphereElement.sourceRoot}`);
|
|
98
|
+
const packageJson = (0, read_json_file_1.readJsonFile)(packageJsonPath);
|
|
99
|
+
const projectJson = (0, read_json_file_1.readJsonFile)(projectJsonPath);
|
|
100
|
+
if (packageJson && projectJson && projectJson.name) {
|
|
101
|
+
const expectedProjectName = `unisphere-${elementTypeFromConfig}-${elementNameFromConfig}`;
|
|
102
|
+
if (projectJson.name !== expectedProjectName) {
|
|
103
|
+
(0, prompts_1.logErrorAndExit)(`Expected nx project name to be '${expectedProjectName}', got '${projectJson.name}'`);
|
|
104
|
+
}
|
|
105
|
+
let expectedPackageName = '';
|
|
106
|
+
if (elementTypeFromConfig === 'packages') {
|
|
107
|
+
switch (unisphereElement.distributionChannel) {
|
|
108
|
+
case 'github':
|
|
109
|
+
expectedPackageName = `@kaltura/unisphere-${widgetName}${widgetName === elementNameFromConfig
|
|
110
|
+
? ''
|
|
111
|
+
: `-${elementNameFromConfig}`}`;
|
|
112
|
+
break;
|
|
113
|
+
case 'npm':
|
|
114
|
+
if (unisphereElement.scope === 'global') {
|
|
115
|
+
expectedPackageName = `@unisphere/${elementNameFromConfig}`;
|
|
116
|
+
}
|
|
117
|
+
else if (unisphereElement.scope === 'widget') {
|
|
118
|
+
expectedPackageName = `@unisphere/${widgetName}${widgetName === elementNameFromConfig
|
|
119
|
+
? ''
|
|
120
|
+
: `-${elementNameFromConfig}`}`;
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
(0, prompts_1.logErrorAndExit)(`Unsupported scope '${unisphereElement.scope}' for package '${elementNameFromConfig}'`);
|
|
124
|
+
}
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
if (expectedPackageName && packageJson.name !== expectedPackageName) {
|
|
128
|
+
(0, prompts_1.logErrorAndExit)(`Expected package name to be '${expectedPackageName}', got '${packageJson.name}'`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (validateElementInfo({
|
|
132
|
+
elementName: elementNameFromConfig,
|
|
133
|
+
version: packageJson.version,
|
|
134
|
+
})) {
|
|
135
|
+
debug(`Adding element '${elementNameFromConfig}' to deploy list (full element name '${elementNameFromConfig}', type '${elementTypeFromConfig}', version '${packageJson.version}', nxProjectName '${projectJson.name}, distributionChannel '${unisphereElement.distributionChannel}', scope '${unisphereElement.scope}')`);
|
|
136
|
+
const hasGithubTag = githubTags[projectJson.name] === packageJson.version;
|
|
137
|
+
const distFolder = path.join(rootPath, `dist/unisphere`, elementTypeFromConfig, elementNameFromConfig);
|
|
138
|
+
newConfig.elements[elementTypeFromConfig][elementNameFromConfig] = Object.assign(Object.assign({}, repositoryFile.elements[elementTypeFromConfig][elementNameFromConfig]), { nxProjectName: projectJson.name, version: packageJson.version, hasGithubTag,
|
|
139
|
+
distFolder, distributionChannel: unisphereElement.distributionChannel });
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
(0, prompts_1.logErrorAndExit)(`Failed to read package.json or project.json for element ${elementNameFromConfig} (${elementTypeFromConfig})'`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
function processWorkspaceElement(sourceRoot, githubTags) {
|
|
147
|
+
const { packageJson, projectJson } = readElementFiles(rootPath, sourceRoot, 'workspace');
|
|
148
|
+
if (packageJson && projectJson && projectJson.name) {
|
|
149
|
+
const hasGithubTag = githubTags[projectJson.name] === packageJson.version;
|
|
150
|
+
if (validateElementInfo({
|
|
151
|
+
elementName: 'workspace',
|
|
152
|
+
version: packageJson.version,
|
|
153
|
+
})) {
|
|
154
|
+
debug(`Adding element 'workspace' to deploy list (full element name 'workspace', version '${packageJson.version}', nxProjectName '${projectJson.name}', distributionChannel '${repositoryFile.elements['workspace'].distributionChannel}', scope '${repositoryFile.elements['workspace'].scope}')`);
|
|
155
|
+
const distFolder = path.join(rootPath, `dist/unisphere/workspace`);
|
|
156
|
+
newConfig.elements['workspace'] = Object.assign(Object.assign({}, repositoryFile.elements['workspace']), { version: packageJson.version, nxProjectName: projectJson.name, hasGithubTag,
|
|
157
|
+
distFolder });
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
(0, prompts_1.logErrorAndExit)(`Failed to read package.json or project.json for element workspace`);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
function processLoaderElement(sourceRoot, githubTags) {
|
|
165
|
+
const { packageJson, projectJson } = readElementFiles(rootPath, sourceRoot, 'loader');
|
|
166
|
+
if (packageJson && projectJson && projectJson.name) {
|
|
167
|
+
const hasGithubTag = githubTags[projectJson.name] === packageJson.version;
|
|
168
|
+
if (validateElementInfo({
|
|
169
|
+
elementName: 'loader',
|
|
170
|
+
version: packageJson.version,
|
|
171
|
+
})) {
|
|
172
|
+
debug(`Adding element 'loader' to deploy list (full element name 'loader', version '${packageJson.version}', nxProjectName '${projectJson.name}', distributionChannel '${repositoryFile.elements['loader'].distributionChannel}', scope '${repositoryFile.elements['loader'].scope}')`);
|
|
173
|
+
const distFolder = path.join(rootPath, `dist/unisphere/loader`);
|
|
174
|
+
newConfig.elements['loader'] = Object.assign(Object.assign({}, repositoryFile.elements['loader']), { version: packageJson.version, nxProjectName: projectJson.name, hasGithubTag,
|
|
175
|
+
distFolder });
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
(0, prompts_1.logErrorAndExit)(`Failed to read package.json or project.json for element loader`);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
for (const elementTypeFromConfig of Object.keys(repositoryFile.elements)) {
|
|
183
|
+
debug(`augmenting element type '${elementTypeFromConfig}'`);
|
|
184
|
+
if (elementTypeFromConfig === 'workspace') {
|
|
185
|
+
processWorkspaceElement(repositoryFile.elements['workspace'].sourceRoot, githubTags);
|
|
186
|
+
}
|
|
187
|
+
else if (elementTypeFromConfig === 'loader') {
|
|
188
|
+
processLoaderElement(repositoryFile.elements['loader'].sourceRoot, githubTags);
|
|
189
|
+
}
|
|
190
|
+
else if (allowedDynamicElementTypes.includes(elementTypeFromConfig)) {
|
|
191
|
+
const elementItems = repositoryFile.elements[elementTypeFromConfig];
|
|
192
|
+
newConfig.elements[elementTypeFromConfig] = {};
|
|
193
|
+
// Iterate through the elements inside each category (e.g., application, showcase)
|
|
194
|
+
for (const elementNameFromConfig of Object.keys(elementItems)) {
|
|
195
|
+
processDynamicElement({
|
|
196
|
+
unisphereElement: elementItems[elementNameFromConfig],
|
|
197
|
+
elementTypeFromConfig: elementTypeFromConfig,
|
|
198
|
+
elementNameFromConfig,
|
|
199
|
+
widgetName: repositoryFile.name,
|
|
200
|
+
githubTags,
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
validateVersionConstraints(newConfig);
|
|
206
|
+
if (versionsCheckFailures.length > 0) {
|
|
207
|
+
(0, prompts_1.logErrorAndExit)(`Version checks failed for elements: '${versionsCheckFailures.join(', ')}' (did you pass semantic version with major 1?)`);
|
|
208
|
+
}
|
|
209
|
+
return newConfig;
|
|
210
|
+
}
|
|
211
|
+
exports.augmentWorkspaceConfig = augmentWorkspaceConfig;
|
|
212
|
+
//# sourceMappingURL=augment-workspace-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"augment-workspace-config.js","sourceRoot":"","sources":["../../../../../../../packages/unisphere-cli/src/lib/utils/unisphere/augment-workspace-config.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,sDAAiD;AACjD,iCAA0B;AAC1B,yCAA6C;AAC7C,wDAA2D;AAS3D,gDAAiE;AAGjE,MAAM,KAAK,GAAG,IAAA,eAAK,EAAC,2BAA2B,CAAC,CAAC;AAEjD,MAAM,mBAAmB,GAAG,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;AAEpD,MAAM,0BAA0B,GAAG;IACjC,UAAU;IACV,YAAY;IACZ,UAAU;IACV,MAAM;CACP,CAAC;AAEF,MAAM,gBAAgB,GAAG,CAAC,QAAgC,EAAW,EAAE;IACrE,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACvC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC,CAAC,qCAAqC;IAE3E,MAAM,UAAU,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IAC7B,OAAO,MAAM,CAAC,K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older, production, parentTask, }: {
|
|
3
|
+
cwd: string;
|
|
4
|
+
nxProjectName: string;
|
|
5
|
+
distFolder: string;
|
|
6
|
+
production: boolean;
|
|
7
|
+
parentTask: ListrTaskWrapper<any, any, any>;
|
|
8
|
+
}) => Promise<Listr<any, any, any>>;
|
|
9
|
+
export declare const createListrForBuildingUnisphereContext: ({ cwd, nxProjectName, lint, lintFix, parentTask, production, }: {
|
|
10
|
+
cwd: string;
|
|
11
|
+
nxProjectName: string;
|
|
12
|
+
production: boolean;
|
|
13
|
+
lint: boolean;
|
|
14
|
+
lintFix: boolean;
|
|
15
|
+
parentTask: ListrTaskWrapper<any, any, any>;
|
|
16
|
+
}) => Promise<Listr<any, any, any>>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createListrForBuildingUnisphereContext = exports.createListrForBuildingUnispherePackage = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const create_exec_task_1 = require("../listr2/create-exec-task");
|
|
7
|
+
const defaults_1 = require("../listr2/defaults");
|
|
8
|
+
const createListrForBuildingUnispherePackage = ({ cwd, nxProjectName, distFolder, production, parentTask, }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
9
|
+
// notice - I didn't set --skip-nx-cache here
|
|
10
|
+
return parentTask.newListr([
|
|
11
|
+
(0, create_exec_task_1.createExecTask)({
|
|
12
|
+
title: 'Checking nx availability',
|
|
13
|
+
command: 'nx --version',
|
|
14
|
+
cwd,
|
|
15
|
+
}),
|
|
16
|
+
(0, create_exec_task_1.createExecTask)({
|
|
17
|
+
title: 'Running lint',
|
|
18
|
+
command: `nx run ${nxProjectName}:lint`,
|
|
19
|
+
cwd,
|
|
20
|
+
}),
|
|
21
|
+
(0, create_exec_task_1.createExecTask)({
|
|
22
|
+
title: 'Running build',
|
|
23
|
+
command: `nx run ${nxProjectName}:build ${production ? '--prod' : ''}`,
|
|
24
|
+
cwd,
|
|
25
|
+
}),
|
|
26
|
+
(0, create_exec_task_1.createExecTask)({
|
|
27
|
+
title: 'Running pre-bundle script',
|
|
28
|
+
command: `node ${path.join(__dirname, '../../../../bundler/package/fix-package-json-dependencies.js')} ${distFolder}`,
|
|
29
|
+
cwd,
|
|
30
|
+
env: {
|
|
31
|
+
UNISPHERE: 'true',
|
|
32
|
+
NODE_ENV: production ? 'production' : 'development',
|
|
33
|
+
UNISPHERE_DEV: production ? 'false' : 'true',
|
|
34
|
+
UNISPHERE_MODE: 'package',
|
|
35
|
+
},
|
|
36
|
+
}),
|
|
37
|
+
], (0, defaults_1.getDefaultListrOptions)());
|
|
38
|
+
});
|
|
39
|
+
exports.createListrForBuildingUnispherePackage = createListrForBuildingUnispherePackage;
|
|
40
|
+
const createListrForBuildingUnisphereContext = ({ cwd, nxProjectName, lint, lintFix, parentTask, production, }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
41
|
+
return parentTask.newListr([
|
|
42
|
+
(0, create_exec_task_1.createExecTask)({
|
|
43
|
+
title: 'Checking nx availability',
|
|
44
|
+
command: 'nx --version',
|
|
45
|
+
cwd,
|
|
46
|
+
}),
|
|
47
|
+
(0, create_exec_task_1.createExecTask)({
|
|
48
|
+
skip: () => !lint,
|
|
49
|
+
title: 'Running lint',
|
|
50
|
+
command: `nx run ${nxProjectName}:lint ${lintFix ? '--fix' : ''}`,
|
|
51
|
+
cwd,
|
|
52
|
+
}),
|
|
53
|
+
(0, create_exec_task_1.createExecTask)({
|
|
54
|
+
title: 'Running build',
|
|
55
|
+
command: `nx run ${nxProjectName}:build --skip-nx-cache ${production ? '--prod' : ''}`,
|
|
56
|
+
cwd,
|
|
57
|
+
env: {
|
|
58
|
+
UNISPHERE: 'true',
|
|
59
|
+
NODE_ENV: production ? 'production' : 'development',
|
|
60
|
+
UNISPHERE_DEV: production ? 'false' : 'true',
|
|
61
|
+
UNISPHERE_MODE: 'context',
|
|
62
|
+
},
|
|
63
|
+
}),
|
|
64
|
+
].filter(Boolean), (0, defaults_1.getDefaultListrOptions)());
|
|
65
|
+
});
|
|
66
|
+
exports.createListrForBuildingUnisphereContext = createListrForBuildingUnisphereContext;
|
|
67
|
+
//# sourceMappingURL=build-unisphere-elements.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-unisphere-elements.js","sourceRoot":"","sources":["../../../../../../../packages/unisphere-cli/src/lib/utils/unisphere/build-unisphere-elements.ts"],"names":[],"mappings":";;;;AACA,6BAA8B;AAC9B,iEAA4D;AAC5D,iDAA4D;AAErD,MAAM,sCAAsC,GAAG,CAAO,EAC3D,GAAG,EACH,aAAa,EACb,UAAU,EACV,UAAU,EACV,UAAU,GAOX,EAAE,EAAE;IACH,6CAA6C;IAC7C,OAAO,UAAU,CAAC,QAAQ,CACxB;QACE,IAAA,iCAAc,EAAC;YACb,KAAK,EAAE,0BAA0B;YACjC,OAAO,EAAE,cAAc;YACvB,GAAG;SACJ,CAAC;QACF,IAAA,iCAAc,EAAC;YACb,KAAK,EAAE,cAAc;YACrB,OAAO,EAAE,UAAU,aAAa,OAAO;YACvC,GAAG;SACJ,CAAC;QACF,IAAA,iCAAc,EAAC;YACb,KAAK,EAAE,eAAe;YACtB,OAAO,EAAE,UAAU,aAAa,UAAU,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE;YACtE,GAAG;SACJ,CAAC;QACF,IAAA,iCAAc,EAAC;YACb,KAAK,EAAE,2BAA2B;YAClC,OAAO,EAAE,QAAQ,IAAI,CAAC,IAAI,CACxB,SAAS,EACT,8DAA8D,CAC/D,IAAI,UAAU,EAAE;YACjB,GAAG;YACH,GAAG,EAAE;gBACH,SAAS,EAAE,MAAM;gBACjB,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,aAAa;gBACnD,aAAa,EAAE,UAAU,CAAC,CAAC,CAAC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(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getUnisphereWorkspaceFile = exports.findUnisphereWorkspaceFile = void 0;
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const process = require("process");
|
|
7
|
+
const createDebug = require("debug");
|
|
8
|
+
const debug = createDebug('unisphere:utils:unisphere:find-unisphere-workspace-file');
|
|
9
|
+
function findUnisphereWorkspaceFile(dir = process.cwd(), suspendRecursion = false) {
|
|
10
|
+
const filePath = path.join(dir, '.unisphere');
|
|
11
|
+
if (fs.existsSync(filePath)) {
|
|
12
|
+
debug(`Found unisphere workspace file in ${dir}`);
|
|
13
|
+
return dir; // Return the absolute path if the file exists
|
|
14
|
+
}
|
|
15
|
+
if (suspendRecursion) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
const parentDir = path.resolve(dir, '..');
|
|
19
|
+
if (parentDir === dir) {
|
|
20
|
+
// Base case: if we're at the root directory, stop recursion
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
// Recursively search in the parent directory
|
|
24
|
+
return findUnisphereWorkspaceFile(parentDir);
|
|
25
|
+
}
|
|
26
|
+
exports.findUnisphereWorkspaceFile = findUnisphereWorkspaceFile;
|
|
27
|
+
function getUnisphereWorkspaceFile(dir = process.cwd()) {
|
|
28
|
+
const unisphereWorkspace = findUnisphereWorkspaceFile(dir);
|
|
29
|
+
if (!unisphereWorkspace) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
return path.join(unisphereWorkspace, '.unisphere');
|
|
33
|
+
}
|
|
34
|
+
exports.getUnisphereWorkspaceFile = getUnisphereWorkspaceFile;
|
|
35
|
+
//# sourceMappingURL=find-unisphere-workspace-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-unisphere-workspace-file.js","sourceRoot":"","sources":["../../../../../../../packages/unisphere-cli/src/lib/utils/unisphere/find-unisphere-workspace-file.ts"],"names":[],"mappings":";;;AAAA,yBAAyB;AACzB,6BAA6B;AAC7B,mCAAmC;AACnC,qCAAqC;AAErC,MAAM,KAAK,GAAG,WAAW,CAAC,yDAAyD,CAAC,CAAC;AAErF,SAAgB,0BAA0B,CAAC,MAAc,OAAO,CAAC,GAAG,EAAE,EAAE,mBAA4B,KAAK;IACvG,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;IAE9C,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;QAC3B,KAAK,CAAC,qCAAqC,GAAG,EAAE,CAAC,CAAC;QAClD,OAAO,GAAG,CAAC,CAAE,8CAA8C;KAC5D;IAED,IAAI,gBAAgB,EAAE;QACpB,OAAO,IAAI,CAAC;KACb;IAED,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAE1C,IAAI,SAAS,KAAK,GAAG,EAAE;QACrB,4DAA4D;QAC5D,OAAO,IAAI,CAAC;KACb;IAED,6CAA6C;IAC7C,OAAO,0BAA0B,CAAC,SAAS,CAAC,CAAC;AAC/C,CAAC;AArBD,gEAqBC;AAED,SAAgB,yBAAyB,CAAC,MAAc,OAAO,CAAC,GAAG,EAAE;IACnE,MAAM,kBAAkB,GAAG,0BAA0B,CAAC,GAAG,CAAC,CAAC;IAC3D,IAAI,CAAC,kBAAkB,EAAE;QACvB,OAAO,IAAI,CAAC;KACb;IACD,OAAO,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,YAAY,CAAC,CAAC;AACrD,CAAC;AAND,8DAMC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setGlobalFile = exports.getGlobalFile = void 0;
|
|
4
|
+
const os_1 = require("os");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const fs = require("fs");
|
|
7
|
+
const createDebug = require("debug");
|
|
8
|
+
const debug = createDebug('unisphere:utils:unisphere:get-global-file');
|
|
9
|
+
const getGlobalFile = () => {
|
|
10
|
+
const info = (0, os_1.userInfo)();
|
|
11
|
+
const globalFile = (0, path_1.join)(info.homedir, '.config', 'unisphere', 'projects.json');
|
|
12
|
+
if (!fs.existsSync(globalFile)) {
|
|
13
|
+
debug(`Creating global file ${globalFile}`);
|
|
14
|
+
fs.mkdirSync((0, path_1.join)(info.homedir, '.config', 'unisphere'), { recursive: true });
|
|
15
|
+
fs.writeFileSync(globalFile, '{}');
|
|
16
|
+
}
|
|
17
|
+
const projects = JSON.parse(fs.readFileSync(globalFile, 'utf8'));
|
|
18
|
+
return projects;
|
|
19
|
+
};
|
|
20
|
+
exports.getGlobalFile = getGlobalFile;
|
|
21
|
+
const setGlobalFile = (projects) => {
|
|
22
|
+
const info = (0, os_1.userInfo)();
|
|
23
|
+
const globalFile = (0, path_1.join)(info.homedir, '.config', 'unisphere', 'projects.json');
|
|
24
|
+
fs.writeFileSync(globalFile, JSON.stringify(projects, null, 2));
|
|
25
|
+
};
|
|
26
|
+
exports.setGlobalFile = setGlobalFile;
|
|
27
|
+
//# sourceMappingURL=get-global-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-global-file.js","sourceRoot":"","sources":["../../../../../../../packages/unisphere-cli/src/lib/utils/unisphere/get-global-file.ts"],"names":[],"mappings":";;;AAAA,2BAA8B;AAC9B,+BAA4B;AAC5B,yBAAyB;AAEzB,qCAAqC;AAErC,MAAM,KAAK,GAAG,WAAW,CAAC,2CAA2C,CAAC,CAAC;AAEhE,MAAM,aAAa,GAAG,GAA2B,EAAE;IACxD,MAAM,IAAI,GAAG,IAAA,aAAQ,GAAE,CAAC;IACxB,MAAM,UAAU,GAAG,IAAA,WAAI,EAAC,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,eAAe,CAAC,CAAC;IAC/E,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE;QAC9B,KAAK,CAAC,wBAAwB,UAAU,EAAE,CAAC,CAAC;QAC5C,EAAE,CAAC,SAAS,CAAC,IAAA,WAAI,EAAC,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,WAAW,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC9E,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;KACpC;IAED,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;IACjE,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA;AAXY,QAAA,aAAa,iBAWzB;AAEM,MAAM,aAAa,GAAG,CAAC,QAAgC,EAAE,EAAE;IAChE,MAAM,IAAI,GAAG,IAAA,aAAQ,GAAE,CAAC;IACxB,MAAM,UAAU,GAAG,IAAA,WAAI,EAAC,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,eAAe,CAAC,CAAC;IAC/E,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC,CAAA;AAJY,QAAA,aAAa,iBAIzB"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Schema } from '../validator';
|
|
2
|
+
export interface UnisphereWorkspace {
|
|
3
|
+
company: string;
|
|
4
|
+
name: string;
|
|
5
|
+
repository: {
|
|
6
|
+
repositoryRootPath: string;
|
|
7
|
+
};
|
|
8
|
+
config: UnisphereWorkspaceConfig;
|
|
9
|
+
}
|
|
10
|
+
export interface UnisphereElement {
|
|
11
|
+
sourceRoot: string;
|
|
12
|
+
}
|
|
13
|
+
export interface UnisphereContextElement extends UnisphereElement {
|
|
14
|
+
distributionChannel: 'none' | 'unisphere';
|
|
15
|
+
scope: 'global' | 'widget';
|
|
16
|
+
}
|
|
17
|
+
export interface UnispherePackageElement extends UnisphereElement {
|
|
18
|
+
distributionChannel: 'none' | 'npm' | 'github';
|
|
19
|
+
scope: 'global' | 'widget';
|
|
20
|
+
}
|
|
21
|
+
interface AugmentedUnisphereElement {
|
|
22
|
+
distFolder: string;
|
|
23
|
+
hasGithubTag: boolean;
|
|
24
|
+
version: string;
|
|
25
|
+
nxProjectName: string;
|
|
26
|
+
}
|
|
27
|
+
export declare const UnisphereRepositoryFileSchema: Schema;
|
|
28
|
+
export interface UnisphereRepositoryFile {
|
|
29
|
+
name: string;
|
|
30
|
+
company: string;
|
|
31
|
+
schemaVersion: string;
|
|
32
|
+
constraints?: {
|
|
33
|
+
type: 'same-version';
|
|
34
|
+
contexts?: string[];
|
|
35
|
+
components?: string[];
|
|
36
|
+
packages?: string[];
|
|
37
|
+
}[];
|
|
38
|
+
elements: {
|
|
39
|
+
contexts?: {
|
|
40
|
+
[key: string]: UnisphereContextElement;
|
|
41
|
+
};
|
|
42
|
+
components?: {
|
|
43
|
+
[key: string]: UnisphereElement;
|
|
44
|
+
};
|
|
45
|
+
packages?: {
|
|
46
|
+
[key: string]: UnispherePackageElement;
|
|
47
|
+
};
|
|
48
|
+
apps?: {
|
|
49
|
+
[key: string]: UnisphereElement;
|
|
50
|
+
};
|
|
51
|
+
loader?: UnisphereContextElement;
|
|
52
|
+
workspace?: UnisphereContextElement;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export interface UnisphereWorkspaceConfig {
|
|
56
|
+
name: string;
|
|
57
|
+
schemaVersion: string;
|
|
58
|
+
constraints?: {
|
|
59
|
+
type: 'same-version';
|
|
60
|
+
contexts?: string[];
|
|
61
|
+
components?: string[];
|
|
62
|
+
packages?: string[];
|
|
63
|
+
}[];
|
|
64
|
+
elements: {
|
|
65
|
+
contexts?: {
|
|
66
|
+
[key: string]: AugmentedUnisphereElement & UnisphereContextElement;
|
|
67
|
+
};
|
|
68
|
+
components?: {
|
|
69
|
+
[key: string]: AugmentedUnisphereElement & UnisphereElement;
|
|
70
|
+
};
|
|
71
|
+
packages?: {
|
|
72
|
+
[key: string]: AugmentedUnisphereElement & UnispherePackageElement;
|
|
73
|
+
};
|
|
74
|
+
apps?: {
|
|
75
|
+
[key: string]: AugmentedUnisphereElement & UnisphereElement;
|
|
76
|
+
};
|
|
77
|
+
loader?: AugmentedUnisphereElement & UnisphereContextElement;
|
|
78
|
+
workspace?: AugmentedUnisphereElement & UnisphereContextElement;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
export interface UnisphereWorkspace {
|
|
82
|
+
name: string;
|
|
83
|
+
repository: {
|
|
84
|
+
repositoryRootPath: string;
|
|
85
|
+
};
|
|
86
|
+
config: UnisphereWorkspaceConfig;
|
|
87
|
+
}
|
|
88
|
+
export {};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UnisphereRepositoryFileSchema = void 0;
|
|
4
|
+
exports.UnisphereRepositoryFileSchema = {
|
|
5
|
+
type: 'object',
|
|
6
|
+
properties: {
|
|
7
|
+
company: { type: 'primitive', value: 'string' },
|
|
8
|
+
name: { type: 'primitive', value: 'string' },
|
|
9
|
+
schemaVersion: { type: 'primitive', value: 'string' },
|
|
10
|
+
constraints: {
|
|
11
|
+
type: 'array',
|
|
12
|
+
optional: true,
|
|
13
|
+
items: {
|
|
14
|
+
type: 'object',
|
|
15
|
+
properties: {
|
|
16
|
+
type: { type: 'primitive', value: 'string' },
|
|
17
|
+
packages: {
|
|
18
|
+
type: 'array',
|
|
19
|
+
items: {
|
|
20
|
+
type: 'primitive',
|
|
21
|
+
value: 'string',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
contexts: {
|
|
25
|
+
type: 'array',
|
|
26
|
+
items: {
|
|
27
|
+
type: 'primitive',
|
|
28
|
+
value: 'string',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
allowUnknownProperties: false,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
elements: {
|
|
36
|
+
type: 'object',
|
|
37
|
+
properties: {
|
|
38
|
+
packages: {
|
|
39
|
+
type: 'map',
|
|
40
|
+
value: {
|
|
41
|
+
type: 'object',
|
|
42
|
+
properties: {
|
|
43
|
+
sourceRoot: { type: 'primitive', value: 'string' },
|
|
44
|
+
distributionChannel: {
|
|
45
|
+
type: 'enum',
|
|
46
|
+
values: ['none', 'npm', 'github'],
|
|
47
|
+
},
|
|
48
|
+
scope: {
|
|
49
|
+
type: 'enum',
|
|
50
|
+
values: ['global', 'widget'],
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
optional: true,
|
|
55
|
+
},
|
|
56
|
+
contexts: {
|
|
57
|
+
type: 'map',
|
|
58
|
+
value: {
|
|
59
|
+
type: 'object',
|
|
60
|
+
properties: {
|
|
61
|
+
sourceRoot: { type: 'primitive', value: 'string' },
|
|
62
|
+
distributionChannel: {
|
|
63
|
+
type: 'enum',
|
|
64
|
+
values: ['none', 'unisphere'],
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
optional: true,
|
|
69
|
+
},
|
|
70
|
+
workspace: {
|
|
71
|
+
type: 'object',
|
|
72
|
+
optional: true,
|
|
73
|
+
properties: {
|
|
74
|
+
sourceRoot: { type: 'primitive', value: 'string' },
|
|
75
|
+
distributionChannel: {
|
|
76
|
+
type: 'enum',
|
|
77
|
+
values: ['none', 'unisphere'],
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
loader: {
|
|
82
|
+
type: 'object',
|
|
83
|
+
optional: true,
|
|
84
|
+
properties: {
|
|
85
|
+
sourceRoot: { type: 'primitive', value: 'string' },
|
|
86
|
+
distributionChannel: {
|
|
87
|
+
type: 'enum',
|
|
88
|
+
values: ['none', 'unisphere'],
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
allowUnknownProperties: false,
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../packages/unisphere-cli/src/lib/utils/unisphere/types.ts"],"names":[],"mappings":";;;AAgCa,QAAA,6BAA6B,GAAW;IACnD,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,OAAO,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE;QAC/C,IAAI,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE;QAC5C,aAAa,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE;QACrD,WAAW,EAAE;YACX,IAAI,EAAE,OAAO;YACb,QAAQ,EAAE,IAAI;YACd,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,IAAI,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE;oBAC5C,QAAQ,EAAE;wBACR,IAAI,EAAE,OAAO;wBACb,KAAK,EAAE;4BACL,IAAI,EAAE,WAAW;4BACjB,KAAK,EAAE,QAAQ;yBAChB;qBACF;oBACD,QAAQ,EAAE;wBACR,IAAI,EAAE,OAAO;wBACb,KAAK,EAAE;4BACL,IAAI,EAAE,WAAW;4BACjB,KAAK,EAAE,QAAQ;yBAChB;qBACF;iBACF;gBACD,sBAAsB,EAAE,KAAK;aAC9B;SACF;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,QAAQ,EAAE;oBACR,IAAI,EAAE,KAAK;oBACX,KAAK,EAAE;wBACL,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE;4BACV,UAAU,EAAE,EAAE,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;CACF,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getUnisphereWorkspace = exports.getRuntimeBucketKey = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const find_unisphere_workspace_file_1 = require("./find-unisphere-workspace-file");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const read_json_file_1 = require("../read-json-file");
|
|
8
|
+
const debug_1 = require("debug");
|
|
9
|
+
const types_1 = require("./types");
|
|
10
|
+
const prompts_1 = require("../prompts/prompts");
|
|
11
|
+
const augment_workspace_config_1 = require("./augment-workspace-config");
|
|
12
|
+
const validator_1 = require("../validator");
|
|
13
|
+
const debug = (0, debug_1.default)('unisphere:utils:unisphere');
|
|
14
|
+
const getRuntimeBucketKey = () => `v1/runtime.json`;
|
|
15
|
+
exports.getRuntimeBucketKey = getRuntimeBucketKey;
|
|
16
|
+
const getUnisphereWorkspace = (cwd, options) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
+
var _a;
|
|
18
|
+
debug('looking for workspace root (assume root contains file named .unisphere)');
|
|
19
|
+
const repositoryRootPath = (0, find_unisphere_workspace_file_1.findUnisphereWorkspaceFile)(cwd, (_a = options === null || options === void 0 ? void 0 : options.suspendRecursion) !== null && _a !== void 0 ? _a : false);
|
|
20
|
+
if (!repositoryRootPath) {
|
|
21
|
+
throw new Error('Failed to find repository root path');
|
|
22
|
+
}
|
|
23
|
+
const workspaceConfigurationPath = path.join(repositoryRootPath, '.unisphere');
|
|
24
|
+
const workspaceConfiguration = yield (0, read_json_file_1.readJsonFile)(workspaceConfigurationPath);
|
|
25
|
+
if (!workspaceConfiguration) {
|
|
26
|
+
(0, prompts_1.logErrorAndExit)('Failed to read workspace configuration');
|
|
27
|
+
}
|
|
28
|
+
const validationErrors = (0, validator_1.validateSchema)(workspaceConfiguration, types_1.UnisphereRepositoryFileSchema, 'workspace configuration');
|
|
29
|
+
if (validationErrors.length > 0) {
|
|
30
|
+
debug('Invalid workspace configuration:');
|
|
31
|
+
validationErrors.forEach((error) => {
|
|
32
|
+
debug(`${error.path}: ${error.message}`);
|
|
33
|
+
});
|
|
34
|
+
(0, prompts_1.logErrorAndExit)('Invalid workspace configuration');
|
|
35
|
+
}
|
|
36
|
+
if (workspaceConfiguration.company !== 'kaltura') {
|
|
37
|
+
(0, prompts_1.logErrorAndExit)(`Only Kaltura modules are supported, got '${workspaceConfiguration.company}'`);
|
|
38
|
+
}
|
|
39
|
+
const config = (0, augment_workspace_config_1.augmentWorkspaceConfig)(repositoryRootPath, workspaceConfiguration);
|
|
40
|
+
return {
|
|
41
|
+
company: workspaceConfiguration.company,
|
|
42
|
+
name: workspaceConfiguration.name,
|
|
43
|
+
repository: {
|
|
44
|
+
repositoryRootPath,
|
|
45
|
+
},
|
|
46
|
+
config,
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
exports.getUnisphereWorkspace = getUnisphereWorkspace;
|
|
50
|
+
//# sourceMappingURL=workspace.js.map
|