---
- name: Export body values to include in theme purging
  command: >
    {{ release_drush_path }} opdavies:export-body-values-for-theme-purging
    chdir={{ release_theme_path }}
    creates={{ release_theme_path }}/body-field-values.txt

- name: Install theme dependencies
  command: >
    npm ci
    chdir={{ release_theme_path }}
    creates={{ release_theme_path }}/node_modules

- name: Generate front-end assets
  command: >
    npm run production
    chdir={{ release_theme_path }}
    creates={{ release_theme_path }}/dist

- name: Remove files that are no longer needed
  file:
    path: "{{ release_theme_path }}/{{ item }}"
    state: absent
  with_items:
    - body-field-values.txt
    - node_modules