@squiz/dxp-cli-next 5.21.0-develop.1 → 5.21.0-develop.3
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 +6 -5
- package/package.json +1 -1
package/lib/cmp/deploy.js
CHANGED
|
@@ -63,8 +63,8 @@ const deployCommand = new commander_1.Command()
|
|
|
63
63
|
if ((_a = options.componentServiceUrl) === null || _a === void 0 ? void 0 : _a.match(/v1\/?$/)) {
|
|
64
64
|
console.warn(cli_color_1.default.yellow('WARN: Component service URL no longer requires /v1/ suffix'));
|
|
65
65
|
}
|
|
66
|
+
const dxpCacheDirPath = path.resolve(source, '../.dxp');
|
|
66
67
|
try {
|
|
67
|
-
const dxpCacheDirPath = path.resolve(source, '../.dxp');
|
|
68
68
|
yield fs.mkdir(dxpCacheDirPath, { recursive: true });
|
|
69
69
|
const outputDir = yield fs.mkdtemp(path.resolve(dxpCacheDirPath, 'cmp-'));
|
|
70
70
|
const def = yield definitions_1.ComponentDefinition.load(source);
|
|
@@ -79,7 +79,7 @@ const deployCommand = new commander_1.Command()
|
|
|
79
79
|
console.info(cli_color_1.default.yellow('INFO: Cancelling deployment due to --dry-run flag'));
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
|
-
|
|
82
|
+
yield (0, component_cli_lib_1.uploadComponentFolder)(apiService.client, componentServiceUrl, outputDir, dxpCacheDirPath);
|
|
83
83
|
}
|
|
84
84
|
if (def.type === 'edge') {
|
|
85
85
|
if (process.env.FEATURE_EDGE_COMPONENTS !== 'true') {
|
|
@@ -90,7 +90,7 @@ const deployCommand = new commander_1.Command()
|
|
|
90
90
|
console.info(cli_color_1.default.yellow('INFO: Cancelling deployment due to --dry-run flag'));
|
|
91
91
|
return;
|
|
92
92
|
}
|
|
93
|
-
|
|
93
|
+
yield (0, component_cli_lib_1.uploadComponentFolder)(apiService.client, componentServiceUrl, outputDir, dxpCacheDirPath);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
catch (error) {
|
|
@@ -99,11 +99,11 @@ const deployCommand = new commander_1.Command()
|
|
|
99
99
|
}
|
|
100
100
|
if (error instanceof ApiService_1.InvalidLoginSessionError) {
|
|
101
101
|
deployCommand.error(cli_color_1.default.red('ERROR:', 'Login session expired. Please login again.'));
|
|
102
|
-
return;
|
|
102
|
+
return fs.rm(dxpCacheDirPath, { recursive: true });
|
|
103
103
|
}
|
|
104
104
|
if (error instanceof ApiService_1.InvalidTenantError) {
|
|
105
105
|
deployCommand.error(cli_color_1.default.red('ERROR:', 'Cannot deploy to specified tenant'));
|
|
106
|
-
return;
|
|
106
|
+
return fs.rm(dxpCacheDirPath, { recursive: true });
|
|
107
107
|
}
|
|
108
108
|
if (error.message) {
|
|
109
109
|
deployCommand.error(cli_color_1.default.red('ERROR:', error.message));
|
|
@@ -112,6 +112,7 @@ const deployCommand = new commander_1.Command()
|
|
|
112
112
|
deployCommand.error(cli_color_1.default.red('ERROR:', 'An unknown error occurred'));
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
+
return fs.rm(dxpCacheDirPath, { recursive: true });
|
|
115
116
|
}));
|
|
116
117
|
exports.default = deployCommand;
|
|
117
118
|
function buildComponentServiceUrl(tenantID) {
|