PATH: //opt/alt/alt-nodejs20/root/lib/node_modules/npm/lib/utils
FILE_BARU
CREATE
FOLDER_BARU
MKDIR
UPLOAD_FILE
GO
[ .. KEMBALI ]
📄 audit-error.js
↓
X
📄 auth.js
↓
X
📄 cmd-list.js
↓
X
📄 completion.fish
↓
X
📄 completion.sh
↓
X
📄 did-you-mean.js
↓
X
📄 display.js
↓
X
📄 error-message.js
↓
X
📄 explain-dep.js
↓
X
📄 explain-eresolve.js
↓
X
📄 format-bytes.js
↓
X
📄 format-search-stream.js
↓
X
📄 format.js
↓
X
📄 get-identity.js
↓
X
📄 get-workspaces.js
↓
X
📄 installed-deep.js
↓
X
📄 installed-shallow.js
↓
X
📄 is-windows.js
↓
X
📄 log-file.js
↓
X
📄 npm-usage.js
↓
X
📄 open-url.js
↓
X
📄 output-error.js
↓
X
📄 ping.js
↓
X
📄 queryable.js
↓
X
📄 read-user-info.js
↓
X
📄 reify-finish.js
↓
X
📄 reify-output.js
↓
X
📄 sbom-cyclonedx.js
↓
X
📄 sbom-spdx.js
↓
X
📄 tar.js
↓
X
📄 timers.js
↓
X
📄 update-workspaces.js
↓
X
📄 validate-lockfile.js
↓
X
📄 verify-signatures.js
↓
X
SAVING...
BERHASIL DIUBAH!
EDITING: did-you-mean.js
const Npm = require('../npm') const { distance } = require('fastest-levenshtein') const { commands } = require('./cmd-list.js') const runScripts = ['stop', 'start', 'test', 'restart'] const isClose = (scmd, cmd) => distance(scmd, cmd) < scmd.length * 0.4 const didYouMean = (pkg, scmd) => { const { scripts = {}, bin = {} } = pkg || {} const best = [ ...commands .filter(cmd => isClose(scmd, cmd) && scmd !== cmd) .map(str => [str, Npm.cmd(str).description]), ...Object.keys(scripts) // We would already be suggesting this in `npm x` so omit them here .filter(cmd => isClose(scmd, cmd) && !runScripts.includes(cmd)) .map(str => [`run ${str}`, `run the "${str}" package script`]), ...Object.keys(bin) .filter(cmd => isClose(scmd, cmd)) /* eslint-disable-next-line max-len */ .map(str => [`exec ${str}`, `run the "${str}" command from either this or a remote npm package`]), ] if (best.length === 0) { return '' } return `\n\nDid you mean ${best.length === 1 ? 'this' : 'one of these'}?\n` + best.slice(0, 3).map(([msg, comment]) => ` npm ${msg} # ${comment}`).join('\n') } module.exports = didYouMean
SIMPAN PERUBAHAN