|
| 1 | +#/ |
| 2 | +# @license Apache-2.0 |
| 3 | +# |
| 4 | +# Copyright (c) 2023 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 path to the [commitlint][1] executable. |
| 22 | +# |
| 23 | +# To install commitlint: |
| 24 | +# |
| 25 | +# ```bash |
| 26 | +# $ npm install commitlint |
| 27 | +# ``` |
| 28 | +# |
| 29 | +# [1]: https://github.com/conventional-changelog/commitlint |
| 30 | +COMMITLINT ?= $(BIN_DIR)/commitlint |
| 31 | + |
| 32 | +# Define the command-line options to be used when invoking the executable: |
| 33 | +COMMITLINT_FLAGS ?= \ |
| 34 | + --cwd "$(ROOT_DIR)" \ |
| 35 | + --config "$(CONFIG_DIR)/commitlint/.commitlintrc.js" \ |
| 36 | + --edit |
| 37 | + |
| 38 | + |
| 39 | +# RULES # |
| 40 | + |
| 41 | +#/ |
| 42 | +# Lints a commit message. |
| 43 | +# |
| 44 | +# ## Notes |
| 45 | +# |
| 46 | +# - We have to temporarily move the `tsconfig` file, as `commitlint` (erroneously) attempts to use the file for compiling TypeScript. |
| 47 | +# |
| 48 | +# @private |
| 49 | +# |
| 50 | +# @example |
| 51 | +# make commitlint |
| 52 | +#/ |
| 53 | +commitlint: $(NODE_MODULES) |
| 54 | + $(QUIET) mv $(ROOT_DIR)/tsconfig.json $(ROOT_DIR)/tsconfig.json.tmp |
| 55 | + $(QUIET) NODE_PATH="$(NODE_PATH)" $(NODE) "$(COMMITLINT)" $(COMMITLINT_FLAGS) || (mv $(ROOT_DIR)/tsconfig.json.tmp $(ROOT_DIR)/tsconfig.json && exit 1) |
| 56 | + $(QUIET) mv $(ROOT_DIR)/tsconfig.json.tmp $(ROOT_DIR)/tsconfig.json |
| 57 | + |
| 58 | +.PHONY: commitlint |
0 commit comments