From 57999ab038b0413a5795f7dba128abbfa9b4353d Mon Sep 17 00:00:00 2001 From: caleb <16196262+spookyuser@users.noreply.github.com> Date: Fri, 6 Dec 2024 12:20:33 +0200 Subject: [PATCH] Fix regex error --- package.json | 2 +- src/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index c1d72b7..32974fe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "badlinks", - "version": "1.0.10", + "version": "1.0.11", "description": "A fast way to scan a package for links that might upset the chrome webstore team", "scripts": { "build": "tsup ./src", diff --git a/src/index.ts b/src/index.ts index 8b26974..edd6e86 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,7 +12,7 @@ function findJsLinks(folderPath: string, remove: boolean = false): void { findJsLinks(filePath, remove); } else if (fileStat.isFile() && path.extname(filePath) === ".js") { let fileContent = fs.readFileSync(filePath, "utf-8"); - const links = fileContent.match(/https?:\/\/[^\s"']+(?:\.js|\/js)(?!.*redux)(\?[^#"'<>]*)?/g); + const links = fileContent.match(/https?:\/\/(?!.*redux)[^\s"]+\.js/g); if (links) { console.log(`JS link(s) found in ${filePath}:`); console.log(links);