* Create rush-prettier autoinstaller

* Update the hook script to use rush command

* do not restage formatted files

* update .prettierignore to work with pretty-quick
This commit is contained in:
Deyaaeldeen Almahallawi 2020-09-10 08:32:45 -04:00 коммит произвёл GitHub
Родитель 1a2c47d267
Коммит e1b81abaf0
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 359 добавлений и 14 удалений

Просмотреть файл

@ -1,5 +1,5 @@
src/generated/
review/*.api.md
*.yml
*.yaml
*.d.ts
**/src/generated/
**/review/*.api.md
**/*.yml
**/*.yaml
**/*.d.ts

Просмотреть файл

@ -0,0 +1,9 @@
{
"name": "rush-prettier",
"version": "1.0.0",
"private": true,
"dependencies": {
"prettier": "^1.16.4",
"pretty-quick": "^3.0.0"
}
}

Просмотреть файл

@ -0,0 +1,330 @@
dependencies:
prettier: 1.19.1
pretty-quick: 3.0.0_prettier@1.19.1
lockfileVersion: 5.1
packages:
/@types/color-name/1.1.1:
dev: false
resolution:
integrity: sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==
/@types/minimatch/3.0.3:
dev: false
resolution:
integrity: sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==
/ansi-styles/4.2.1:
dependencies:
'@types/color-name': 1.1.1
color-convert: 2.0.1
dev: false
engines:
node: '>=8'
resolution:
integrity: sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==
/array-differ/3.0.0:
dev: false
engines:
node: '>=8'
resolution:
integrity: sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg==
/array-union/2.1.0:
dev: false
engines:
node: '>=8'
resolution:
integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==
/arrify/2.0.1:
dev: false
engines:
node: '>=8'
resolution:
integrity: sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==
/balanced-match/1.0.0:
dev: false
resolution:
integrity: sha1-ibTRmasr7kneFk6gK4nORi1xt2c=
/brace-expansion/1.1.11:
dependencies:
balanced-match: 1.0.0
concat-map: 0.0.1
dev: false
resolution:
integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==
/chalk/3.0.0:
dependencies:
ansi-styles: 4.2.1
supports-color: 7.1.0
dev: false
engines:
node: '>=8'
resolution:
integrity: sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==
/color-convert/2.0.1:
dependencies:
color-name: 1.1.4
dev: false
engines:
node: '>=7.0.0'
resolution:
integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==
/color-name/1.1.4:
dev: false
resolution:
integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
/concat-map/0.0.1:
dev: false
resolution:
integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=
/cross-spawn/7.0.3:
dependencies:
path-key: 3.1.1
shebang-command: 2.0.0
which: 2.0.2
dev: false
engines:
node: '>= 8'
resolution:
integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==
/end-of-stream/1.4.4:
dependencies:
once: 1.4.0
dev: false
resolution:
integrity: sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==
/execa/4.0.3:
dependencies:
cross-spawn: 7.0.3
get-stream: 5.2.0
human-signals: 1.1.1
is-stream: 2.0.0
merge-stream: 2.0.0
npm-run-path: 4.0.1
onetime: 5.1.2
signal-exit: 3.0.3
strip-final-newline: 2.0.0
dev: false
engines:
node: '>=10'
resolution:
integrity: sha512-WFDXGHckXPWZX19t1kCsXzOpqX9LWYNqn4C+HqZlk/V0imTkzJZqf87ZBhvpHaftERYknpk0fjSylnXVlVgI0A==
/find-up/4.1.0:
dependencies:
locate-path: 5.0.0
path-exists: 4.0.0
dev: false
engines:
node: '>=8'
resolution:
integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==
/get-stream/5.2.0:
dependencies:
pump: 3.0.0
dev: false
engines:
node: '>=8'
resolution:
integrity: sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==
/has-flag/4.0.0:
dev: false
engines:
node: '>=8'
resolution:
integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==
/human-signals/1.1.1:
dev: false
engines:
node: '>=8.12.0'
resolution:
integrity: sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==
/ignore/5.1.8:
dev: false
engines:
node: '>= 4'
resolution:
integrity: sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==
/is-stream/2.0.0:
dev: false
engines:
node: '>=8'
resolution:
integrity: sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==
/isexe/2.0.0:
dev: false
resolution:
integrity: sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=
/locate-path/5.0.0:
dependencies:
p-locate: 4.1.0
dev: false
engines:
node: '>=8'
resolution:
integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==
/merge-stream/2.0.0:
dev: false
resolution:
integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==
/mimic-fn/2.1.0:
dev: false
engines:
node: '>=6'
resolution:
integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==
/minimatch/3.0.4:
dependencies:
brace-expansion: 1.1.11
dev: false
resolution:
integrity: sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==
/mri/1.1.6:
dev: false
engines:
node: '>=4'
resolution:
integrity: sha512-oi1b3MfbyGa7FJMP9GmLTttni5JoICpYBRlq+x5V16fZbLsnL9N3wFqqIm/nIG43FjUFkFh9Epzp/kzUGUnJxQ==
/multimatch/4.0.0:
dependencies:
'@types/minimatch': 3.0.3
array-differ: 3.0.0
array-union: 2.1.0
arrify: 2.0.1
minimatch: 3.0.4
dev: false
engines:
node: '>=8'
resolution:
integrity: sha512-lDmx79y1z6i7RNx0ZGCPq1bzJ6ZoDDKbvh7jxr9SJcWLkShMzXrHbYVpTdnhNM5MXpDUxCQ4DgqVttVXlBgiBQ==
/npm-run-path/4.0.1:
dependencies:
path-key: 3.1.1
dev: false
engines:
node: '>=8'
resolution:
integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==
/once/1.4.0:
dependencies:
wrappy: 1.0.2
dev: false
resolution:
integrity: sha1-WDsap3WWHUsROsF9nFC6753Xa9E=
/onetime/5.1.2:
dependencies:
mimic-fn: 2.1.0
dev: false
engines:
node: '>=6'
resolution:
integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==
/p-limit/2.3.0:
dependencies:
p-try: 2.2.0
dev: false
engines:
node: '>=6'
resolution:
integrity: sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==
/p-locate/4.1.0:
dependencies:
p-limit: 2.3.0
dev: false
engines:
node: '>=8'
resolution:
integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==
/p-try/2.2.0:
dev: false
engines:
node: '>=6'
resolution:
integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==
/path-exists/4.0.0:
dev: false
engines:
node: '>=8'
resolution:
integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==
/path-key/3.1.1:
dev: false
engines:
node: '>=8'
resolution:
integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==
/prettier/1.19.1:
dev: false
engines:
node: '>=4'
hasBin: true
resolution:
integrity: sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==
/pretty-quick/3.0.0_prettier@1.19.1:
dependencies:
chalk: 3.0.0
execa: 4.0.3
find-up: 4.1.0
ignore: 5.1.8
mri: 1.1.6
multimatch: 4.0.0
prettier: 1.19.1
dev: false
engines:
node: '>=10.13'
hasBin: true
peerDependencies:
prettier: '>=2.0.0'
resolution:
integrity: sha512-oIXlGQUcUxt3XpoNfQECEWvH1Q9PtKfelF2pdp6UvC1CSQ5QcB7gUYKu0kuJGlm3LMBZzJaO/vbRkxA61pWlcg==
/pump/3.0.0:
dependencies:
end-of-stream: 1.4.4
once: 1.4.0
dev: false
resolution:
integrity: sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==
/shebang-command/2.0.0:
dependencies:
shebang-regex: 3.0.0
dev: false
engines:
node: '>=8'
resolution:
integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==
/shebang-regex/3.0.0:
dev: false
engines:
node: '>=8'
resolution:
integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==
/signal-exit/3.0.3:
dev: false
resolution:
integrity: sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==
/strip-final-newline/2.0.0:
dev: false
engines:
node: '>=6'
resolution:
integrity: sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==
/supports-color/7.1.0:
dependencies:
has-flag: 4.0.0
dev: false
engines:
node: '>=8'
resolution:
integrity: sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==
/which/2.0.2:
dependencies:
isexe: 2.0.0
dev: false
engines:
node: '>= 8'
hasBin: true
resolution:
integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==
/wrappy/1.0.2:
dev: false
resolution:
integrity: sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=
specifiers:
prettier: ^1.16.4
pretty-quick: ^3.0.0

