5 examples of 'npm warn old lockfile' in JavaScript

Every line of 'npm warn old lockfile' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
5get lockfileName() {
6 return 'package-lock.json';
7}
96function shouldWarn(pkg, folder, global, cb) {
97 var parent = path.dirname(folder)
98 , top = parent === npm.dir
99 , cwd = process.cwd()
100
101 readJson(path.resolve(cwd, "package.json"), function(er, topPkg) {
102 if (er) return cb(er)
103
104 var linkedPkg = path.basename(cwd)
105 , currentPkg = path.basename(folder)
106
107 // current searched package is the linked package on first call
108 if (linkedPkg !== currentPkg) {
109
110 if (!topPkg.dependencies) return cb()
111
112 // don't generate a warning if it's listed in dependencies
113 if (Object.keys(topPkg.dependencies).indexOf(currentPkg) === -1) {
114
115 if (top && pkg.preferGlobal && !global) {
116 log.warn("prefer global", pkg._id + " should be installed with -g")
117 }
118 }
119 }
120
121 cb()
122 })
123}
109removeYarnLockFile() {
110 let filePath = path.join(this.project.dir, "yarn.lock");
111 if (fs.existsSync(filePath)) {
112 fs.unlinkSync(filePath);
113 }
114}
23export function writeWantedLockfile (
24 pkgPath: string,
25 wantedLockfile: Lockfile,
26 opts?: {
27 forceSharedFormat?: boolean,
28 },
29) {
30 return writeLockfile(WANTED_LOCKFILE, pkgPath, wantedLockfile, opts)
31}
56function warn (pkg, code, msg) {
57 var tree = getTree(pkg)
58 var err = new Error(msg)
59 err.code = code
60 tree.warnings.push(err)
61}

Related snippets