REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 2.42 KB
Close
/proc/thread-self/root/opt/alt/alt-nodejs6/root/lib/node_modules/npm/lib/install/action/remove.js
Text
Base64
'use strict' var path = require('path') var fs = require('graceful-fs') var rimraf = require('rimraf') var asyncMap = require('slide').asyncMap var mkdirp = require('mkdirp') var npm = require('../../npm.js') var andIgnoreErrors = require('../and-ignore-errors.js') var rename = require('../../utils/rename.js') // This is weird because we want to remove the module but not it's node_modules folder // allowing for this allows us to not worry about the order of operations module.exports = function (top, buildpath, pkg, log, next) { log.silly('remove', pkg.path) if (pkg.target) { removeLink(pkg, next) } else { removeDir(pkg, log, next) } } function removeLink (pkg, next) { npm.commands.unbuild(pkg.path, true, next) } function removeDir (pkg, log, next) { var modpath = path.join(path.dirname(pkg.path), '.' + path.basename(pkg.path) + '.MODULES') rename(path.join(pkg.path, 'node_modules'), modpath, unbuildPackage) function unbuildPackage (renameEr) { npm.commands.unbuild(pkg.path, true, function () { rimraf(pkg.path, renameEr ? andRemoveEmptyParents(pkg.path) : moveModulesBack) }) } function andRemoveEmptyParents (path) { return function (er) { if (er) return next(er) removeEmptyParents(pkg.path) } } function moveModulesBack () { fs.readdir(modpath, makeTarget) } function makeTarget (readdirEr, files) { if (readdirEr) return cleanup() if (!files.length) return cleanup() mkdirp(path.join(pkg.path, 'node_modules'), function (mkdirEr) { moveModules(mkdirEr, files) }) } function moveModules (mkdirEr, files) { if (mkdirEr) return next(mkdirEr) asyncMap(files, function (file, done) { var from = path.join(modpath, file) var to = path.join(pkg.path, 'node_modules', file) // we ignore errors here, because they can legitimately happen, for instance, // bundled modules will be in both node_modules folders rename(from, to, andIgnoreErrors(done)) }, cleanup) } function cleanup () { rimraf(modpath, afterCleanup) } function afterCleanup (rimrafEr) { if (rimrafEr) log.warn('remove', rimrafEr) removeEmptyParents(path.resolve(pkg.path, '..')) } function removeEmptyParents (pkgdir) { fs.rmdir(pkgdir, function (er) { // FIXME: Make sure windows does what we want here if (er && er.code !== 'ENOENT') return next() removeEmptyParents(path.resolve(pkgdir, '..')) }) } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 14
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
build.js
425 B
lrw-r--r--
2021-09-28 09:36:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
extract.js
2.79 KB
lrw-r--r--
2021-09-28 09:36:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
fetch.js
882 B
lrw-r--r--
2021-09-28 09:36:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
finalize.js
2.74 KB
lrw-r--r--
2021-09-28 09:36:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
global-install.js
606 B
lrw-r--r--
2021-09-28 09:36:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
global-link.js
242 B
lrw-r--r--
2021-09-28 09:36:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
install.js
298 B
lrw-r--r--
2021-09-28 09:36:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
move.js
3.16 KB
lrw-r--r--
2021-09-28 09:36:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
postinstall.js
306 B
lrw-r--r--
2021-09-28 09:36:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
preinstall.js
305 B
lrw-r--r--
2021-09-28 09:36:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
prepublish.js
305 B
lrw-r--r--
2021-09-28 09:36:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
remove.js
2.42 KB
lrw-r--r--
2021-09-28 09:36:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
test.js
293 B
lrw-r--r--
2021-09-28 09:36:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
update-linked.js
356 B
lrw-r--r--
2021-09-28 09:36:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).