From 1281e14656a34e09e89a70848cc1438e1737ccf0 Mon Sep 17 00:00:00 2001 From: Anthony Viard Date: Mon, 18 Sep 2023 15:31:52 +0200 Subject: [PATCH] ENG-5101 Add the "--force" flag to not filter widgets when using the env command --- bin/index.js | 1 + lib/env-bundler.js | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/bin/index.js b/bin/index.js index f6bc789..f7af749 100755 --- a/bin/index.js +++ b/bin/index.js @@ -42,6 +42,7 @@ program .option('--env ', 'The location for the env.json file containing the description of the environment to export', 'env.json') .option('--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 ', 'The code for the Bundle') .requiredOption('--description ', 'The description of the Bundle') .action(generateFromEnv); diff --git a/lib/env-bundler.js b/lib/env-bundler.js index a74fb40..6ae96d8 100644 --- a/lib/env-bundler.js +++ b/lib/env-bundler.js @@ -30,6 +30,8 @@ const ALL_TYPES = [ 'language', ]; +var forceExportAllComponents; + var coreBaseApi, componentManagerApi, clientId, clientSecret, apiUrlTable, defaultLang; const componentDetailExtractors = { @@ -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 @@ -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;