@squiz/dxp-cli-next 5.17.0 → 5.17.1-develop.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/lib/cmp/deploy.js
CHANGED
|
@@ -84,8 +84,8 @@ const deployCommand = new commander_1.Command()
|
|
|
84
84
|
yield fs.mkdir(dxpCacheDirPath, { recursive: true });
|
|
85
85
|
const outputDir = yield fs.mkdtemp(path.resolve(dxpCacheDirPath, 'cmp-'));
|
|
86
86
|
yield (0, compiler_1.compileUserCode)(def.mainEntryFilePath, path.join(outputDir, 'userCode.js'));
|
|
87
|
-
yield
|
|
88
|
-
return yield (0, component_cli_lib_1.uploadComponentFolder)(apiService, componentServiceUrl, outputDir);
|
|
87
|
+
yield def.copyManifest(outputDir);
|
|
88
|
+
return yield (0, component_cli_lib_1.uploadComponentFolder)(apiService.client, componentServiceUrl, outputDir);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
catch (error) {
|
|
@@ -112,6 +112,6 @@ exports.default = deployCommand;
|
|
|
112
112
|
function buildComponentServiceUrl(tenantID) {
|
|
113
113
|
return __awaiter(this, void 0, void 0, function* () {
|
|
114
114
|
const existingConfig = yield (0, ApplicationConfig_1.fetchApplicationConfig)(tenantID);
|
|
115
|
-
return `${existingConfig.baseUrl}/__dxp/${existingConfig.region}/components-management/${existingConfig.tenant}
|
|
115
|
+
return `${existingConfig.baseUrl}/__dxp/${existingConfig.region}/components-management/${existingConfig.tenant}`;
|
|
116
116
|
});
|
|
117
117
|
}
|
|
@@ -62,6 +62,19 @@ class ComponentDefinition {
|
|
|
62
62
|
get manifestPath() {
|
|
63
63
|
return path.resolve(this.baseDir, 'manifest.json');
|
|
64
64
|
}
|
|
65
|
+
copyManifest(copyDir) {
|
|
66
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
yield fs.copyFile(this.manifestPath, path.resolve(copyDir, 'manifest.json'));
|
|
68
|
+
const manifest = yield fs.readFile(path.resolve(copyDir, 'manifest.json'), {
|
|
69
|
+
encoding: 'utf-8',
|
|
70
|
+
});
|
|
71
|
+
const definition = JSON.parse(manifest);
|
|
72
|
+
definition.functions = definition.functions.map((func) => {
|
|
73
|
+
return Object.assign(Object.assign({}, func), { entry: 'userCode.js' });
|
|
74
|
+
});
|
|
75
|
+
return yield fs.writeFile(path.resolve(copyDir, 'manifest.json'), JSON.stringify(definition));
|
|
76
|
+
});
|
|
77
|
+
}
|
|
65
78
|
}
|
|
66
79
|
exports.ComponentDefinition = ComponentDefinition;
|
|
67
80
|
const BasicDefinition = zod_1.z.object({
|