| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 | 2 |
| 3 # This Source Code Form is subject to the terms of the Mozilla Public | 3 # This Source Code Form is subject to the terms of the Mozilla Public |
| 4 # License, v. 2.0. If a copy of the MPL was not distributed with this | 4 # License, v. 2.0. If a copy of the MPL was not distributed with this |
| 5 # file, You can obtain one at http://mozilla.org/MPL/2.0/. | 5 # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 6 | 6 |
| 7 import sys | 7 import sys |
| 8 import os | 8 import os |
| 9 import posixpath | 9 import posixpath |
| 10 import re | 10 import re |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 return | 271 return |
| 272 except IOError: | 272 except IOError: |
| 273 return | 273 return |
| 274 | 274 |
| 275 try: | 275 try: |
| 276 # Create an empty file, which gets deleted after successfully | 276 # Create an empty file, which gets deleted after successfully |
| 277 # installing Node.js dependencies. | 277 # installing Node.js dependencies. |
| 278 lockfile_path = os.path.join(target, NPM_LOCKFILE) | 278 lockfile_path = os.path.join(target, NPM_LOCKFILE) |
| 279 open(lockfile_path, 'a').close() | 279 open(lockfile_path, 'a').close() |
| 280 | 280 |
| 281 cmd = ['npm', 'install', '--only=production', | 281 cmd = ['npm', 'install', '--only=production', '--loglevel=warn', |
| 282 '--loglevel=warn', '--no-package-lock'] | 282 '--no-package-lock', '--no-optional'] |
| 283 subprocess.check_output(cmd, cwd=target) | 283 subprocess.check_output(cmd, cwd=target) |
| 284 | 284 |
| 285 repo_types[vcs].ignore(os.path.join(target, NPM_LOCKFILE), target) | 285 repo_types[vcs].ignore(os.path.join(target, NPM_LOCKFILE), target) |
| 286 repo_types[vcs].ignore(os.path.join(target, 'node_modules'), target) | 286 repo_types[vcs].ignore(os.path.join(target, 'node_modules'), target) |
| 287 | 287 |
| 288 os.remove(lockfile_path) | 288 os.remove(lockfile_path) |
| 289 except OSError as e: | 289 except OSError as e: |
| 290 import errno | 290 import errno |
| 291 if e.errno == errno.ENOENT: | 291 if e.errno == errno.ENOENT: |
| 292 logging.error('Failed to install Node.js dependencies for %s,' | 292 logging.error('Failed to install Node.js dependencies for %s,' |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 args = parser.parse_args() | 429 args = parser.parse_args() |
| 430 | 430 |
| 431 if args.quiet: | 431 if args.quiet: |
| 432 logging.disable(logging.INFO) | 432 logging.disable(logging.INFO) |
| 433 | 433 |
| 434 repos = args.repos | 434 repos = args.repos |
| 435 if not len(repos): | 435 if not len(repos): |
| 436 repos = [os.path.dirname(__file__)] | 436 repos = [os.path.dirname(__file__)] |
| 437 for repo in repos: | 437 for repo in repos: |
| 438 resolve_deps(repo) | 438 resolve_deps(repo) |
| OLD | NEW |