|
| 1 | +#/ |
| 2 | +# @license Apache-2.0 |
| 3 | +# |
| 4 | +# Copyright (c) 2018 The Stdlib Authors. |
| 5 | +# |
| 6 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | +# you may not use this file except in compliance with the License. |
| 8 | +# You may obtain a copy of the License at |
| 9 | +# |
| 10 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +# |
| 12 | +# Unless required by applicable law or agreed to in writing, software |
| 13 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | +# See the License for the specific language governing permissions and |
| 16 | +# limitations under the License. |
| 17 | +#/ |
| 18 | + |
| 19 | +# VARIABLES # |
| 20 | + |
| 21 | +# Define the directory path where the package should be installed: |
| 22 | +TEST_NPM_INSTALL_DIR ?= $(BUILD_DIR)/test-npm-install |
| 23 | + |
| 24 | +# Define the package to be test: |
| 25 | +TEST_NPM_INSTALL_PKG ?= $(shell $(PROJECT_NAME)) |
| 26 | + |
| 27 | +# Define the package version to install: |
| 28 | +TEST_NPM_INSTALL_VERSION ?= latest |
| 29 | + |
| 30 | + |
| 31 | +# RULES # |
| 32 | + |
| 33 | +#/ |
| 34 | +# Tests whether a package can be successfully installed via `npm install`. |
| 35 | +# |
| 36 | +# @example |
| 37 | +# make test-npm-install |
| 38 | +#/ |
| 39 | +test-npm-install: clean-test-npm-install |
| 40 | + $(QUIET) $(MKDIR_RECURSIVE) $(TEST_NPM_INSTALL_DIR) && \ |
| 41 | + cd $(TEST_NPM_INSTALL_DIR) && \ |
| 42 | + echo '{"name":"test-npm-install","version":"0.0.0","private":true}' > $(TEST_NPM_INSTALL_DIR)/package.json && \ |
| 43 | + $(NPM) install "$(TEST_NPM_INSTALL_PKG)@$(TEST_NPM_INSTALL_VERSION)" |
| 44 | + |
| 45 | +.PHONY: test-npm-install |
| 46 | + |
| 47 | +#/ |
| 48 | +# Removes the test installation. |
| 49 | +# |
| 50 | +# @example |
| 51 | +# make clean-test-npm-install |
| 52 | +#/ |
| 53 | +clean-test-npm-install: |
| 54 | + $(QUIET) $(DELETE) $(DELETE_FLAGS) $(TEST_NPM_INSTALL_DIR) |
| 55 | + |
| 56 | +.PHONY: clean-test-npm-install |
0 commit comments