Skip to content

Commit

Permalink
Merge pull request #147 from galaxyproject/upgrade-node
Browse files Browse the repository at this point in the history
Support updating Node when the pinned version changes
  • Loading branch information
jdavcs committed Feb 14, 2022
2 parents 2b89a7c + bba0391 commit 03a8cdd
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions tasks/client.yml
Expand Up @@ -50,13 +50,29 @@
include_tasks: _inc_node_version.yml
when: galaxy_node_version is undefined

- name: Install node
- name: Check if node is installed
stat:
path: "{{ galaxy_venv_dir }}/bin/node"
register: __galaxy_node_is_installed

- name: Collect installed node version
command: "{{ galaxy_venv_dir }}/bin/node --version"
when: __galaxy_node_is_installed.stat.exists
changed_when: false
register: __galaxy_installed_node_version

- name: Remove node_modules directory when upgrading node
file:
path: "{{ galaxy_venv_dir }}/lib/node_modules"
state: absent
when: (not __galaxy_node_is_installed.stat.exists) or (('v' ~ galaxy_node_version) != __galaxy_installed_node_version.stdout)

- name: Install or upgrade node
command: "nodeenv -n {{ galaxy_node_version }} -p"
environment:
PATH: "{{ galaxy_venv_dir }}/bin:{{ ansible_env.PATH }}"
VIRTUAL_ENV: "{{ galaxy_venv_dir }}"
args:
creates: "{{ galaxy_venv_dir }}/bin/npm"
when: (not __galaxy_node_is_installed.stat.exists) or (('v' ~ galaxy_node_version) != __galaxy_installed_node_version.stdout)

- name: Install yarn
npm:
Expand Down

0 comments on commit 03a8cdd

Please sign in to comment.