Просмотреть файл

@ -199,6 +199,16 @@
"summary": "Unlink dependencies and purge downloaded node_modules",
"safeForSimultaneousRushProcesses": true,
"shellCommand": "rush unlink && rush purge"
},
{
"name": "prettier",
"commandKind": "global",
"summary": "Used by the pre-commit Git hook. This command invokes Prettier to reformat staged changes.",
"autoinstallerName": "rush-prettier",
// This will invoke common/autoinstallers/rush-prettier/node_modules/.bin/pretty-quick
"shellCommand": "pretty-quick --staged --no-restage"
}
],

Просмотреть файл

@ -15,8 +15,7 @@
* When someone asks for "^1.0.0" make sure they get "1.2.3" when working in this repo,
* instead of the latest version.
*/
"prettier": "^1.16.4",
"precise-commits": "^1.0.2"
// "some-library": "1.2.3"
},
/**
* When set to true, for all projects in the repo, all dependencies will be automatically added as preferredVersions,

Просмотреть файл

@ -3,7 +3,9 @@
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
COMMAND=common/temp/node_modules/.bin/precise-commits
# Invoke the "rush prettier" custom command to reformat files whenever they
# are committed. The command is defined in common/config/rush/command-line.json
# and uses the "rush-prettier" autoinstaller.
echo --------------------------------------------
echo Starting Git hook: pre-commit
@ -15,12 +17,7 @@ if [ ! -z ${MERGE} ]; then
exit
fi
if [ -f $COMMAND ]; then
echo Invoking $COMMAND
$COMMAND
else
echo Command not installed: $COMMAND
fi
node common/scripts/install-run-rush.js prettier || exit $?
echo Finished Git hook: pre-commit
echo --------------------------------------------