Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: ensure_dependencies.py

Issue 29574577: Issue 5856 - Pass --no-package-lock argument to npm install (Closed)
Patch Set: Don't ignore the package-lock.json file Created Oct. 12, 2017, 1:18 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 264
265 # In case a package.json does not exist at all or if there are no 265 # In case a package.json does not exist at all or if there are no
266 # production dependencies declared, we don't need to run npm and can 266 # production dependencies declared, we don't need to run npm and can
267 # bail out early. 267 # bail out early.
268 if not package_data.get('dependencies', False): 268 if not package_data.get('dependencies', False):
269 return 269 return
270 except IOError: 270 except IOError:
271 return 271 return
272 272
273 try: 273 try:
274 cmd = ['npm', 'install', '--only=production', '--loglevel=warn'] 274 cmd = ['npm', 'install', '--only=production',
275 '--loglevel=warn', '--no-package-lock']
275 subprocess.check_output(cmd, cwd=target) 276 subprocess.check_output(cmd, cwd=target)
276 277
277 repo_types[vcs].ignore(os.path.join(target, 'node_modules'), target) 278 repo_types[vcs].ignore(os.path.join(target, 'node_modules'), target)
278 except OSError as e: 279 except OSError as e:
279 import errno 280 import errno
280 if e.errno == errno.ENOENT: 281 if e.errno == errno.ENOENT:
281 logging.error('Failed to install Node.js dependencies for %s,' 282 logging.error('Failed to install Node.js dependencies for %s,'
282 ' please ensure Node.js is installed.', target) 283 ' please ensure Node.js is installed.', target)
283 else: 284 else:
284 raise 285 raise
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 args = parser.parse_args() 418 args = parser.parse_args()
418 419
419 if args.quiet: 420 if args.quiet:
420 logging.disable(logging.INFO) 421 logging.disable(logging.INFO)
421 422
422 repos = args.repos 423 repos = args.repos
423 if not len(repos): 424 if not len(repos):
424 repos = [os.path.dirname(__file__)] 425 repos = [os.path.dirname(__file__)]
425 for repo in repos: 426 for repo in repos:
426 resolve_deps(repo) 427 resolve_deps(repo)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld