MCPcopy Index your code
hub / github.com/nodejs/node / package_files

Function package_files

tools/install.py:90–114  ·  view source on GitHub ↗
(options, action, name, bins)

Source from the content-addressed store, hash-verified

88 try_remove(options, path, dest)
89
90def package_files(options, action, name, bins):
91 target_path = os.path.join('lib/node_modules', name)
92
93 # don't install npm if the target path is a symlink, it probably means
94 # that a dev version of npm is installed there
95 if os.path.islink(abspath(options.install_path, target_path)): return
96
97 # npm has a *lot* of files and it'd be a pain to maintain a fixed list here
98 # so we walk its source directory instead...
99 root = os.path.join('deps', name)
100 for dirname, subdirs, basenames in os.walk(root, topdown=True):
101 subdirs[:] = [subdir for subdir in subdirs if subdir != 'test']
102 paths = [os.path.join(dirname, basename) for basename in basenames]
103 action(options, paths,
104 os.path.join(target_path, dirname[len(root) + 1:]) + os.path.sep)
105
106 # create/remove symlinks
107 for bin_name, bin_target in bins.items():
108 link_path = abspath(options.install_path, os.path.join('bin', bin_name))
109 if action == uninstall:
110 action(options, [link_path], os.path.join('bin', bin_name))
111 elif action == install:
112 try_symlink(options, os.path.join('../lib/node_modules', name, bin_target), link_path)
113 else:
114 assert 0 # unhandled action type
115
116def npm_files(options, action):
117 package_files(options, action, 'npm', {

Callers 2

npm_filesFunction · 0.85
corepack_filesFunction · 0.85

Calls 6

abspathFunction · 0.85
actionFunction · 0.85
try_symlinkFunction · 0.85
walkMethod · 0.80
joinMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…