Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ jobs:
run: npx puppeteer browsers install chrome
- name: Install dependencies
run: npm install --ignore-scripts
- name: build
run: npm run build
- name: Lint
run: npm run lint
- name: Run tests
Expand Down
9 changes: 3 additions & 6 deletions src/analysis/extractScannerData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import fs from "node:fs";
// Import Third-party Dependencies
import { getScoreColor, getVCSRepositoryPathAndPlatform } from "@nodesecure/utils";
import { getManifest, getFlags } from "@nodesecure/flags/web";
import { Extractors, type Payload, type Dependency, type DependencyVersion, type DependencyLinks } from "@nodesecure/scanner";
import { Extractors, type Payload } from "@nodesecure/scanner";
import type { RC } from "@nodesecure/rc";

// Import Internal Dependencies
Expand Down Expand Up @@ -123,11 +123,8 @@ export function buildStatsFromScannerDependencies(
new Extractors.Probes.NodeDependencies()
]);

extractor.on("manifest", (spec: string,
{ flags, links = [] }: Omit<DependencyVersion, "links"> & {
links: DependencyLinks | never[];
},
{ name }: { name: string; dependency: Dependency; }) => {
extractor.on("manifest", (spec: string, dependencyVersion, { name }) => {
const { flags, links = [] } = dependencyVersion;
const isThird = npmConfig.organizationPrefix === null ?
true :
!name.startsWith(`${npmConfig.organizationPrefix}/`);
Expand Down
6 changes: 4 additions & 2 deletions src/analysis/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,11 @@ async function fetchRepositoriesStats(

const scoresCache = new Map<string, number>();

export async function fetchScorecardScore(fullName: string) {
export async function fetchScorecardScore(
fullName: string
): Promise<number> {
if (scoresCache.has(fullName)) {
return scoresCache.get(fullName);
return scoresCache.get(fullName)!;
}
try {
const { score } = await scorecard.result(fullName, { resolveOnVersionControl: false });
Expand Down