@eclipse-che/che-theia-devworkspace-handler
Advanced tools
Comparing version 0.0.1-1637317148 to 0.0.1-1637339718
@@ -28,11 +28,27 @@ "use strict"; | ||
const cheTheiaPluginsYamlInRepository = jsYaml.load(cheTheiaPluginsYamlContent); | ||
// only format supported right now is list of ids as for example: | ||
// example of the supported format: | ||
// - id: redhat/java8/latest | ||
// override: | ||
// preferences: | ||
// java.server.launchMode: LightWeight | ||
// sidecar: | ||
// memoryLimit: 1280Mi | ||
// cpuLimit: 128Mi | ||
if (cheTheiaPluginsYamlInRepository && Array.isArray(cheTheiaPluginsYamlInRepository)) { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
return cheTheiaPluginsYamlInRepository.map(entry => ({ | ||
id: entry.id, | ||
resolved: false, | ||
extensions: [], | ||
})); | ||
return cheTheiaPluginsYamlInRepository.map(entry => { | ||
var _a, _b; | ||
const sidecar = (_a = entry.override) === null || _a === void 0 ? void 0 : _a.sidecar; | ||
if (sidecar && !sidecar.image) { | ||
// image will be applied from the plugin registry | ||
sidecar.image = ''; | ||
} | ||
return { | ||
id: entry.id, | ||
resolved: false, | ||
extensions: [], | ||
preferences: (_b = entry.override) === null || _b === void 0 ? void 0 : _b.preferences, | ||
sidecar: sidecar, | ||
}; | ||
}); | ||
} | ||
@@ -39,0 +55,0 @@ // not able to really see the content, return something empty |
@@ -98,4 +98,17 @@ "use strict"; | ||
} | ||
const vSCodeExtensionEntrySidecar = vSCodeExtensionEntry.sidecar; | ||
vSCodeExtensionEntry.sidecar = sidecar; | ||
vSCodeExtensionEntry.preferences = cheTheiaPluginYaml.preferences; | ||
//overwrite cpu and memory limit in sidecar | ||
if (vSCodeExtensionEntrySidecar === null || vSCodeExtensionEntrySidecar === void 0 ? void 0 : vSCodeExtensionEntrySidecar.cpuLimit) { | ||
vSCodeExtensionEntry.sidecar.cpuLimit = vSCodeExtensionEntrySidecar.cpuLimit; | ||
} | ||
if (vSCodeExtensionEntrySidecar === null || vSCodeExtensionEntrySidecar === void 0 ? void 0 : vSCodeExtensionEntrySidecar.memoryLimit) { | ||
vSCodeExtensionEntry.sidecar.memoryLimit = vSCodeExtensionEntrySidecar.memoryLimit; | ||
} | ||
// merge preferences | ||
// a preference from entry should overwrite a preference from registry which has identical key | ||
const pluginPreferences = cheTheiaPluginYaml.preferences || {}; | ||
const overriddenPreferences = vSCodeExtensionEntry.preferences || {}; | ||
const allPreferences = Object.assign(Object.assign({}, pluginPreferences), overriddenPreferences); | ||
vSCodeExtensionEntry.preferences = allPreferences; | ||
vSCodeExtensionEntry.dependencies = cheTheiaPluginYaml.dependencies; | ||
@@ -102,0 +115,0 @@ } |
{ | ||
"name": "@eclipse-che/che-theia-devworkspace-handler", | ||
"version": "0.0.1-1637317148", | ||
"version": "0.0.1-1637339718", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "Handle management of che-theia-plugins and devWorkspace templates", |
@@ -13,2 +13,3 @@ /********************************************************************** | ||
import { V1alpha2DevWorkspaceSpecTemplateComponentsItemsContainer } from '@devfile/api'; | ||
import { VSCodeExtensionEntry } from '../api/vscode-extension-entry'; | ||
@@ -26,12 +27,27 @@ import { injectable } from 'inversify'; | ||
// only format supported right now is list of ids as for example: | ||
// example of the supported format: | ||
// - id: redhat/java8/latest | ||
// override: | ||
// preferences: | ||
// java.server.launchMode: LightWeight | ||
// sidecar: | ||
// memoryLimit: 1280Mi | ||
// cpuLimit: 128Mi | ||
if (cheTheiaPluginsYamlInRepository && Array.isArray(cheTheiaPluginsYamlInRepository)) { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
return cheTheiaPluginsYamlInRepository.map(entry => ({ | ||
id: entry.id, | ||
resolved: false, | ||
extensions: [], | ||
})); | ||
return cheTheiaPluginsYamlInRepository.map(entry => { | ||
const sidecar: V1alpha2DevWorkspaceSpecTemplateComponentsItemsContainer = entry.override?.sidecar; | ||
if (sidecar && !sidecar.image) { | ||
// image will be applied from the plugin registry | ||
sidecar.image = ''; | ||
} | ||
return { | ||
id: entry.id, | ||
resolved: false, | ||
extensions: [], | ||
preferences: entry.override?.preferences, | ||
sidecar: sidecar, | ||
}; | ||
}); | ||
} | ||
@@ -38,0 +54,0 @@ |
@@ -137,6 +137,22 @@ /********************************************************************** | ||
} | ||
const vSCodeExtensionEntrySidecar = vSCodeExtensionEntry.sidecar; | ||
vSCodeExtensionEntry.sidecar = sidecar; | ||
vSCodeExtensionEntry.preferences = cheTheiaPluginYaml.preferences; | ||
//overwrite cpu and memory limit in sidecar | ||
if (vSCodeExtensionEntrySidecar?.cpuLimit) { | ||
vSCodeExtensionEntry.sidecar.cpuLimit = vSCodeExtensionEntrySidecar.cpuLimit; | ||
} | ||
if (vSCodeExtensionEntrySidecar?.memoryLimit) { | ||
vSCodeExtensionEntry.sidecar.memoryLimit = vSCodeExtensionEntrySidecar.memoryLimit; | ||
} | ||
// merge preferences | ||
// a preference from entry should overwrite a preference from registry which has identical key | ||
const pluginPreferences = cheTheiaPluginYaml.preferences || {}; | ||
const overriddenPreferences = vSCodeExtensionEntry.preferences || {}; | ||
const allPreferences = { ...pluginPreferences, ...overriddenPreferences }; | ||
vSCodeExtensionEntry.preferences = allPreferences; | ||
vSCodeExtensionEntry.dependencies = cheTheiaPluginYaml.dependencies; | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
208737
3348