Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions javascript/extractor/lib/typescript/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
config_setting(
name = "use_cfs",
define_values = {"CODEQL_USE_CFS": "true"},
)

_NPM_INSTALL = select({
":use_cfs": "gh cfs -- npm install",
"//conditions:default": "$$NPM install",
})

# Builds a zip file of the compiled typscript-parser-wrapper and its dependencies.
genrule(
name = "typescript",
Expand Down Expand Up @@ -25,11 +35,20 @@ genrule(
"rm -rf $(RULEDIR)/inputs",
"cp -L -R $$(dirname $(execpath package.json)) $(RULEDIR)/inputs",
"cd $(RULEDIR)/inputs",
"$$NPM install",
]) + "\n" + select({
":use_cfs": "\n".join([
# gh cfs requires an executable named npm; retain the bundled npm version.
"mkdir -p $$TEMP/bin",
"ln -s $$NPM $$TEMP/bin/npm",
"export PATH=$$TEMP/bin:$$PATH",
"",
]),
"//conditions:default": "",
}) + _NPM_INSTALL + "\n" + "\n".join([
"$$NPM run build",
"rm -rf node_modules",
# Install again with only runtime deps
"$$NPM install --prod",
]) + "\n" + _NPM_INSTALL + " --prod\n" + "\n".join([
"mv node_modules build/",
"mkdir -p typescript-parser-wrapper",
"mv build/* typescript-parser-wrapper",
Expand Down
Loading