|
| 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 [`commitzen`][1] executable. |
| 22 | +# |
| 23 | +# To install `commitzen`: |
| 24 | +# |
| 25 | +# ```bash |
| 26 | +# $ npm install commitzen |
| 27 | +# ``` |
| 28 | +# |
| 29 | +# [1]: https://github.com/commitizen/cz-cli |
| 30 | +COMMITIZEN ?= $(BIN_DIR)/cz |
| 31 | + |
| 32 | + |
| 33 | +# RULES # |
| 34 | + |
| 35 | +#/ |
| 36 | +# Provides an interactive prompt for entering commit message information in accordance with project Git commit conventions. |
| 37 | +# |
| 38 | +# ## Notes |
| 39 | +# |
| 40 | +# - We have to temporarily move the `tsconfig` file, as `commitlint` (erroneously) attempts to use the file for compiling TypeScript. |
| 41 | +# |
| 42 | +# @private |
| 43 | +# |
| 44 | +# @example |
| 45 | +# make commitizen-commit |
| 46 | +#/ |
| 47 | +commitizen-commit: $(NODE_MODULES) $(COMMITIZEN) |
| 48 | + $(QUIET) mv $(ROOT_DIR)/tsconfig.json $(ROOT_DIR)/tsconfig.json.tmp |
| 49 | + $(QUIET) NODE_PATH="$(NODE_PATH)" $(NODE) "$(COMMITIZEN)" || (mv $(ROOT_DIR)/tsconfig.json.tmp $(ROOT_DIR)/tsconfig.json && exit 1) |
| 50 | + $(QUIET) mv $(ROOT_DIR)/tsconfig.json.tmp $(ROOT_DIR)/tsconfig.json |
| 51 | + |
| 52 | +.PHONY: commitizen-commit |
| 53 | + |
| 54 | +#/ |
| 55 | +# Retries a previous commit entered using Commitizen. |
| 56 | +# |
| 57 | +# ## Notes |
| 58 | +# |
| 59 | +# - We have to temporarily move the `tsconfig` file, as `commitlint` (erroneously) attempts to use the file for compiling TypeScript. |
| 60 | +# |
| 61 | +# @private |
| 62 | +# |
| 63 | +# @example |
| 64 | +# make commitizen-retry-commit |
| 65 | +#/ |
| 66 | +commitizen-retry-commit: $(NODE_MODULES) $(COMMITIZEN) |
| 67 | + $(QUIET) mv $(ROOT_DIR)/tsconfig.json $(ROOT_DIR)/tsconfig.json.tmp |
| 68 | + $(QUIET) NODE_PATH="$(NODE_PATH)" $(NODE) "$(COMMITIZEN)" --retry || (mv $(ROOT_DIR)/tsconfig.json.tmp $(ROOT_DIR)/tsconfig.json && exit 1) |
| 69 | + $(QUIET) mv $(ROOT_DIR)/tsconfig.json.tmp $(ROOT_DIR)/tsconfig.json |
| 70 | + |
| 71 | +.PHONY: commitizen-retry-commit |
0 commit comments