Skip to content

Commit

Permalink
ENG-5101 Add the "--force" flag to not filter widgets when using the …
Browse files Browse the repository at this point in the history
…env command
  • Loading branch information
avdev4j committed Sep 18, 2023
1 parent 1af07f6 commit 1281e14
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions bin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ program
.option('--env <env>', 'The location for the env.json file containing the description of the environment to export', 'env.json')
.option('--location <location>', 'The location for where to store the generated Bundle', './')
.option('--exclude-microservices', 'Whether to include microservices in the export')
.option('--force', 'Force exporting all components')
.requiredOption('--code <code>', 'The code for the Bundle')
.requiredOption('--description <description>', 'The description of the Bundle')
.action(generateFromEnv);
Expand Down
12 changes: 11 additions & 1 deletion lib/env-bundler.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ const ALL_TYPES = [
'language',
];

var forceExportAllComponents;

var coreBaseApi, componentManagerApi, clientId, clientSecret, apiUrlTable, defaultLang;

const componentDetailExtractors = {
Expand Down Expand Up @@ -331,7 +333,13 @@ const componentResponseProcessor = {
configUi: 'configUi',
};

return widgets.filter(w => !w.locked && w.group).map(w => objectMapper(w, schema));
let currentWidgetsList = widgets;

if (!forceExportAllComponents) {
currentWidgetsList = widgets.filter(w => !w.locked && w.group);
}

return currentWidgetsList.map(w => objectMapper(w, schema));
},
contentType: async (componentsToFetch) => {
// ENG-1826 workaround: switch CODE blocks when the bug will be fixed in entando-engine
Expand Down Expand Up @@ -1173,6 +1181,8 @@ async function setupEnvironment (options) {
ALL_TYPES.push('plugin');
}

forceExportAllComponents = options.force || false;

// Setup env variables
coreBaseApi = envContent.coreBaseApi;
componentManagerApi = envContent.componentManagerApi || envContent.k8ssvcApi;
Expand Down

0 comments on commit 1281e14

Please sign in to comment.