-
Notifications
You must be signed in to change notification settings - Fork 43
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
1 parent
bc67ffe
commit 3aad5c6
Showing
189 changed files
with
154,290 additions
and
3,625 deletions.
There are no files selected for viewing
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,3 @@ | ||
test/yarn-berry.cjs | ||
test/yarn-*.cjs | ||
dist | ||
coverage |
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 +1 @@ | ||
test/yarn-berry.cjs linguist-vendored | ||
test/yarn-*.cjs linguist-vendored |
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,5 +1,6 @@ | ||
test/yarn-berry.cjs | ||
coverage | ||
test/yarn-*.cjs | ||
**/pnpm-lock.yaml | ||
**/*-output.json | ||
**/.pnp.cjs | ||
test/*/*.json |
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,43 +1,4 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Mocha All", | ||
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha", | ||
"args": [ | ||
"-r", | ||
"ts-node/register", | ||
"--timeout", | ||
"999999", | ||
"--extensions", | ||
"ts", | ||
"--recursive", | ||
"--colors", | ||
"${workspaceFolder}/test/*.spec.ts" | ||
], | ||
"console": "integratedTerminal", | ||
"internalConsoleOptions": "neverOpen" | ||
}, | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Mocha Current File", | ||
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha", | ||
"args": [ | ||
"-r", | ||
"ts-node/register", | ||
"--timeout", | ||
"999999", | ||
"--extensions", | ||
"ts", | ||
"--recursive", | ||
"--colors", | ||
"${file}" | ||
], | ||
"console": "integratedTerminal", | ||
"internalConsoleOptions": "neverOpen" | ||
} | ||
] | ||
"configurations": [] | ||
} |
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
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,39 @@ | ||
import { execSync } from "child_process"; | ||
import semver from "semver"; | ||
|
||
export const MINIMUM_YARN_CLASSIC_VERSION = "1.12.3"; | ||
export const MINIMUM_YARN_BERRY_VERSION = "2.4.0"; | ||
/** | ||
* Change this to the appropriate version when | ||
* yarn audit --registry is supported: | ||
* @see https://github.com/yarnpkg/yarn/issues/7012 | ||
*/ | ||
const MINIMUM_YARN_AUDIT_REGISTRY_VERSION = "99.99.99"; | ||
|
||
export function yarnSupportsClassicAudit(yarnVersion: string | semver.SemVer) { | ||
return semver.satisfies(yarnVersion, `^${MINIMUM_YARN_CLASSIC_VERSION}`); | ||
} | ||
|
||
export function yarnSupportsBerryAudit(yarnVersion: string | semver.SemVer) { | ||
return semver.gte(yarnVersion, MINIMUM_YARN_BERRY_VERSION); | ||
} | ||
|
||
export function yarnSupportsAudit(yarnVersion: string | semver.SemVer) { | ||
return ( | ||
yarnSupportsClassicAudit(yarnVersion) || yarnSupportsBerryAudit(yarnVersion) | ||
); | ||
} | ||
|
||
export function yarnAuditSupportsRegistry(yarnVersion: string | semver.SemVer) { | ||
return semver.gte(yarnVersion, MINIMUM_YARN_AUDIT_REGISTRY_VERSION); | ||
} | ||
|
||
const versionMap = new Map<string, string>(); | ||
export function getYarnVersion(yarnExec = "yarn", cwd?: string) { | ||
const key = `${yarnExec}:${cwd}`; | ||
let version = versionMap.get(key); | ||
if (version) return version; | ||
version = execSync(`${yarnExec} -v`, { cwd }).toString().replace("\n", ""); | ||
versionMap.set(key, version); | ||
return version; | ||
} |
Oops, something went wrong.