Replace homoglyphs.ts with unhomoglyph library

This commit is contained in:
Jonathan Leitschuh 2020-01-15 11:39:59 -05:00
parent ae0da6528c
commit e4429f250f
No known key found for this signature in database
GPG key ID: 3501A7427721B061
6 changed files with 49 additions and 4090 deletions

2069
dist/index.js vendored

File diff suppressed because one or more lines are too long

5
package-lock.json generated
View file

@ -6180,6 +6180,11 @@
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz",
"integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI="
},
"unhomoglyph": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/unhomoglyph/-/unhomoglyph-1.0.3.tgz",
"integrity": "sha512-PC/OAHE8aiTK0Gfmy0PxOlePazRn+BeCM1r4kFtkHgEnkJZgJoI7yD2yUEjsfSdLXKU1FSt/EcIZvNoKazYUTw=="
},
"union-value": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz",

View file

@ -26,7 +26,8 @@
"license": "MIT",
"dependencies": {
"@actions/core": "^1.2.0",
"typed-rest-client": "^1.7.1"
"typed-rest-client": "^1.7.1",
"unhomoglyph": "^1.0.3"
},
"devDependencies": {
"@types/jest": "^24.0.23",

4
src/declarations.d.ts vendored Normal file
View file

@ -0,0 +1,4 @@
declare module 'unhomoglyph' {
function unhomoglyph(input: string): string
export = unhomoglyph
}

View file

@ -1,18 +1,14 @@
import * as util from 'util'
import * as path from 'path'
import * as fs from 'fs'
import * as homoglyphs from './homoglyphs'
import unhomoglyph from 'unhomoglyph'
const readdir = util.promisify(fs.readdir)
export async function findWrapperJars(baseDir: string): Promise<string[]> {
const targetWords = ['gradle-wrapper.jar']
const files = await recursivelyListFiles(baseDir)
return files
.filter(
file => homoglyphs.search(path.basename(file), targetWords).length > 0
)
.filter(file => unhomoglyph(file).endsWith('gradle-wrapper.jar'))
.map(wrapperJar => path.relative(baseDir, wrapperJar))
}

File diff suppressed because it is too large Load diff