-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
76 additions
and
35 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
declare enum Categories { | ||
CLEANUP = 'cleanup', | ||
LEVELUP = 'levelup', | ||
SPEEDUP = 'speedup', | ||
TUNEUP = 'tuneup' | ||
} | ||
declare type CategoryString = `${Categories}` | ||
declare enum PURL_Type { | ||
NPM = 'npm' | ||
} | ||
declare type EcosystemString = `${PURL_Type}` | ||
declare enum Interop { | ||
BROWSERIFY = 'browserify', | ||
CJS = 'cjs', | ||
ESM = 'esm' | ||
} | ||
declare type InteropString = `${Interop}` | ||
declare type ManifestData = { | ||
categories: CategoryString[] | ||
interop: InteropString[] | ||
license: string | ||
package: string | ||
version: string | ||
deprecated?: boolean | ||
engines?: { node: string; npm?: string } | ||
skipTests?: boolean | ||
} | ||
declare module '@socketsecurity/registry' { | ||
export function getManifestData( | ||
eco: EcosystemString, | ||
regPkgName: string | ||
): ManifestData | undefined | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,21 @@ | ||
'use strict' | ||
|
||
module.exports = require('./manifest.json') | ||
const { PackageURL } = require('packageurl-js') | ||
|
||
function getManifestData(eco, regPkgName) { | ||
const registryManifest = require('./manifest.json') | ||
let purlObj | ||
const entry = registryManifest[eco].find(({ 0: purlStr }) => { | ||
const purlObj_ = PackageURL.fromString(purlStr) | ||
const found = purlObj_.name === regPkgName | ||
if (found) { | ||
purlObj = purlObj_ | ||
} | ||
return found | ||
}) | ||
return entry ? { ...entry[1], version: purlObj.version } : undefined | ||
} | ||
|
||
module.exports = { | ||
getManifestData | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters