Skip to content

Commit

Permalink
Merge pull request #1 from lucasazevedonet/patch-1
Browse files Browse the repository at this point in the history
Refined regex to match .js and /js with query strings
  • Loading branch information
spookyuser authored Nov 23, 2024
2 parents a37f1f4 + 90b57e0 commit 90c3cfc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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?:\/\/(?!.*redux)[^\s"]+\.js/g);
const links = fileContent.match(/https?:\/\/[^\s"']+(?:\.js|\/js)(?!.*redux)(\?[^#"'<>]*)?/g);
if (links) {
console.log(`JS link(s) found in ${filePath}:`);
console.log(links);
Expand Down

0 comments on commit 90c3cfc

Please sign in to comment.