Skip to content

Commit

Permalink
Fix the npm/yarn install for mac users
Browse files Browse the repository at this point in the history
  • Loading branch information
qboot committed Jun 15, 2022
1 parent 4ab7c4e commit 7fab0af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

* Add documentation cookbook for using pg_activity
* Forward CI env vars in Docker containers
* Run the npm/yarn/webpack commands on the host for all mac users (even the ones not using Dinghy)

## 3.7.0 (2022-05-24)

Expand Down
9 changes: 5 additions & 4 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from distutils.spawn import find_executable
import json
import os
import platform
import re
import requests
import subprocess
Expand Down Expand Up @@ -68,9 +69,9 @@ def install(c):
if os.path.isfile(c.root_dir + '/' + c.project_directory + '/composer.json'):
docker_compose_run(c, 'composer install -n --prefer-dist --optimize-autoloader', no_deps=True)
if os.path.isfile(c.root_dir + '/' + c.project_directory + '/yarn.lock'):
run_in_docker_or_locally_for_dinghy(c, 'yarn', no_deps=True)
run_in_docker_or_locally_for_mac(c, 'yarn', no_deps=True)
elif os.path.isfile(c.root_dir + '/' + c.project_directory + '/package.json'):
run_in_docker_or_locally_for_dinghy(c, 'npm install', no_deps=True)
run_in_docker_or_locally_for_mac(c, 'npm install', no_deps=True)


@task
Expand Down Expand Up @@ -244,11 +245,11 @@ def generate_certificates(c, force=False):
print('Please restart the infrastructure to use the new certificates with "inv up" or "inv start".')


def run_in_docker_or_locally_for_dinghy(c, command, no_deps=False):
def run_in_docker_or_locally_for_mac(c, command, no_deps=False):
"""
Mac users have a lot of problems running Yarn / Webpack on the Docker stack so this func allow them to run these tools on their host
"""
if c.dinghy:
if c.dinghy or 'Darwin' == platform.system():
with c.cd(c.project_directory):
c.run(command)
else:
Expand Down

0 comments on commit 7fab0af

Please sign in to comment.