diff --git a/tasks/packages.yml b/tasks/packages.yml index a2d3e06..8429a36 100644 --- a/tasks/packages.yml +++ b/tasks/packages.yml @@ -4,24 +4,27 @@ shell: "yarn global remove {{ item.name }}@{{ item.version | default('') }} --PREFIX={{ yarn_global_path }}" failed_when: false with_items: - - "{{ yarn_global_packages }}" + - "{{ yarn_global_packages }}" changed_when: false when: yarn_clean_install == true - name: "Yarn | Get list of globally installed packages" - shell: "yarn global ls" + shell: "yarn global list" register: yarn_global_ls failed_when: false changed_when: false - name: "Yarn | Add globally installed packages" shell: "yarn global add {{ item.name }}@{{ item.version | default('') }} --PREFIX={{ yarn_global_path }}" - when: '"{{ item.name }}@{{ item.version | default() }}" not in "{{ yarn_global_ls.stdout }}"' + when: + - item.name + '@' + item.version not in yarn_global_ls.stdout with_items: - - "{{ yarn_global_packages }}" + - "{{ yarn_global_packages }}" - name: "Yarn | Upgrade installed packages" shell: "yarn global upgrade {{ item.name }} --PREFIX={{ yarn_global_path }}" - when: '"{{ item.name }}@{{ item.version | default() }}" in "{{ yarn_global_ls.stdout }}" and "{{ item.upgrade }}" is defined and item.upgrade == true' + when: + - item.upgrade is defined + - item.upgrade|bool == true with_items: - - "{{ yarn_global_packages }}" \ No newline at end of file + - "{{ yarn_global_packages }}" \ No newline at end of file diff --git a/tasks/yarn-Darwin.yml b/tasks/yarn-Darwin.yml new file mode 100644 index 0000000..73b314f --- /dev/null +++ b/tasks/yarn-Darwin.yml @@ -0,0 +1 @@ +--- \ No newline at end of file diff --git a/tasks/yarn.yml b/tasks/yarn.yml index e91a5bd..a11f833 100644 --- a/tasks/yarn.yml +++ b/tasks/yarn.yml @@ -19,9 +19,9 @@ - 'yarn_clean_install == true' - name: "Yarn | Check for installation" - shell: yarn --help + shell: which yarn register: yarn_result - changed_when: '"Usage" not in yarn_result.stdout and "Yarn requires Node" not in yarn_result.stdout and "is not supported, please use Node.js" not in yarn_result.stdout' + changed_when: '"yarn" not in yarn_result.stdout' changed_when: false failed_when: false @@ -29,7 +29,7 @@ set_fact: yarn_install_state: true changed_when: false - when: '"Usage" in yarn_result.stdout or "Yarn requires Node" in yarn_result.stdout or "is not supported, please use Node.js" in yarn_result.stdout' + when: '"yarn" in yarn_result.stdout' - name: "Yarn | Register existing installation status" set_fact: