From 18aa76f1885a44b4c34092977f5286bd133b7f1a Mon Sep 17 00:00:00 2001 From: Shahrad Rezaei Date: Sun, 2 Feb 2020 17:56:56 -0500 Subject: [PATCH 1/5] chore(git): add .gitattributes file to repository Add a .gitattributes file to the repository, to assign attributes to files and folders in the repository. This file was taken from alexkaratarakis/gitattributes@5a965d3. This specific .gitattributes file, amongst other things: - auto-detects text files and performs LF normalization - explicitly declares common files as either text and binary - explicitly declares known OS-specific files as ending with CRLF or LF - converts complex file types to text (doc, pdf, etc) before a diff - ignore the .gitignore and .gitattribute files when exporting the repo A guide on the .gitignore file's capabilities can be found on David Laing's blog, at https://bit.ly/36QX6UD As that repository is licensed under MIT, the repo's license notice was added to the top of the file as a comment. --- .gitattributes | 102 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..0eb0d4e --- /dev/null +++ b/.gitattributes @@ -0,0 +1,102 @@ +# The MIT License (MIT) +# +# Copyright (c) 2015 Alexander Karatarakis +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the righst +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +# Common settings that generally should always be used with your language specific settings + +# Auto detect text files and perform LF normalization +# https://www.davidlaing.com/2012/09/19/customise-your-gitattributes-to-become-a-git-ninja/ +* text=auto + +# +# The above will handle all files NOT found below +# + +# Documents +*.bibtex text diff=bibtex +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain +*.md text +*.tex text diff=tex +*.adoc text +*.textile text +*.mustache text +*.csv text +*.tab text +*.tsv text +*.txt text +*.sql text + +# Graphics +*.png binary +*.jpg binary +*.jpeg binary +*.gif binary +*.tif binary +*.tiff binary +*.ico binary +# SVG treated as an asset (binary) by default. +*.svg text +# If you want to treat it as binary, +# use the following line instead. +# *.svg binary +*.eps binary + +# Scripts +*.bash text eol=lf +*.fish text eol=lf +*.sh text eol=lf +# These are explicitly windows files and should use crlf +*.bat text eol=crlf +*.cmd text eol=crlf +*.ps1 text eol=crlf + +# Serialisation +*.json text +*.toml text +*.xml text +*.yaml text +*.yml text + +# Archives +*.7z binary +*.gz binary +*.tar binary +*.tgz binary +*.zip binary + +# Text files where line endings should be preserved +*.patch -text + +# +# Exclude files from exporting +# + +.gitattributes export-ignore +.gitignore export-ignore From 12756bd55a4fc20e70de0c8015e39d8ebd5c7f37 Mon Sep 17 00:00:00 2001 From: Shahrad Rezaei Date: Sun, 2 Feb 2020 21:57:26 -0500 Subject: [PATCH 2/5] chore(git): add .gitignore file to repo Add a .gitignore file, generated at www.gitignore.io. This particular gitignore prevents tracking for common files generated by: - Windows - Linux - Visual Studio Code The generated file can be viewed and modified by navigating to https://bit.ly/37SkQcr --- .gitignore | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..21ab6d9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,56 @@ +# Created by https://www.gitignore.io/api/linux,windows,visualstudiocode +# Edit at https://www.gitignore.io/?templates=linux,windows,visualstudiocode + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### VisualStudioCode ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json + +### VisualStudioCode Patch ### +# Ignore all local history of files +.history + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# End of https://www.gitignore.io/api/linux,windows,visualstudiocode From fb304bde1413f4e4b46ece469514670e2657fca6 Mon Sep 17 00:00:00 2001 From: Shahrad Rezaei Date: Tue, 4 Feb 2020 22:23:02 -0500 Subject: [PATCH 3/5] chore(hook): add pre-commit support Add support for pre-commit (www.pre-commit.com) to the project repository, to manage the project's Git hooks. With this commits, the following pre-commit hooks are introduced, from the pre-commit/pre-commit-hooks repository. - check-yaml - end-of-file-fixer - trailing-whitespace - check-case-conflict - detect-private-key - mixed-line-ending --- .pre-commit-config.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..2fca916 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,12 @@ +--- +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v2.3.0 + hooks: + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace + - id: check-case-conflict + - id: detect-private-key + - id: mixed-line-ending + args: [--fix=no] From 3014afeb7b44ff310af58de3591a69be32f15b62 Mon Sep 17 00:00:00 2001 From: Shahrad Rezaei Date: Tue, 4 Feb 2020 22:37:40 -0500 Subject: [PATCH 4/5] chore(hook): add commit message Git hook Add support for commitlint (https://commitlint.js.org) to the repository, enforcing the Conventional Commit specification for Git commit messages (https://www.conventionalcommits.org). The pre-commit repo for the hook can be found at alessandrojcm/commitlint-pre-commit-hook The Git hook must be installed before use by running the following command: pre-commit install --hook-type commit-msg --- .pre-commit-config.yaml | 7 +++++++ commitlint.config.js | 3 +++ 2 files changed, 10 insertions(+) create mode 100644 commitlint.config.js diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2fca916..ce4bdf5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,3 +10,10 @@ repos: - id: detect-private-key - id: mixed-line-ending args: [--fix=no] + + - repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook + rev: v2.2.0 + hooks: + - id: commitlint + stages: [commit-msg] + additional_dependencies: ["@commitlint/config-conventional"] diff --git a/commitlint.config.js b/commitlint.config.js new file mode 100644 index 0000000..661d895 --- /dev/null +++ b/commitlint.config.js @@ -0,0 +1,3 @@ +module.exports = { + extends: ["@commitlint/config-conventional"] +}; From a5ea2b61ed06069f7a22d3d19c0adc9afb14e24d Mon Sep 17 00:00:00 2001 From: Shahrad Rezaei Date: Fri, 14 Feb 2020 00:48:20 -0500 Subject: [PATCH 5/5] chore(hook): add Prettier support Add a Git hook to run Prettier, an opiniated code formatter, to re-format staged files at commit time, standardizing formatting across files and repositories. Details about Prettier can be found at https://prettier.io/ Details about Prettier with pre-commit hooks can be found at https://bit.ly/38qPdGZ --- .pre-commit-config.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ce4bdf5..580f731 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,3 +17,9 @@ repos: - id: commitlint stages: [commit-msg] additional_dependencies: ["@commitlint/config-conventional"] + + - repo: https://github.com/prettier/prettier + rev: 1.19.1 + hooks: + - id: prettier + name: Prettier