-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request all dependency package owners to add .npmignore #71
Comments
All modules that has a real size > 1mb... where
Python script used: #!/usr/bin/env python
import json
import os
from operator import itemgetter
ROOT_DIR = '<absolute-path-of-ultimate-seed-root-dir>'
DATA = []
def get_dir_size(dir):
dir_size = 0
for (path, dirs, files) in os.walk(dir):
for file in files:
filename = os.path.join(path, file)
dir_size += os.path.getsize(filename)
return dir_size / 1024.0 / 1024.0
for root, dirnames, filenames in os.walk(ROOT_DIR):
if not root.endswith('node_modules'): continue
for dirname in dirnames:
module_name = dirname
module_path = os.path.join(root, dirname)
pkg_json_path = os.path.join(module_path, 'package.json')
if dirname == '.bin': continue
if not os.path.isfile(pkg_json_path): continue
module_size = get_dir_size(module_path)
submodules_size = get_dir_size(os.path.join(module_path, 'node_modules'))
real_size = module_size - submodules_size
pkg_json_file = open(pkg_json_path)
pkg_json = json.load(pkg_json_file)
pkg_json_file.close()
if 'version' not in pkg_json: continue
module_version = pkg_json['version']
DATA.append((real_size, module_size, module_name, module_version, module_path))
print '| Real Size (MB) | Size (MB) | Name | Version | Path |'
print '| --------- | ---- | ---- | ------- | ---- |'
for row in sorted(DATA, key=itemgetter(0), reverse=True):
print '| ',
print row[0], ' | ',
print row[1], ' | ',
print row[2], ' | ',
print row[3], ' | ',
print row[4].replace(ROOT_DIR + '/', ''),
print '|' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's taking too long to install all dependencies. It appears that most of dependency packages do not contain
.npmignore
orfiles
specified inpackage.json
to cherry pick what files gets blacklisted or whitelisted in the published npm packages. It will be nice if we inform each one of them about this technique and reduce the overall size and time to install all dependencies.The text was updated successfully, but these errors were encountered: