Skip to content

Commit 98ce9ce

Browse files
committed
docs: reminder about escaping special symbols in .vuh files
1 parent 3abf181 commit 98ce9ce

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,8 @@ List of basic .vuh config variables for your project:
237237
|---------------------------------------|:----------------------:|:---------------:|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------|
238238
| MAIN_BRANCH_NAME | 0.1.0 | Yes | The name of the main project's branch. | 'main' or 'master' |
239239
| VERSION_FILE | 0.1.0 | Yes | File which contains version information. | 'package.json' <br/> (for node.js application) |
240-
| TEXT_BEFORE_VERSION_CODE | 0.1.0 | Yes | Unique text which will be just before version number including spaces. | '"version": "' <br/> (for variable "version" in json files so it can find line "version": "version_number") |
241-
| TEXT_AFTER_VERSION_CODE | 0.1.0 | Yes | Unique text which will be just after version number including spaces. | '",' <br/> (for variable "version" in json files so it can find line "version": "version_number") |
240+
| TEXT_BEFORE_VERSION_CODE | 0.1.0 | Yes | Unique text which will be just before version number including spaces. All special symbols ('/', '\\', '^', '$', '*', '(', ')', '{', '}', '[', ']') should be escaped with '\\'. | '"version": "' <br/> (for variable "version" in json files so it can find line "version": "version_number") |
241+
| TEXT_AFTER_VERSION_CODE | 0.1.0 | Yes | Unique text which will be just after version number including spaces. All special symbols ('/', '\\', '^', '$', '*', '(', ')', '{', '}', '[', ']') should be escaped with '\\'. | '",' <br/> (for variable "version" in json files so it can find line "version": "version_number") |
242242
| MODULE_ROOT_PATH | 2.2.0 | No | Root path of the project code directory relative to the repository root (this variable can be used in git diff if IS_INCREMENT_REQUIRED_ONLY_ON_CHANGES equals 'true'). | 'src' (for src directory in the repository root) |
243243
| IS_INCREMENT_REQUIRED_ONLY_ON_CHANGES | 2.2.0 | No | If this variable set to 'true' and current branch has no difference with HEAD..origin/MAIN_BRANCH_NAME, vuh will not modify your current version if your current version is the same as main version. If this variable is 'false' (which is by default) vuh will suggest you to increase your current version. | 'true' or 'false' ('false' by default) |
244244
| \<VERSION_PART>_CHANGING_LOCATIONS | 2.3.0 | No | If there are changes between HEAD..origin/MAIN_BRANCH_NAME and current branch in this files or directories, <VERSION_PART> version should be increased. Works only if you checking git diff (you configured your .vuh config such way or you using --check-git-diff parameter). Locations should be separated with spaces. Empty variable means there is no locations which leads to <VERSION_PART> increasing on every change in them. | 'openapi/schema.yaml very/important/directory' <br/> (for 'openapi/schema.yaml' and 'very/important/directory') |
@@ -253,9 +253,9 @@ List of all config variables for monorepos:
253253
|-------------------------------------------------|:----------------------:|:---------------:|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------|
254254
| PROJECT_MODULES | 2.0.0 | No | List of all modules in your mono repository that will have different versioning mechanisms. <br/>You can leave this variable empty if your repository contains only one project. <br/>For each specified module you should specify configuration for this module down below. | 'BACKEND,FRONTEND' (for mono repository with two modules: BACKEND and FRONTEND) |
255255
| \<MODULE>_MAIN_BRANCH_NAME | 2.0.0 | No | The name of the main project's branch (for specific \<MODULE>). By default this value will be equal to MAIN_BRANCH_NAME variable. | 'main' or 'master' |
256-
| \<MODULE>_VERSION_FILE | 2.0.0 | No | File which contains version information (for specific \<MODULE>). | 'package.json' <br/> (for node.js application) |
257-
| \<MODULE>_TEXT_BEFORE_VERSION_CODE | 2.0.0 | No | Unique text which will be just before version number including spaces (for specific \<MODULE>). | '"version": "' <br/> (for variable "version" in json files so it can find line "version": "version_number") |
258-
| \<MODULE>_TEXT_AFTER_VERSION_CODE | 2.0.0 | No | Unique text which will be just after version number including spaces (for specific \<MODULE>). | '",' <br/> (for variable "version" in json files so it can find line "version": "version_number") |
256+
| \<MODULE>_VERSION_FILE | 2.0.0 | Yes | File which contains version information (for specific \<MODULE>). | 'package.json' <br/> (for node.js application) |
257+
| \<MODULE>_TEXT_BEFORE_VERSION_CODE | 2.0.0 | Yes | Unique text which will be just before version number including spaces (for specific \<MODULE>). All special symbols ('/', '\\', '^', '$', '*', '(', ')', '{', '}', '[', ']') should be escaped with '\\'. | '"version": "' <br/> (for variable "version" in json files so it can find line "version": "version_number") |
258+
| \<MODULE>_TEXT_AFTER_VERSION_CODE | 2.0.0 | Yes | Unique text which will be just after version number including spaces (for specific \<MODULE>). All special symbols ('/', '\\', '^', '$', '*', '(', ')', '{', '}', '[', ']') should be escaped with '\\'. | '",' <br/> (for variable "version" in json files so it can find line "version": "version_number") |
259259
| \<MODULE>_MODULE_ROOT_PATH | 2.0.0 | No | Root path of the project module code directory relative to the repository root (this variable can be used in git diff if \<MODULE>_IS_INCREMENT_REQUIRED_ONLY_ON_CHANGES equals 'true'). | 'frontend' (for frontend directory in the repository root) |
260260
| \<MODULE>_IS_INCREMENT_REQUIRED_ONLY_ON_CHANGES | 2.2.0 | No | If this variable set to 'true' and current branch has no difference with HEAD..origin/\<MODULE>_MAIN_BRANCH_NAME, vuh will not modify your current version if your current version is the same as main version. If this variable is 'false' (which is by default) vuh will suggest you to increase your current version. | 'true' or 'false' ('false' by default) |
261261
| \<MODULE>_<VERSION_PART>_CHANGING_LOCATIONS | 2.3.0 | No | If there are changes between HEAD..origin/\<MODULE>MAIN_BRANCH_NAME and current branch in this files or directories, <VERSION_PART> version should be increased. Works only if you checking git diff (you configured your .vuh config such way for this \<MODULE> or you using --check-git-diff parameter). Locations should be separated with spaces. Empty variable means there is no locations which leads to <VERSION_PART> increasing on every change in them. | 'openapi/schema.yaml very/important/directory' <br/> (for 'openapi/schema.yaml' and 'very/important/directory') |

vuh.sh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@
162162
# Written by Shishkin Sergey <[email protected]>
163163

164164
# Current vuh version
165-
VUH_VERSION='2.9.2'
165+
VUH_VERSION='2.9.3'
166166

167167
# Installation variables (Please don't modify!)
168168
DATA_DIR='<should_be_replace_after_installation:DATA_DIR>'
@@ -256,10 +256,13 @@ function _show_try_grep_command_message() {
256256
grep_text_before_cmd='grep -E "$'"$module_name_prefix"'TEXT_BEFORE_VERSION_CODE"'
257257
# shellcheck disable=SC2016
258258
grep_text_after_cmd='grep -E "$'"$module_name_prefix"'TEXT_AFTER_VERSION_CODE"'
259-
check_line_command="$cat_version_file_cmd | $grep_text_before_cmd | $grep_text_after_cmd"
260-
make_sure_message="Run command '$check_line_command' and make sure that first output line contains your version. "\
261-
'\nTip: If you are struggling to grep the only one line with needed version, you can add comment on that line.'
262-
_show_error_message "$make_sure_message"
259+
check_line_command="source .vuh; $cat_version_file_cmd | $grep_text_before_cmd | $grep_text_after_cmd"
260+
make_sure_message_1="Run command '$check_line_command' and make sure that first output line contains your version. "
261+
special_symbols="'/', '\', '^', '$', '*', '(', ')', '{', '}', '[', ']'"
262+
grep_vars="$module_name_prefix"'TEXT_BEFORE_VERSION_CODE and '"$module_name_prefix"'TEXT_AFTER_VERSION_CODE variables'
263+
make_sure_message_2="Also make sure you escaped all special symbols ($special_symbols) with '\' symbol in $grep_vars."
264+
tip_message="If you are struggling to grep the only one line with needed version, you can add comment on that line."
265+
_show_error_message "$make_sure_message_1 \n$make_sure_message_2 \nTip: $tip_message"
263266
}
264267

265268
function _show_git_diff_result() {

0 commit comments

Comments
 (0)