diff --git a/Makefile.local b/Makefile.local --- a/Makefile.local +++ b/Makefile.local @@ -1,16 +1,20 @@ TEST_DIRS := ./swh/web/tests +YARN ?= yarn + +yarn-install: package.json + $(YARN) install .PHONY: build-webpack-dev -build-webpack-dev: - yarn build-dev +build-webpack-dev: yarn-install + $(YARN) build-dev .PHONY: build-webpack-dev-no-verbose -build-webpack-dev-no-verbose: - yarn build-dev >/dev/null +build-webpack-dev-no-verbose: yarn-install + $(YARN) build-dev >/dev/null .PHONY: build-webpack-prod -build-webpack-prod: - yarn build +build-webpack-prod: yarn-install + $(YARN) build .PHONY: run-migrations run-migrations: @@ -22,8 +26,8 @@ django-admin migrate --settings=swh.web.settings.production 2>/dev/null django-admin createcachetable --settings=swh.web.settings.production 2>/dev/null -run-django-webpack-devserver: run-migrations - bash -c "trap 'trap - SIGINT SIGTERM ERR; kill %1' SIGINT SIGTERM ERR; yarn start-dev & cd swh/web && python3 manage.py runserver --nostatic" +run-django-webpack-devserver: run-migrations yarn-install + bash -c "trap 'trap - SIGINT SIGTERM ERR; kill %1' SIGINT SIGTERM ERR; $(YARN) start-dev & cd swh/web && python3 manage.py runserver --nostatic" run-django-webpack-dev: build-webpack-dev run-migrations python3 swh/web/manage.py runserver --nostatic diff --git a/README.md b/README.md --- a/README.md +++ b/README.md @@ -51,11 +51,7 @@ To compile the frontend assets, you need to have [nodejs](https://nodejs.org/en/) >= 8.x and [yarn](https://yarnpkg.com/en/) installed. If you are on Debian stretch, you can easily install an up to date nodejs from the stretch-backports repository while packages for yarn can be installed by following [these instructions](https://yarnpkg.com/en/docs/install#debian-stable). -Once you have installed nodejs, issue the following command in the root directory of swh-web in order to retrieve all the frontend dependencies: - -``` -$ yarn install -``` +Alternatively, you can install yarn with `npm install yarn`, and add `YARN=node_modules/yarn/bin/yarn` as argument whenever you run `make`. Please note that the static assets bundles generated by webpack are not stored in the git repository. Follow the instructions below in order to generate them in order to be able to run the frontend part of the web applications.