Skip to content
This repository has been archived by the owner on Jun 18, 2019. It is now read-only.

Commit

Permalink
Installs node_modules as dependency if missing
Browse files Browse the repository at this point in the history
The `npm install` task takes ~23s even when no changes are required, so
let's not delay the quick test runs (e.g. 3s for `make test-unit`) with
unnecessary npm calls. Instead, we'll check for existence of the
`node_modules/` directory locally, and install the npm modules only if
it's missing. That'll still support automatic integration with the `make
clean` target for clean builds.
  • Loading branch information
Conor Schaefer committed Mar 6, 2018
1 parent 776bb40 commit 78b139a
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,14 @@ build-deb: docker-build ## Builds Sunder Debian packages for Linux
-v fpf-sunder-node:/sunder/node_modules \
sunder-build:latest

.PHONY: npm-install-init
npm-install-init: ## Installs npm modules locally only if node_modules/ absent
if [ ! -d node_modules ] ; then \
npm install ; \
fi

.PHONY: build-dmg
build-dmg: ## Builds Sunder DMG and app bundle for macOS (requires macOS)
build-dmg: npm-install-init ## Builds Sunder DMG and app bundle for macOS (requires macOS)
npm run dist

.PHONY: docker-clean
Expand All @@ -50,15 +56,15 @@ docs: docs-clean ## Runs livereload environment for local documentation editing
sphinx-autobuild docs/ docs/_build/html

.PHONY: build-app
build-app: ## Packages Electron app locally via webpack for development and testing
build-app: npm-install-init ## Packages Electron app locally via webpack for development and testing
npm run build-app

.PHONY: test-unit
test-unit: ## Runs unit tests in local dev env
test-unit: npm-install-init ## Runs unit tests in local dev env
npm run test

.PHONY: test-e2e
test-e2e: build-app ## Runs end-to-end integration tests local dev env
test-e2e: npm-install-init build-app ## Runs end-to-end integration tests local dev env
npm run test-e2e

.PHONY: test
Expand Down

0 comments on commit 78b139a

Please sign in to comment.