Skip to content

Commit

Permalink
feat(server): add fetchLicense arg
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Setch <adam.setch@outlook.com>
  • Loading branch information
setchy committed Aug 1, 2024
1 parent 5d6b390 commit 074b4d3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ import {
parseSwiftResolved,
parseYarnLock,
readZipEntry,
shouldFetchLicense,
splitOutputByGradleProjects,
shouldFetchLicense
} from "./utils.js";
let url = import.meta.url;
if (!url.startsWith("file://")) {
Expand Down
4 changes: 2 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const parseQueryString = (q, body, options = {}) => {
"includeFormulation",
"includeCrypto",
"standard",
"fetchLicense"
"fetchLicense",
];

for (const param of queryParams) {
Expand All @@ -117,7 +117,7 @@ const parseQueryString = (q, body, options = {}) => {
applyProfileOptions(options);
}
if (options.fetchLicense) {
process.env.FETCH_LICENSE = options.fetchLicense
process.env.FETCH_LICENSE = options.fetchLicense;
}
return options;
};
Expand Down
6 changes: 4 additions & 2 deletions utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,10 @@ export const PREFER_MAVEN_DEPS_TREE =

// Whether license information should be fetched
export function shouldFetchLicense() {
return process.env.FETCH_LICENSE && ["true", "1"].includes(process.env.FETCH_LICENSE);
return (
process.env.FETCH_LICENSE &&
["true", "1"].includes(process.env.FETCH_LICENSE)
);
}

// Whether search.maven.org will be used to identify jars without maven metadata; default, if unset shall be 'true'
Expand Down Expand Up @@ -791,7 +794,6 @@ export async function getNpmMetadata(pkgList) {
p.homepage = { url: body.homepage };
}
cdepList.push(p);

} catch (err) {
cdepList.push(p);
if (DEBUG_MODE) {
Expand Down

0 comments on commit 074b4d3

Please sign in to comment.