Skip to content

Instantly share code, notes, and snippets.

@davesnx
Created August 2, 2022 08:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davesnx/8f379c627ac3e7d206c8fdc0a4e7c693 to your computer and use it in GitHub Desktop.
Save davesnx/8f379c627ac3e7d206c8fdc0a4e7c693 to your computer and use it in GitHub Desktop.
Package manager check
const lockfileSpecs = [
{
checkfile: ".yarnrc.yml",
lockfile: "yarn.lock",
command: "yarn",
version: "2",
arguments: ["install", "--immutable"]
},
{
checkfile: "yarn.lock",
lockfile: "yarn.lock",
command: "yarn",
version: "1",
arguments: ["install", "--prefer-offline", "--pure-lockfile"]
},
{
checkfile: "package-lock.json",
lockfile: "package-lock.json",
command: "npm",
version: ">=5",
arguments: ["install", "--prefer-offline", "--no-audit", "--no-save"]
},
{
checkfile: "npm-shrinkwrap.json",
lockfile: "npm-shrinkwrap.json",
command: "npm",
version: "<5",
arguments: ["install", "--prefer-offline", "--no-audit", "--no-save"]
},
{
checkfile: "pnpm-lock.yaml",
lockfile: "pnpm-lock.yaml",
command: "pnpm",
version: ">=3",
arguments: ["install", "--prefer-offline", "--prefer-frozen-lockfile"]
},
{
checkfile: "shrinkwrap.yaml",
lockfile: "shrinkwrap.yaml",
command: "pnpm",
version: "<3",
arguments: ["install", "--prefer-offline", "--prefer-frozen-shrinkwrap"]
}
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment