These tools are mainly to support CI and testing.
These are supposed to be run as one-off jobs, and can be called from the git-hooks.
file_extension_to_lowercase: Convert all file extensions in the specified folder from uppercase to lowercase (e.g.file.FBXwill be converted tofile.fbxas well as its meta file)- Prerequisites: Python installed and accessible from the
PATH - Usage:
python ./file_extension_to_lowercase [list of folders to convert]
- Prerequisites: Python installed and accessible from the
The folder Tools/git-hook contains git hooks for the Graphics repository.
Prerequisites:
- NodeJS >= 10 is installed and present in your PATH.
- Python >= 3.5 is installed and present in your PATH.
Steps:
- At the root of the repo, open a shell and run :
cd Tools
npm install
This will add the hooks to your .git/hooks folder.
- Verify that the installation logs look good in the terminal (no error).
Troubleshooting:
After trying the solutions below, you may want to run npm install again in the Tools folder.
-
Cannot read property 'toString' of null ; husky > Failed to install:
gitis probably not accessible from yourPATHvariable. You'll have to locate thegitexecutable on your filesystem and add it to thePATHenvironment variable.
-
Husky requires Node 10:
- Your version of NodeJS is outdated (We need at least version 10). You can update it here. Make sure NodeJS is updated, not only npm.
-
Hook already exists: [hook title]:
- If you attempted to install git lfs (
git lfs install) after installing the hooks, you may have this error. To resolve, rungit lfs update --forceand then re-do anpm installin the Tools folder.
- If you attempted to install git lfs (
check-shader-includes(pre-commit): Compare the case sensitivity of the shader includes in the code files to the actual files in the filesystem. Generate a log if it differs.check-file-name-extension(pre-commit): Make sure all files pushed have a lowercase extension so that imports are not broken on Linux.check-branch-name(pre-push): Ensure the current branch is following the convention: - All new branches enclosed in a folder (valid name:folder/my-branch) - All branches in lowercase, except for the enclosingHDRPfolder (valid names:HDRP/my-branch,something-else/my-branch)
New git hooks should be added to the ./git-hook folder. They have to be linked to husky in the package.json file.
We use the following packages to make the hooks work:
- husky - Easy access to Git hooks from Node scripts/tools.
- lint-staged - Match all staged files to further process them in the git-hooks.