Don't run npm shrinkwrap if using yarn

If we're using yarn, it means we started from a yarn.lock file in the
first place. If that's true, we don't need to *produce* a shrinkwrap
file.

Needed-By: I848f22dce6196b2df9de4b9f585e857e03cdb0d7
Change-Id: I6519ff5ea7ac4b79e46f29c6190d660718d03f1b
This commit is contained in:
Monty Taylor 2017-12-15 19:25:08 -06:00
parent 96006880a7
commit 8a86f7c7fc
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594
1 changed files with 16 additions and 3 deletions

View File

@ -14,13 +14,21 @@
state: directory
delegate_to: localhost
- name: Check for yarn.lock
stat:
path: "{{ zuul_work_dir }}/yarn.lock"
register: yarn_lock
- name: Check for shrinkwrap
stat:
path: "{{ zuul_work_dir }}/npm-shrinkwrap.json"
when: not yarn_lock.stat.exists
register: shrinkwrap
- name: Run npm prune because of https://github.com/npm/npm/issues/6298
when: not shrinkwrap.stat.exists
when:
- not yarn_lock.stat.exists
- not shrinkwrap.stat.exists
command: npm prune
environment:
DISPLAY: ':99'
@ -28,7 +36,9 @@
chdir: "{{ zuul_work_dir }}"
- name: Run npm shrinkwrap
when: not shrinkwrap.stat.exists
when:
- not yarn_lock.stat.exists
- not shrinkwrap.stat.exists
command: npm shrinkwrap
environment:
DISPLAY: ':99'
@ -62,6 +72,7 @@
when: karma_stat.stat.exists
- name: Check again for shrinkwrap
when: not yarn_lock.stat.exists
stat:
path: "{{ zuul_work_dir }}/npm-shrinkwrap.json"
register: shrinkwrap_final
@ -72,4 +83,6 @@
mode: pull
src: "{{ zuul_work_dir }}/npm-shrinkwrap.json"
verify_host: true
when: shrinkwrap_final.stat.exists
when:
- not yarn_lock.stat.exists
- shrinkwrap_final.stat.exists