Skip to content

Commit 37997b3

Browse files
committed
index-files.sh: fix bug in export of LGTM_INDEX_FILETYPES variable
1 parent 52af6be commit 37997b3

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

extractors/cds/tools/index-files.sh

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,9 @@ fi
2020
# Ensure that we have the `cds` command
2121
if ! command -v cds &> /dev/null
2222
then
23-
# Find all the directories containing a package.json with a dependency on @sap/cds, then install
24-
# the cds development kit (@sap/cds-dk) in each directory, which makes the `cds` command usable
25-
# from the npx command within that directory.
26-
#
27-
# Nested package.json files simply cause the package to be installed in the parent node_modules
28-
# directory.
29-
#
30-
# We also ensure we skip node_modules, as we can end up in a recursive loop
31-
find . -type d -name node_modules -prune -false -o -type f \( -iname 'package.json' \) -exec grep -l '@sap/cds' {} + -execdir bash -c "echo \"Installing @sap/cds-dk into \$(pwd) to enable CDS compilation.\"" \; -execdir npm install @sap/cds-dk \;
32-
cds_command="npx cds"
23+
# Use the npx command to dynamically install the cds development kit (@sap/cds-dk) package if necessary,
24+
# which then provides the cds command line tool.
25+
cds_command="npx -y --package @sap/cds-dk cds"
3326
else
3427
cds_command="cds"
3528
fi
@@ -62,7 +55,7 @@ fi
6255
export LGTM_INDEX_FILTERS=$'exclude:**/*.*\ninclude:**/*cds.json'
6356
export LGTM_INDEX_TYPESCRIPT="NONE"
6457
# Configure to copy over the CDS files as well, by pretending they are JSON
65-
export LGTM_INDEX_FILETYPES: ".cds:JSON"
58+
export LGTM_INDEX_FILETYPES=".cds:JSON"
6659

6760
echo "Extracting the cds.json files"
6861

0 commit comments

Comments
 (0)