Use husky

This commit is contained in:
Danny McCormick 2019-06-05 11:34:47 -04:00
parent d7b6952411
commit c3f0a8be66
6685 changed files with 919804 additions and 0 deletions

20
node_modules/husky/.eslintrc.js generated vendored Normal file
View file

@ -0,0 +1,20 @@
module.exports = {
"parser": "@typescript-eslint/parser",
"extends": [
"xo-space/esnext",
"plugin:@typescript-eslint/recommended",
"prettier",
"prettier/@typescript-eslint"
],
"plugins": [
"@typescript-eslint",
"prettier"
],
"rules": {
"prettier/prettier": "error"
},
"env": {
"jest": true,
"node": true,
}
}

4
node_modules/husky/.prettierrc generated vendored Normal file
View file

@ -0,0 +1,4 @@
{
"semi": false,
"singleQuote": true
}

3
node_modules/husky/BACKERS.md generated vendored Normal file
View file

@ -0,0 +1,3 @@
# Backers
[thanks.typicode.com](http://thanks.typicode.com) 🌵

276
node_modules/husky/CHANGELOG.md generated vendored Normal file
View file

@ -0,0 +1,276 @@
# CHANGELOG
## 2.3.0
* Make `HUSKY_DEBUG=1` effective like `HUSKY_DEBUG=true`
* Refactor script to point to `run-node/run-node` rather than `.bin/run-node`
## 2.2.0
* Improve Git worktree support
## 2.1.0
* Improve shell script portability by using `.` rather than `source`
## 2.0.0
* Update dependencies
* Update messages
* __Breaking change__ drop `Node 6` support
## 1.3.1
* Update docs
* Upgrade `is-ci` and support more CIs
* Disable `1.3.0` change related to `stdin` due to a bug on Windows
## 1.3.0
* Enable `stdin` if hook is running in a terminal
## 1.2.1
* Fix don't fail if directory in project contains whitespace
## 1.2.0
* Add comments to generated hooks to specify which package has installed husky and when
## 1.1.4
* Upgrade `execa` dependency
## 1.1.3
* Fix don't fail if `package.json` doesn't exist
## 1.1.2
* Add debug message
## 1.1.1
* Check `HUSKY_SKIP_INSTALL` value first before checking if `.git` exists
* Check Node version before running hooks
## 1.1.0
* Create `.git/hooks` if it doesn't exist
## 1.0.1
* Various `husky-upgrade` changes ([#362](https://github.com/typicode/husky/pull/362), [#360](https://github.com/typicode/husky/pull/360), [#359](https://github.com/typicode/husky/pull/359))
## 1.0.0
After a year of pre-releases and a complete rewrite, this marks the first stable release of husky 🐶🎉.
### Notable changes
Below you'll find consolidated changes since `0.14.3`. There's no change in code between `1.0.0-rc.15` and `1.0.0`.
* Hooks
* Add `sendemail-validate` hook
* Config
* Move hooks config from `scripts` field to `husky` field
* Prefer raw names for hooks (e.g. `pre-commit` rather than `precommit`)
* Support `.huskyrc` config
* Package managers
* Support environments where [yarn](https://github.com/yarnpkg/yarn/) is the only package manager installed
* Support [pnpm](https://github.com/pnpm/pnpm) package manager
* Environment variables
* Add `HUSKY_SKIP_INSTALL` environment variable for skipping git hooks installation
* Add `HUSKY_GIT_STDIN` environment variable for `pre-push`, `pre-receive`, `post-receive` and `post-rewrite` to access arguments passed by Git via stdin
* Rename `GIT_PARAMS` to `HUSKY_GIT_PARAMS`
* Messages
* Add many more messages in case of errors
* Add [please-upgrade-node](https://github.com/typicode/please-upgrade-node) message if using with unsupported Node version
* Make `--no-verify` message more accurate and only show it for hooks that can be skipped
* Upgrade
* Add `husky-upgrade` command to automatically migrate hooks in `package.json`
* Add deprecation warning for hooks that are still defined in `scripts`
* Other
* Drop `Node 4` support
* Drop integrated `nvm` support (see Node version management in docs)
### Credits
Huge thanks to all the Contributors and [Patreon Supporters](https://thanks.typicode.com)! 🙏
## 1.0.0-rc.15
* Update docs
## 1.0.0-rc.14
* Make `--no-verify` message more accurate and only show it for hooks that can be skipped
* Improve error messages
## 1.0.0-rc.13
* Show a message when Node can't be found in PATH
## 1.0.0-rc.12
* Fix exit code when used with unsupported Node version
* Update dependencies
## 1.0.0-rc.11
* Show a message instead of crashing if Node version is unsupported by Husky
## 1.0.0-rc.10
* Fix `HUSKY_GIT_PARAMS` containing only the first Git param
## 1.0.0-rc.9
* If `node_modules/husky` is missing, show message but do not crash
* Remove and upgrade some `dependencies`
## 1.0.0-rc.8
* Add `HUSKY_GIT_STDIN` environment variable for `pre-push`, `pre-receive`, `post-receive` and `post-rewrite` to access arguments passed by Git via stdin.
## 1.0.0-rc.7
* Update `cosmiconfig` dependency
* Fix `package.json` normalization error
## 1.0.0-rc.6
* Fix install error with `pnpm`
## 1.0.0-rc.5
* Auto migrate `yorkie` hooks
## 1.0.0-rc.4
* Re-enable Git submodule and worktree support
## 1.0.0-rc.3
* Re-enable subdirectory support
## 1.0.0-rc.2
* Upgrade `run-node` dependency
## 1.0.0-rc.1
* Namespace environment variable created by husky
* `GIT_PARAMS` becomes `HUSKY_GIT_PARAMS`
* Starting also with `1.0.0` versioning
## 0.15.0-rc.13
* Revert `GIT_STDIN` for the moment. Needs more testing.
`rc.10`, `rc.11` and `rc.12` are broken for some GUI clients due to `read` command
## 0.15.0-rc.9
* Handle case where `.git/hooks` directory doesn't exit
## 0.15.0-rc.8
* Handle case where `v0.14` git hooks wouldn't have been uninstalled
## 0.15.0-rc.7
* Move `postinstall` script to `install`
* Fix line ending error when running `upgrader` from OS X/Linux
## 0.15.0-rc.6
* Fix `[[` error
## 0.15.0-rc.5
* Fix error with GitHub Desktop on Windows
## 0.15.0-rc.4
* Catch error if `git` command fails
## 0.15.0-rc.3
* Fix `husky-upgrade`
* Drop `Node 4` support
## 0.15.0-rc.2
* Fix install error
## 0.15.0-rc.1
* `sendemail-validate` hook [#173](https://github.com/typicode/husky/pull/173)
* `HUSKY_SKIP_INSTALL` environment variable for skipping git hooks installation [#178](https://github.com/typicode/husky/pull/178)
* `.huskyrc` config [#209](https://github.com/typicode/husky/pull/209)
* [`pnpm`](https://github.com/pnpm/pnpm) support
* Support environments where `yarn` is the only package manager installed
* Move config from `scripts` field to `husky` field
* Prefer raw names for Git hooks (`pre-commit` rather than `precommit`)
* Drop integrated `nvm` support
* To ease upgrade:
* Provide `husky-upgrade` command
* Add deprecation warning for hooks that are defined in `scripts` (but still run them)
## 0.14.3
* Fix handle space in `PATH` [#150](https://github.com/typicode/husky/pull/114)
## 0.14.2
* Fix handle space in `HOME`
## 0.14.1
* Fix Git hooks install on Windows
* Fix hook script when `nvm` was installed with Brew
## 0.14.0
* Fix `npm@5` `Error: Cannot find module` warning when uninstalling
* Drop `Node 0.12` support
* Don't reload `nvm` if it's already in `PATH`
* Add Git worktree support [#114](https://github.com/typicode/husky/pull/114)
* Hide irrelevant `--no-verify` message for `prepare-commit-msg` [#137](https://github.com/typicode/husky/issues/137)
## 0.13.4
* Add Node version to husky output
## 0.13.3
* Revert `Fixes issue with OS X + brew where nvm was loaded even when npm was already present` that was introduced in `v0.13.0` as it was preventing Husky to load `nvm` in some cases [#106](https://github.com/typicode/husky/issues/106)
## 0.13.2
* Fixes issue [#103](https://github.com/typicode/husky/issues/103)
## 0.13.1
* Makes it easier for projects to transition from [ghooks](https://github.com/gtramontina/ghooks) by detecting ghooks installed scripts and automatically migrating them
## 0.13.0
* Makes `husky` a little less verbose by default
* Fixes issue with `OS X + brew` where `nvm` was loaded even when `npm` was already present
* Fixes issue with Git `v1.9` on Windows
* Prevents Git hooks being installed when husky is in a sub `node_modules` directory (i.e. `./node_modules/A/node_modules/husky`)
## 0.12.0
* Adds Git submodule support
* Adds Cygwin support
* Improves edge cases support (`.git` not found and `git` not in `PATH`)
* If `npm` is already present in path, doesn't load `nvm` default or `.nvmrc` version, which makes things faster in terminal. In GUI apps, the behavior is unchanged.

117
node_modules/husky/DOCS.md generated vendored Normal file
View file

@ -0,0 +1,117 @@
# Documentation
## Supported hooks
`husky` supports all Git hooks defined [here](https://git-scm.com/docs/githooks).
Server-side hooks (`pre-receive`, `update` and `post-receive`) aren't supported.
## Access Git params and stdin
Git hooks can get parameters via command-line arguments and stdin. `husky` makes them accessible via `HUSKY_GIT_PARAMS` and `HUSKY_GIT_STDIN` environment variables.
```
{
"husky": {
"hooks": {
"commit-msg": "echo $HUSKY_GIT_PARAMS"
}
}
}
```
## Disable auto-install
If you don't want `husky` to automatically install Git hooks, simply set `HUSKY_SKIP_INSTALL` environment variable to `1`.
```sh
HUSKY_SKIP_INSTALL=1 npm install
```
## Multi-package repository (monorepo)
If you have a multi-package repository, it's __recommended__ to use tools like [lerna](https://github.com/lerna/lerna) and have `husky` installed ONLY in the root `package.json` to act as the source of truth.
Generally speaking, you should AVOID defining `husky` in multiple `package.json`, as each package would overwrite previous `husky` installations.
```sh
.
└── root
├── .git
├── package.json 🐶 # Add husky here
└── packages
├── A
│ └── package.json
├── B
│ └── package.json
└── C
└── package.json
```
```js
// root/package.json
{
"private": true,
"devDependencies": {
"husky": "..."
},
"husky": {
"hooks": {
"pre-commit": "lerna run test"
}
}
}
```
## Node version management
If you're on Windows, husky will simply use the version installed globally on your system.
For macOS and Linux users:
- if you're running `git` commands in the terminal, `husky` will use the version defined in your shell `PATH`. In other words, if you're a `nvm` user, husky will use the version that you've set with `nvm`.
- if you're using a GUI client and `nvm`, it may have a different `PATH` and not load `nvm`, in this case the highest `node` version installed by `nvm` will usually be picked. You can also check `~/.node_path` to see which version is used by GUIs and edit if you want to use something else.
## ~/.huskyrc
`husky` will source `~/.huskyrc` file if it exists before running hook scripts.
You can use it, for example, to load a node version manager or run some `shell` commands before hooks.
```sh
# ~/.huskyrc
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
```
_This feature is experimental 🧪. Feedbacks are welcome._
## Debug
It's basic for the moment, but you can use `HUSKY_DEBUG=1` to log debug messages.
## Multiple commands
By design, `husky` will run hook scripts as a single command. Just like `scripts` defined in `package.json` are run.
```json
{
"pre-commit": "cmd && cmd && cmd"
}
```
That said, for readability, you may want to use an array. In this case, the recommended way is to define them in a `.huskyrc.js`
```js
const tasks = arr => arr.join(' && ')
module.exports = {
'hooks': {
'pre-commit': tasks([
'cmd',
'cmd',
'cmd'
])
}
}
```
Tools like [npm-run-all](https://github.com/mysticatea/npm-run-all) can help too.

21
node_modules/husky/LICENSE generated vendored Normal file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2017
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 rights
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.

124
node_modules/husky/README.md generated vendored Normal file
View file

@ -0,0 +1,124 @@
# husky
> Git hooks made easy
[![](https://img.shields.io/npm/dm/husky.svg?style=flat)](https://www.npmjs.org/package/husky) [![Mac/Linux Build Status](https://img.shields.io/travis/typicode/husky.svg?label=Mac%20OSX%20%26%20Linux)](https://travis-ci.org/typicode/husky) [![Windows Build status](https://img.shields.io/appveyor/ci/typicode/husky/master.svg?label=Windows)](https://ci.appveyor.com/project/typicode/husky)
Husky can prevent bad `git commit`, `git push` and more 🐶 _woof!_
## Support
If Husky is saving you (or your team) time, please consider supporting it on Patreon 👍 thank you!
<p>
<a href="https://www.patreon.com/bePatron?c=784328">
<img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" width="160">
</a>
</p>
## Sponsors
<p>
<a href="https://patreon.com/typicode">Support Husky and be the first to have your company logo here ;)</a>
</p>
## Install
```sh
npm install husky --save-dev
```
```js
// package.json
{
"husky": {
"hooks": {
"pre-commit": "npm test",
"pre-push": "npm test",
"...": "..."
}
}
}
```
```sh
git commit -m 'Keep calm and commit'
```
To go further, see the docs [here](https://github.com/typicode/husky/blob/master/DOCS.md).
__Note__: there's a known issue with Node `v12.0`, please use `v12.1` or higher.
## Uninstall
```sh
npm uninstall husky
```
## Upgrading from 0.14
Simply move your existing hooks to `husky.hooks` field and use raw Git hooks names. Also, if you're using the `GIT_PARAMS` env variable, rename it to `HUSKY_GIT_PARAMS`.
```diff
{
"scripts": {
- "precommit": "npm test",
- "commitmsg": "commitlint -E GIT_PARAMS"
},
+ "husky": {
+ "hooks": {
+ "pre-commit": "npm test",
+ "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
+ }
+ }
}
```
Alternatively, you can run the following command which will do the same automatically for you ;)
```
./node_modules/.bin/husky-upgrade
```
Starting with `1.0.0`, you can also configure hooks using `.huskyrc`, `.huskyrc.json` or `.huskyrc.js` file.
```js
// .huskyrc
{
"hooks": {
"pre-commit": "npm test"
}
}
```
To view the full list of changes, please see the [CHANGELOG](https://github.com/typicode/husky/blob/master/CHANGELOG.md).
## Features
* Keeps existing user hooks
* Supports GUI Git clients
* Supports all Git hooks (`pre-commit`, `pre-push`, ...)
## Used by
* [jQuery](https://github.com/jquery/jquery)
* [babel](https://github.com/babel/babel)
* [create-react-app](https://github.com/facebookincubator/create-react-app)
* [Next.js](https://github.com/zeit/next.js)
* [Hyper](https://github.com/zeit/hyper)
* [Kibana](https://github.com/elastic/kibana)
* [JSON Server](https://github.com/typicode/json-server)
* [Hotel](https://github.com/typicode/hotel)
* ... and 28k+ [other awesome repos](https://libraries.io/npm/husky/dependent-repositories)
## See also
* [pkg-ok](https://github.com/typicode/pkg-ok) - Prevents publishing a module with bad paths or incorrect line endings
* [please-upgrade-node](https://github.com/typicode/please-upgrade-node) - Show a message to upgrade Node instead of a stacktrace in your CLIs
* [pinst](https://github.com/typicode/pinst) - dev only postinstall hook
## License
MIT
[Patreon](https://www.patreon.com/typicode) - [Supporters](https://thanks.typicode.com) ✨

18
node_modules/husky/husky.js generated vendored Normal file
View file

@ -0,0 +1,18 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const pleaseUpgradeNode = require('please-upgrade-node')
const pkg = require('./package.json')
// Node version isn't supported, skip install
pleaseUpgradeNode(pkg, {
exitCode: 0,
message(requiredVersion) {
return (
'Husky requires Node ' +
requiredVersion +
', skipping Git hooks installation.'
)
}
})
// Node version is supported, continue
require('./lib/installer/bin')

15
node_modules/husky/lib/getConf.js generated vendored Normal file
View file

@ -0,0 +1,15 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const cosmiconfig_1 = __importDefault(require("cosmiconfig"));
function getConf(dir) {
const explorer = cosmiconfig_1.default('husky');
const { config = {} } = explorer.searchSync(dir) || {};
const defaults = {
skipCI: true
};
return Object.assign({}, defaults, config);
}
exports.default = getConf;

29
node_modules/husky/lib/installer/bin.js generated vendored Normal file
View file

@ -0,0 +1,29 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const is_ci_1 = __importDefault(require("is-ci"));
const path_1 = __importDefault(require("path"));
const _1 = require("./");
// Just for testing
if (process.env.HUSKY_DEBUG === 'true' || process.env.HUSKY_DEBUG === '1') {
console.log(`husky:debug INIT_CWD=${process.env.INIT_CWD}`);
}
// Action can be "install" or "uninstall"
// huskyDir is ONLY used in dev, don't use this arguments
const [, , action, huskyDir = path_1.default.join(__dirname, '../..')] = process.argv;
// Find Git dir
try {
// Run installer
if (action === 'install') {
_1.install(huskyDir, undefined, is_ci_1.default);
}
else {
_1.uninstall(huskyDir);
}
}
catch (error) {
console.log(`husky > failed to ${action}`);
console.log(error.message);
}

91
node_modules/husky/lib/installer/getScript.js generated vendored Normal file
View file

@ -0,0 +1,91 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs_1 = __importDefault(require("fs"));
const os_1 = __importDefault(require("os"));
const path_1 = __importDefault(require("path"));
const slash_1 = __importDefault(require("slash"));
// Used to identify scripts created by Husky
exports.huskyIdentifier = '# husky';
// Experimental
const huskyrc = '~/.huskyrc';
// Render script
const render = ({ createdAt, homepage, node, pkgDirectory, pkgHomepage, platform, runScriptPath, version }) => `#!/bin/sh
${exports.huskyIdentifier}
# Hook created by Husky
# Version: ${version}
# At: ${createdAt}
# See: ${homepage}
# From
# Directory: ${pkgDirectory}
# Homepage: ${pkgHomepage}
scriptPath="${runScriptPath}.js"
hookName=\`basename "$0"\`
gitParams="$*"
debug() {
[ "$\{HUSKY_DEBUG}" = "true" ] || [ "$\{HUSKY_DEBUG}" = "1" ] && echo "husky:debug $1"
}
debug "$hookName hook started..."
${platform === 'win32'
? ''
: `
if ! command -v node >/dev/null 2>&1; then
echo "Info: Can't find node in PATH, trying to find a node binary on your system"
fi
`}
if [ -f "$scriptPath" ]; then
# if [ -t 1 ]; then
# exec < /dev/tty
# fi
if [ -f ${huskyrc} ]; then
debug "source ${huskyrc}"
. ${huskyrc}
fi
${node} "$scriptPath" $hookName "$gitParams"
else
echo "Can't find Husky, skipping $hookName hook"
echo "You can reinstall it using 'npm install husky --save-dev' or delete this hook"
fi
`;
/**
* @param {string} rootDir - e.g. /home/typicode/project/
* @param {string} huskyDir - e.g. /home/typicode/project/node_modules/husky/
* @param {string} requireRunNodePath - path to run-node resolved by require e.g. /home/typicode/project/node_modules/run-node/run-node
* @param {string} platform - platform husky installer is running on (used to produce win32 specific script)
* @returns {string} script
*/
function default_1(rootDir, huskyDir, requireRunNodePath,
// Additional param used for testing only
platform = os_1.default.platform()) {
const runNodePath = slash_1.default(path_1.default.relative(rootDir, requireRunNodePath));
// On Windows do not rely on run-node
const node = platform === 'win32' ? 'node' : runNodePath;
// Env variable
const pkgHomepage = process && process.env && process.env.npm_package_homepage;
const pkgDirectory = process && process.env && process.env.PWD;
// Husky package.json
const { homepage, version } = JSON.parse(fs_1.default.readFileSync(path_1.default.join(__dirname, '../../package.json'), 'utf-8'));
// Path to run.js
const runScriptPath = slash_1.default(path_1.default.join(path_1.default.relative(rootDir, huskyDir), 'run'));
// Created at
const createdAt = new Date().toLocaleString();
// Render script
return render({
createdAt,
homepage,
node,
pkgDirectory,
pkgHomepage,
platform,
runScriptPath,
version
});
}
exports.default = default_1;

171
node_modules/husky/lib/installer/index.js generated vendored Normal file
View file

@ -0,0 +1,171 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const find_up_1 = __importDefault(require("find-up"));
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
const pkg_dir_1 = __importDefault(require("pkg-dir"));
const getConf_1 = __importDefault(require("../getConf"));
const getScript_1 = __importDefault(require("./getScript"));
const is_1 = require("./is");
const resolveGitDir_1 = __importDefault(require("./resolveGitDir"));
const hookList = [
'applypatch-msg',
'pre-applypatch',
'post-applypatch',
'pre-commit',
'prepare-commit-msg',
'commit-msg',
'post-commit',
'pre-rebase',
'post-checkout',
'post-merge',
'pre-push',
'pre-receive',
'update',
'post-receive',
'post-update',
'push-to-checkout',
'pre-auto-gc',
'post-rewrite',
'sendemail-validate'
];
function writeHook(filename, script) {
fs_1.default.writeFileSync(filename, script, 'utf-8');
fs_1.default.chmodSync(filename, 0o0755);
}
function createHook(filename, script) {
// Get name, used for logging
const name = path_1.default.basename(filename);
// Check if hook exist
if (fs_1.default.existsSync(filename)) {
const hook = fs_1.default.readFileSync(filename, 'utf-8');
// Migrate
if (is_1.isGhooks(hook)) {
console.log(`migrating existing ghooks script: ${name}`);
return writeHook(filename, script);
}
// Migrate
if (is_1.isPreCommit(hook)) {
console.log(`migrating existing pre-commit script: ${name}`);
return writeHook(filename, script);
}
// Update
if (is_1.isHusky(hook) || is_1.isYorkie(hook)) {
return writeHook(filename, script);
}
// Skip
console.log(`skipping existing user hook: ${name}`);
return;
}
// Create hook if it doesn't exist
writeHook(filename, script);
}
function createHooks(filenames, script) {
filenames.forEach((filename) => createHook(filename, script));
}
function canRemove(filename) {
if (fs_1.default.existsSync(filename)) {
const data = fs_1.default.readFileSync(filename, 'utf-8');
return is_1.isHusky(data);
}
return false;
}
function removeHook(filename) {
fs_1.default.unlinkSync(filename);
}
function removeHooks(filenames) {
filenames.filter(canRemove).forEach(removeHook);
}
// This prevents the case where someone would want to debug a node_module that has
// husky as devDependency and run npm install from node_modules directory
function isInNodeModules(dir) {
// INIT_CWD holds the full path you were in when you ran npm install (supported also by yarn and pnpm)
// See https://docs.npmjs.com/cli/run-script
if (process.env.INIT_CWD) {
return process.env.INIT_CWD.indexOf('node_modules') !== -1;
}
// Old technique
return (dir.match(/node_modules/g) || []).length > 1;
}
function getHooks(gitDir) {
const gitHooksDir = path_1.default.join(gitDir, 'hooks');
return hookList.map((hookName) => path_1.default.join(gitHooksDir, hookName));
}
/**
* @param {string} huskyDir - e.g. /home/typicode/project/node_modules/husky/
* @param {string} requireRunNodePath - path to run-node resolved by require e.g. /home/typicode/project/node_modules/run-node/run-node
* @param {string} isCI - true if running in CI
*/
function install(huskyDir, requireRunNodePath = require.resolve('run-node/run-node'), isCI) {
console.log('husky > Setting up git hooks');
// First directory containing user's package.json
const userPkgDir = pkg_dir_1.default.sync(path_1.default.join(huskyDir, '..'));
if (userPkgDir === undefined) {
console.log("Can't find package.json, skipping Git hooks installation.");
console.log('Please check that your project has a package.json or create it and reinstall husky.');
return;
}
// Get conf from package.json or .huskyrc
const conf = getConf_1.default(userPkgDir);
// Get directory containing .git directory or in the case of Git submodules, the .git file
const gitDirOrFile = find_up_1.default.sync('.git', { cwd: userPkgDir });
// Resolve git directory (e.g. .git/ or .git/modules/path/to/submodule)
const resolvedGitDir = resolveGitDir_1.default(userPkgDir);
// Checks
if (process.env.HUSKY_SKIP_INSTALL === 'true') {
console.log("HUSKY_SKIP_INSTALL environment variable is set to 'true',", 'skipping Git hooks installation.');
return;
}
if (gitDirOrFile === null || gitDirOrFile === undefined) {
console.log("Can't find .git, skipping Git hooks installation.");
console.log("Please check that you're in a cloned repository", "or run 'git init' to create an empty Git repository and reinstall husky.");
return;
}
if (resolvedGitDir === null) {
console.log("Can't find resolved .git directory, skipping Git hooks installation.");
return;
}
if (isCI && conf.skipCI) {
console.log('CI detected, skipping Git hooks installation.');
return;
}
if (isInNodeModules(huskyDir)) {
console.log('Trying to install from node_modules directory, skipping Git hooks installation.');
return;
}
// Create hooks directory if doesn't exist
if (!fs_1.default.existsSync(path_1.default.join(resolvedGitDir, 'hooks'))) {
fs_1.default.mkdirSync(path_1.default.join(resolvedGitDir, 'hooks'));
}
// Create hooks
// Get root dir based on the first .git directory of file found
const rootDir = path_1.default.dirname(gitDirOrFile);
const hooks = getHooks(resolvedGitDir);
const script = getScript_1.default(rootDir, huskyDir, requireRunNodePath);
createHooks(hooks, script);
console.log(`husky > Done`);
console.log('husky > Like husky? You can support the project on Patreon:');
console.log('husky > \x1b[4;36m%s\x1b[0m ❤', 'https://www.patreon.com/typicode');
}
exports.install = install;
function uninstall(huskyDir) {
console.log('husky > Uninstalling git hooks');
const userPkgDir = pkg_dir_1.default.sync(path_1.default.join(huskyDir, '..'));
const resolvedGitDir = resolveGitDir_1.default(userPkgDir);
if (resolvedGitDir === null) {
console.log("Can't find resolved .git directory, skipping Git hooks uninstallation.");
return;
}
if (isInNodeModules(huskyDir)) {
console.log('Trying to uninstall from node_modules directory, skipping Git hooks uninstallation.');
return;
}
// Remove hooks
const hooks = getHooks(resolvedGitDir);
removeHooks(hooks);
console.log('husky > Done');
}
exports.uninstall = uninstall;

24
node_modules/husky/lib/installer/is.js generated vendored Normal file
View file

@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const getScript_1 = require("./getScript");
function isHusky(data) {
// Husky v0.14 and prior used #husky as an identifier.
// Just in case some previous hooks weren't correctly uninstalled,
// and for a better transition this will allow v0.15+ to uninstall them as well.
const previousHuskyIdentifier = '#husky';
return (data.indexOf(getScript_1.huskyIdentifier) !== -1 ||
data.indexOf(previousHuskyIdentifier) !== -1);
}
exports.isHusky = isHusky;
function isYorkie(data) {
return data.indexOf('#yorkie') !== -1;
}
exports.isYorkie = isYorkie;
function isGhooks(data) {
return data.indexOf('// Generated by ghooks. Do not edit this file.') !== -1;
}
exports.isGhooks = isGhooks;
function isPreCommit(data) {
return data.indexOf('./node_modules/pre-commit/hook') !== -1;
}
exports.isPreCommit = isPreCommit;

39
node_modules/husky/lib/installer/resolveGitDir.js generated vendored Normal file
View file

@ -0,0 +1,39 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const find_up_1 = __importDefault(require("find-up"));
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
function default_1(cwd) {
const foundPath = find_up_1.default.sync('.git', { cwd });
if (foundPath) {
const stats = fs_1.default.lstatSync(foundPath);
// If it's a .git file resolve path
if (stats.isFile()) {
// Expect following format
// git: pathToGit
// On Windows pathToGit can contain ':' (example "gitdir: C:/Some/Path")
const gitFileData = fs_1.default.readFileSync(foundPath, 'utf-8');
const gitDir = gitFileData
.split(':')
.slice(1)
.join(':')
.trim();
const resolvedGitDir = path_1.default.resolve(path_1.default.dirname(foundPath), gitDir);
// For git-worktree, check if commondir file exists and return that path
const pathCommonDir = path_1.default.join(resolvedGitDir, 'commondir');
if (fs_1.default.existsSync(pathCommonDir)) {
const commondir = fs_1.default.readFileSync(pathCommonDir, 'utf-8').trim();
const resolvedCommonGitDir = path_1.default.join(resolvedGitDir, commondir);
return resolvedCommonGitDir;
}
return resolvedGitDir;
}
// Else return path to .git directory
return foundPath;
}
return null;
}
exports.default = default_1;

12
node_modules/husky/lib/runner/bin.js generated vendored Normal file
View file

@ -0,0 +1,12 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const _1 = __importDefault(require("./"));
_1.default(process.argv)
.then((status) => process.exit(status))
.catch((err) => {
console.log('Husky > unexpected error', err);
process.exit(1);
});

83
node_modules/husky/lib/runner/index.js generated vendored Normal file
View file

@ -0,0 +1,83 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const execa_1 = __importDefault(require("execa"));
const get_stdin_1 = __importDefault(require("get-stdin"));
const path_1 = __importDefault(require("path"));
const read_pkg_1 = __importDefault(require("read-pkg"));
const getConf_1 = __importDefault(require("../getConf"));
/**
* @param {array} argv - process.argv
* @param {promise} getStdinFn - used for mocking only
*/
function run([, scriptPath, hookName = '', HUSKY_GIT_PARAMS], getStdinFn = get_stdin_1.default) {
return __awaiter(this, void 0, void 0, function* () {
const cwd = path_1.default.resolve(scriptPath.split('node_modules')[0]);
// In some cases, package.json may not exist
// For example, when switching to gh-page branch
let pkg;
try {
pkg = read_pkg_1.default.sync({ cwd, normalize: false });
}
catch (err) {
if (err.code !== 'ENOENT') {
throw err;
}
}
const config = getConf_1.default(cwd);
const command = config && config.hooks && config.hooks[hookName];
const oldCommand = pkg && pkg.scripts && pkg.scripts[hookName.replace('-', '')];
// Run command
try {
const env = {};
if (HUSKY_GIT_PARAMS) {
env.HUSKY_GIT_PARAMS = HUSKY_GIT_PARAMS;
}
if (['pre-push', 'pre-receive', 'post-receive', 'post-rewrite'].includes(hookName)) {
// Wait for stdin
env.HUSKY_GIT_STDIN = yield getStdinFn();
}
if (command) {
console.log(`husky > ${hookName} (node ${process.version})`);
execa_1.default.shellSync(command, { cwd, env, stdio: 'inherit' });
return 0;
}
if (oldCommand) {
console.log();
console.log(`Warning: Setting ${hookName} script in package.json > scripts will be deprecated`);
console.log(`Please move it to husky.hooks in package.json, a .huskyrc file, or a husky.config.js file`);
console.log(`Or run ./node_modules/.bin/husky-upgrade for automatic update`);
console.log();
console.log(`See https://github.com/typicode/husky for usage`);
console.log();
console.log(`husky > ${hookName} (node ${process.version})`);
execa_1.default.shellSync(oldCommand, { cwd, env, stdio: 'inherit' });
return 0;
}
return 0;
}
catch (err) {
const noVerifyMessage = [
'commit-msg',
'pre-commit',
'pre-rebase',
'pre-push'
].includes(hookName)
? '(add --no-verify to bypass)'
: '(cannot be bypassed with --no-verify due to Git specs)';
console.log(`husky > ${hookName} hook failed ${noVerifyMessage}`);
return err.code;
}
});
}
exports.default = run;

8
node_modules/husky/lib/upgrader/bin.js generated vendored Normal file
View file

@ -0,0 +1,8 @@
#!/usr/bin/env node
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const index_1 = __importDefault(require("./index"));
index_1.default(process.cwd());

64
node_modules/husky/lib/upgrader/index.js generated vendored Normal file
View file

@ -0,0 +1,64 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
const read_pkg_1 = __importDefault(require("read-pkg"));
const hookList = {
applypatchmsg: 'applypatch-msg',
commitmsg: 'commit-msg',
postapplypatch: 'post-applypatch',
postcheckout: 'post-checkout',
postcommit: 'post-commit',
postmerge: 'post-merge',
postreceive: 'post-receive',
postrewrite: 'post-rewrite',
postupdate: 'post-update',
preapplypatch: 'pre-applypatch',
preautogc: 'pre-auto-gc',
precommit: 'pre-commit',
preparecommitmsg: 'prepare-commit-msg',
prepush: 'pre-push',
prerebase: 'pre-rebase',
prereceive: 'pre-receive',
pushtocheckout: 'push-to-checkout',
sendemailvalidate: 'sendemail-validate',
update: 'update'
};
function upgrade(cwd) {
const pkgFile = path_1.default.join(cwd, 'package.json');
if (fs_1.default.existsSync(pkgFile)) {
const pkg = read_pkg_1.default.sync({ cwd, normalize: false });
console.log(`husky > upgrading ${pkgFile}`);
// Don't overwrite 'husky' field if it exists
if (pkg.husky) {
return console.log(`husky field in package.json isn't empty, skipping automatic upgrade`);
}
const hooks = {};
// Find hooks in package.json 'scripts' field
Object.keys(hookList).forEach((name) => {
if (pkg.scripts) {
const script = pkg.scripts[name];
if (script) {
delete pkg.scripts[name];
const newName = hookList[name];
hooks[newName] = script.replace(/\bGIT_PARAMS\b/g, 'HUSKY_GIT_PARAMS');
console.log(`moved scripts.${name} to husky.hooks.${newName}`);
}
}
});
// Move found hooks to 'husky.hooks' field
if (Object.keys(hooks).length) {
pkg.husky = { hooks };
}
else {
console.log('no hooks found');
}
// Update package.json
fs_1.default.writeFileSync(pkgFile, `${JSON.stringify(pkg, null, 2)}\n`, 'utf-8');
console.log(`husky > done`);
}
}
exports.default = upgrade;

83
node_modules/husky/node_modules/locate-path/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,83 @@
declare namespace locatePath {
interface Options {
/**
Current working directory.
@default process.cwd()
*/
readonly cwd?: string;
/**
Type of path to match.
@default 'file'
*/
readonly type?: 'file' | 'directory';
/**
Allow symbolic links to match if they point to the requested path type.
@default true
*/
readonly allowSymlinks?: boolean;
}
interface AsyncOptions extends Options {
/**
Number of concurrently pending promises. Minimum: `1`.
@default Infinity
*/
readonly concurrency?: number;
/**
Preserve `paths` order when searching.
Disable this to improve performance if you don't care about the order.
@default true
*/
readonly preserveOrder?: boolean;
}
}
declare const locatePath: {
/**
Get the first path that exists on disk of multiple paths.
@param paths - Paths to check.
@returns The first path that exists or `undefined` if none exists.
@example
```
import locatePath = require('locate-path');
const files = [
'unicorn.png',
'rainbow.png', // Only this one actually exists on disk
'pony.png'
];
(async () => {
console(await locatePath(files));
//=> 'rainbow'
})();
```
*/
(paths: Iterable<string>, options?: locatePath.AsyncOptions): Promise<
string | undefined
>;
/**
Synchronously get the first path that exists on disk of multiple paths.
@param paths - Paths to check.
@returns The first path that exists or `undefined` if none exists.
*/
sync(
paths: Iterable<string>,
options?: locatePath.Options
): string | undefined;
};
export = locatePath;

65
node_modules/husky/node_modules/locate-path/index.js generated vendored Normal file
View file

@ -0,0 +1,65 @@
'use strict';
const path = require('path');
const fs = require('fs');
const {promisify} = require('util');
const pLocate = require('p-locate');
const fsStat = promisify(fs.stat);
const fsLStat = promisify(fs.lstat);
const typeMappings = {
directory: 'isDirectory',
file: 'isFile'
};
function checkType({type}) {
if (type in typeMappings) {
return;
}
throw new Error(`Invalid type specified: ${type}`);
}
const matchType = (type, stat) => type === undefined || stat[typeMappings[type]]();
module.exports = async (paths, options) => {
options = {
cwd: process.cwd(),
type: 'file',
allowSymlinks: true,
...options
};
checkType(options);
const statFn = options.allowSymlinks ? fsStat : fsLStat;
return pLocate(paths, async path_ => {
try {
const stat = await statFn(path.resolve(options.cwd, path_));
return matchType(options.type, stat);
} catch (_) {
return false;
}
}, options);
};
module.exports.sync = (paths, options) => {
options = {
cwd: process.cwd(),
allowSymlinks: true,
type: 'file',
...options
};
checkType(options);
const statFn = options.allowSymlinks ? fs.statSync : fs.lstatSync;
for (const path_ of paths) {
try {
const stat = statFn(path.resolve(options.cwd, path_));
if (matchType(options.type, stat)) {
return path_;
}
} catch (_) {
}
}
};

9
node_modules/husky/node_modules/locate-path/license generated vendored Normal file
View file

@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
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 rights 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.

View file

@ -0,0 +1,81 @@
{
"_args": [
[
"locate-path@5.0.0",
"C:\\Users\\damccorm\\Documents\\setup-node"
]
],
"_development": true,
"_from": "locate-path@5.0.0",
"_id": "locate-path@5.0.0",
"_inBundle": false,
"_integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
"_location": "/husky/locate-path",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "locate-path@5.0.0",
"name": "locate-path",
"escapedName": "locate-path",
"rawSpec": "5.0.0",
"saveSpec": null,
"fetchSpec": "5.0.0"
},
"_requiredBy": [
"/husky/pkg-dir/find-up"
],
"_resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
"_spec": "5.0.0",
"_where": "C:\\Users\\damccorm\\Documents\\setup-node",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/locate-path/issues"
},
"dependencies": {
"p-locate": "^4.1.0"
},
"description": "Get the first path that exists on disk of multiple paths",
"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
},
"engines": {
"node": ">=8"
},
"files": [
"index.js",
"index.d.ts"
],
"homepage": "https://github.com/sindresorhus/locate-path#readme",
"keywords": [
"locate",
"path",
"paths",
"file",
"files",
"exists",
"find",
"finder",
"search",
"searcher",
"array",
"iterable",
"iterator"
],
"license": "MIT",
"name": "locate-path",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/locate-path.git"
},
"scripts": {
"test": "xo && ava && tsd"
},
"version": "5.0.0"
}

122
node_modules/husky/node_modules/locate-path/readme.md generated vendored Normal file
View file

@ -0,0 +1,122 @@
# locate-path [![Build Status](https://travis-ci.org/sindresorhus/locate-path.svg?branch=master)](https://travis-ci.org/sindresorhus/locate-path)
> Get the first path that exists on disk of multiple paths
## Install
```
$ npm install locate-path
```
## Usage
Here we find the first file that exists on disk, in array order.
```js
const locatePath = require('locate-path');
const files = [
'unicorn.png',
'rainbow.png', // Only this one actually exists on disk
'pony.png'
];
(async () => {
console(await locatePath(files));
//=> 'rainbow'
})();
```
## API
### locatePath(paths, [options])
Returns a `Promise<string>` for the first path that exists or `undefined` if none exists.
#### paths
Type: `Iterable<string>`
Paths to check.
#### options
Type: `Object`
##### concurrency
Type: `number`<br>
Default: `Infinity`<br>
Minimum: `1`
Number of concurrently pending promises.
##### preserveOrder
Type: `boolean`<br>
Default: `true`
Preserve `paths` order when searching.
Disable this to improve performance if you don't care about the order.
##### cwd
Type: `string`<br>
Default: `process.cwd()`
Current working directory.
##### type
Type: `string`<br>
Default: `file`<br>
Values: `file` `directory`
The type of paths that can match.
##### allowSymlinks
Type: `boolean`<br>
Default: `true`
Allow symbolic links to match if they point to the chosen path type.
### locatePath.sync(paths, [options])
Returns the first path that exists or `undefined` if none exists.
#### paths
Type: `Iterable<string>`
Paths to check.
#### options
Type: `Object`
##### cwd
Same as above.
##### type
Same as above.
##### allowSymlinks
Same as above.
## Related
- [path-exists](https://github.com/sindresorhus/path-exists) - Check if a path exists
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)

64
node_modules/husky/node_modules/p-locate/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,64 @@
declare namespace pLocate {
interface Options {
/**
Number of concurrently pending promises returned by `tester`. Minimum: `1`.
@default Infinity
*/
readonly concurrency?: number;
/**
Preserve `input` order when searching.
Disable this to improve performance if you don't care about the order.
@default true
*/
readonly preserveOrder?: boolean;
}
}
declare const pLocate: {
/**
Get the first fulfilled promise that satisfies the provided testing function.
@param input - An iterable of promises/values to test.
@param tester - This function will receive resolved values from `input` and is expected to return a `Promise<boolean>` or `boolean`.
@returns A `Promise` that is fulfilled when `tester` resolves to `true` or the iterable is done, or rejects if any of the promises reject. The fulfilled value is the current iterable value or `undefined` if `tester` never resolved to `true`.
@example
```
import pathExists = require('path-exists');
import pLocate = require('p-locate');
const files = [
'unicorn.png',
'rainbow.png', // Only this one actually exists on disk
'pony.png'
];
(async () => {
const foundPath = await pLocate(files, file => pathExists(file));
console.log(foundPath);
//=> 'rainbow'
})();
```
*/
<ValueType>(
input: Iterable<PromiseLike<ValueType> | ValueType>,
tester: (element: ValueType) => PromiseLike<boolean> | boolean,
options?: pLocate.Options
): Promise<ValueType | undefined>;
// TODO: Remove this for the next major release, refactor the whole definition to:
// declare function pLocate<ValueType>(
// input: Iterable<PromiseLike<ValueType> | ValueType>,
// tester: (element: ValueType) => PromiseLike<boolean> | boolean,
// options?: pLocate.Options
// ): Promise<ValueType | undefined>;
// export = pLocate;
default: typeof pLocate;
};
export = pLocate;

52
node_modules/husky/node_modules/p-locate/index.js generated vendored Normal file
View file

@ -0,0 +1,52 @@
'use strict';
const pLimit = require('p-limit');
class EndError extends Error {
constructor(value) {
super();
this.value = value;
}
}
// The input can also be a promise, so we await it
const testElement = async (element, tester) => tester(await element);
// The input can also be a promise, so we `Promise.all()` them both
const finder = async element => {
const values = await Promise.all(element);
if (values[1] === true) {
throw new EndError(values[0]);
}
return false;
};
const pLocate = async (iterable, tester, options) => {
options = {
concurrency: Infinity,
preserveOrder: true,
...options
};
const limit = pLimit(options.concurrency);
// Start all the promises concurrently with optional limit
const items = [...iterable].map(element => [element, limit(testElement, element, tester)]);
// Check the promises either serially or concurrently
const checkLimit = pLimit(options.preserveOrder ? 1 : Infinity);
try {
await Promise.all(items.map(element => checkLimit(finder, element)));
} catch (error) {
if (error instanceof EndError) {
return error.value;
}
throw error;
}
};
module.exports = pLocate;
// TODO: Remove this for the next major release
module.exports.default = pLocate;

9
node_modules/husky/node_modules/p-locate/license generated vendored Normal file
View file

@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
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 rights 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.

89
node_modules/husky/node_modules/p-locate/package.json generated vendored Normal file
View file

@ -0,0 +1,89 @@
{
"_args": [
[
"p-locate@4.1.0",
"C:\\Users\\damccorm\\Documents\\setup-node"
]
],
"_development": true,
"_from": "p-locate@4.1.0",
"_id": "p-locate@4.1.0",
"_inBundle": false,
"_integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
"_location": "/husky/p-locate",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "p-locate@4.1.0",
"name": "p-locate",
"escapedName": "p-locate",
"rawSpec": "4.1.0",
"saveSpec": null,
"fetchSpec": "4.1.0"
},
"_requiredBy": [
"/husky/locate-path"
],
"_resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
"_spec": "4.1.0",
"_where": "C:\\Users\\damccorm\\Documents\\setup-node",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/p-locate/issues"
},
"dependencies": {
"p-limit": "^2.2.0"
},
"description": "Get the first fulfilled promise that satisfies the provided testing function",
"devDependencies": {
"ava": "^1.4.1",
"delay": "^4.1.0",
"in-range": "^1.0.0",
"time-span": "^3.0.0",
"tsd": "^0.7.2",
"xo": "^0.24.0"
},
"engines": {
"node": ">=8"
},
"files": [
"index.js",
"index.d.ts"
],
"homepage": "https://github.com/sindresorhus/p-locate#readme",
"keywords": [
"promise",
"locate",
"find",
"finder",
"search",
"searcher",
"test",
"array",
"collection",
"iterable",
"iterator",
"race",
"fulfilled",
"fastest",
"async",
"await",
"promises",
"bluebird"
],
"license": "MIT",
"name": "p-locate",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/p-locate.git"
},
"scripts": {
"test": "xo && ava && tsd"
},
"version": "4.1.0"
}

90
node_modules/husky/node_modules/p-locate/readme.md generated vendored Normal file
View file

@ -0,0 +1,90 @@
# p-locate [![Build Status](https://travis-ci.org/sindresorhus/p-locate.svg?branch=master)](https://travis-ci.org/sindresorhus/p-locate)
> Get the first fulfilled promise that satisfies the provided testing function
Think of it like an async version of [`Array#find`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/find).
## Install
```
$ npm install p-locate
```
## Usage
Here we find the first file that exists on disk, in array order.
```js
const pathExists = require('path-exists');
const pLocate = require('p-locate');
const files = [
'unicorn.png',
'rainbow.png', // Only this one actually exists on disk
'pony.png'
];
(async () => {
const foundPath = await pLocate(files, file => pathExists(file));
console.log(foundPath);
//=> 'rainbow'
})();
```
*The above is just an example. Use [`locate-path`](https://github.com/sindresorhus/locate-path) if you need this.*
## API
### pLocate(input, tester, [options])
Returns a `Promise` that is fulfilled when `tester` resolves to `true` or the iterable is done, or rejects if any of the promises reject. The fulfilled value is the current iterable value or `undefined` if `tester` never resolved to `true`.
#### input
Type: `Iterable<Promise | unknown>`
An iterable of promises/values to test.
#### tester(element)
Type: `Function`
This function will receive resolved values from `input` and is expected to return a `Promise<boolean>` or `boolean`.
#### options
Type: `Object`
##### concurrency
Type: `number`<br>
Default: `Infinity`<br>
Minimum: `1`
Number of concurrently pending promises returned by `tester`.
##### preserveOrder
Type: `boolean`<br>
Default: `true`
Preserve `input` order when searching.
Disable this to improve performance if you don't care about the order.
## Related
- [p-map](https://github.com/sindresorhus/p-map) - Map over promises concurrently
- [p-filter](https://github.com/sindresorhus/p-filter) - Filter promises concurrently
- [p-any](https://github.com/sindresorhus/p-any) - Wait for any promise to be fulfilled
- [More…](https://github.com/sindresorhus/promise-fun)
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)

44
node_modules/husky/node_modules/pkg-dir/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,44 @@
declare const pkgDir: {
/**
Find the root directory of a Node.js project or npm package.
@param cwd - Directory to start from. Default: `process.cwd()`.
@returns The project root path or `undefined` if it couldn't be found.
@example
```
// /
// └── Users
// └── sindresorhus
// └── foo
// ├── package.json
// └── bar
// ├── baz
// └── example.js
// example.js
import pkgDir = require('pkg-dir');
(async () => {
const rootDir = await pkgDir(__dirname);
console.log(rootDir);
//=> '/Users/sindresorhus/foo'
})();
```
*/
(cwd?: string): Promise<string | undefined>;
/**
Synchronously find the root directory of a Node.js project or npm package.
@param cwd - Directory to start from. Default: `process.cwd()`.
@returns The project root path or `undefined` if it couldn't be found.
*/
sync(cwd?: string): string | undefined;
// TODO: Remove this for the next major release
default: typeof pkgDir;
};
export = pkgDir;

17
node_modules/husky/node_modules/pkg-dir/index.js generated vendored Normal file
View file

@ -0,0 +1,17 @@
'use strict';
const path = require('path');
const findUp = require('find-up');
const pkgDir = async cwd => {
const filePath = await findUp('package.json', {cwd});
return filePath && path.dirname(filePath);
};
module.exports = pkgDir;
// TODO: Remove this for the next major release
module.exports.default = pkgDir;
module.exports.sync = cwd => {
const filePath = findUp.sync('package.json', {cwd});
return filePath && path.dirname(filePath);
};

9
node_modules/husky/node_modules/pkg-dir/license generated vendored Normal file
View file

@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
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 rights 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.

View file

@ -0,0 +1,75 @@
import {Options as LocatePathOptions} from 'locate-path';
declare const stop: unique symbol;
declare namespace findUp {
interface Options extends LocatePathOptions {}
type StopSymbol = typeof stop;
type Match = string | StopSymbol | undefined;
}
declare const findUp: {
/**
Find a file or directory by walking up parent directories.
@param name - Name of the file or directory to find. Can be multiple.
@returns The first path found (by respecting the order of `name`s) or `undefined` if none could be found.
@example
```
// /
// └── Users
// └── sindresorhus
// ├── unicorn.png
// └── foo
// └── bar
// ├── baz
// └── example.js
// example.js
import findUp = require('find-up');
(async () => {
console.log(await findUp('unicorn.png'));
//=> '/Users/sindresorhus/unicorn.png'
console.log(await findUp(['rainbow.png', 'unicorn.png']));
//=> '/Users/sindresorhus/unicorn.png'
})();
```
*/
(name: string | string[], options?: findUp.Options): Promise<string | undefined>;
/**
Find a file or directory by walking up parent directories.
@param matcher - Called for each directory in the search. Return a path or `findUp.stop` to stop the search.
@returns The first path found or `undefined` if none could be found.
*/
(matcher: (directory: string) => (findUp.Match | Promise<findUp.Match>), options?: findUp.Options): Promise<string | undefined>;
/**
Synchronously find a file or directory by walking up parent directories.
@param name - Name of the file or directory to find. Can be multiple.
@returns The first path found (by respecting the order of `name`s) or `undefined` if none could be found.
*/
sync(name: string | string[], options?: findUp.Options): string | undefined;
/**
Synchronously find a file or directory by walking up parent directories.
@param matcher - Called for each directory in the search. Return a path or `findUp.stop` to stop the search.
@returns The first path found or `undefined` if none could be found.
*/
sync(matcher: (directory: string) => findUp.Match, options?: findUp.Options): string | undefined;
/**
Return this in a `matcher` function to stop the search and force `findUp` to immediately return `undefined`.
*/
readonly stop: findUp.StopSymbol;
};
export = findUp;

View file

@ -0,0 +1,84 @@
'use strict';
const path = require('path');
const locatePath = require('locate-path');
const stop = Symbol('findUp.stop');
module.exports = async (name, options = {}) => {
let directory = path.resolve(options.cwd || '');
const {root} = path.parse(directory);
const paths = [].concat(name);
const runMatcher = async locateOptions => {
if (typeof name !== 'function') {
return locatePath(paths, locateOptions);
}
const foundPath = await name(locateOptions.cwd);
if (typeof foundPath === 'string') {
return locatePath([foundPath], locateOptions);
}
return foundPath;
};
// eslint-disable-next-line no-constant-condition
while (true) {
// eslint-disable-next-line no-await-in-loop
const foundPath = await runMatcher({...options, cwd: directory});
if (foundPath === stop) {
return;
}
if (foundPath) {
return path.resolve(directory, foundPath);
}
if (directory === root) {
return;
}
directory = path.dirname(directory);
}
};
module.exports.sync = (name, options = {}) => {
let directory = path.resolve(options.cwd || '');
const {root} = path.parse(directory);
const paths = [].concat(name);
const runMatcher = locateOptions => {
if (typeof name !== 'function') {
return locatePath.sync(paths, locateOptions);
}
const foundPath = name(locateOptions.cwd);
if (typeof foundPath === 'string') {
return locatePath.sync([foundPath], locateOptions);
}
return foundPath;
};
// eslint-disable-next-line no-constant-condition
while (true) {
const foundPath = runMatcher({...options, cwd: directory});
if (foundPath === stop) {
return;
}
if (foundPath) {
return path.resolve(directory, foundPath);
}
if (directory === root) {
return;
}
directory = path.dirname(directory);
}
};
module.exports.stop = stop;

View file

@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
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 rights 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.

View file

@ -0,0 +1,88 @@
{
"_args": [
[
"find-up@4.0.0",
"C:\\Users\\damccorm\\Documents\\setup-node"
]
],
"_development": true,
"_from": "find-up@4.0.0",
"_id": "find-up@4.0.0",
"_inBundle": false,
"_integrity": "sha512-zoH7ZWPkRdgwYCDVoQTzqjG8JSPANhtvLhh4KVUHyKnaUJJrNeFmWIkTcNuJmR3GLMEmGYEf2S2bjgx26JTF+Q==",
"_location": "/husky/pkg-dir/find-up",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "find-up@4.0.0",
"name": "find-up",
"escapedName": "find-up",
"rawSpec": "4.0.0",
"saveSpec": null,
"fetchSpec": "4.0.0"
},
"_requiredBy": [
"/husky/pkg-dir"
],
"_resolved": "https://registry.npmjs.org/find-up/-/find-up-4.0.0.tgz",
"_spec": "4.0.0",
"_where": "C:\\Users\\damccorm\\Documents\\setup-node",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/find-up/issues"
},
"dependencies": {
"locate-path": "^5.0.0"
},
"description": "Find a file or directory by walking up parent directories",
"devDependencies": {
"ava": "^1.4.1",
"is-path-inside": "^2.1.0",
"tempy": "^0.3.0",
"tsd": "^0.7.3",
"xo": "^0.24.0"
},
"engines": {
"node": ">=8"
},
"files": [
"index.js",
"index.d.ts"
],
"homepage": "https://github.com/sindresorhus/find-up#readme",
"keywords": [
"find",
"up",
"find-up",
"findup",
"look-up",
"look",
"file",
"search",
"match",
"package",
"resolve",
"parent",
"parents",
"folder",
"directory",
"walk",
"walking",
"path"
],
"license": "MIT",
"name": "find-up",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/find-up.git"
},
"scripts": {
"test": "xo && ava && tsd"
},
"version": "4.0.0"
}

View file

@ -0,0 +1,154 @@
# find-up [![Build Status](https://travis-ci.org/sindresorhus/find-up.svg?branch=master)](https://travis-ci.org/sindresorhus/find-up)
> Find a file or directory by walking up parent directories
---
<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-find-up?utm_source=npm-find-up&utm_medium=referral&utm_campaign=readme">Get professional support for 'find-up' with a Tidelift subscription</a>
</b>
<br>
<sub>
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
</sub>
</div>
---
## Install
```
$ npm install find-up
```
## Usage
```
/
└── Users
└── sindresorhus
├── unicorn.png
└── foo
└── bar
├── baz
└── example.js
```
`example.js`
```js
const fs = require('fs');
const path = require('path');
const findUp = require('find-up');
(async () => {
console.log(await findUp('unicorn.png'));
//=> '/Users/sindresorhus/unicorn.png'
console.log(await findUp(['rainbow.png', 'unicorn.png']));
//=> '/Users/sindresorhus/unicorn.png'
const pathExists = filePath => fs.promises.access(filePath).then(_ => true).catch(_ => false);
console.log(await findUp(async directory => {
const hasUnicorns = await pathExists(path.join(directory, 'unicorn.png'));
return hasUnicorns && directory;
}}, {type: 'directory'});
//=> '/Users/sindresorhus'
})();
```
## API
### findUp(name, [options])
### findUp(matcher, [options])
Returns a `Promise` for either the path or `undefined` if it couldn't be found.
### findUp([nameA, nameB], [options])
Returns a `Promise` for either the first path found (by respecting the order) or `undefined` if none could be found.
### findUp.sync(name, [options])
### findUp.sync(matcher, [options])
Returns a path or `undefined` if it couldn't be found.
### findUp.sync([nameA, nameB], [options])
Returns the first path found (by respecting the order) or `undefined` if none could be found.
#### name
Type: `string`
Name of the file or directory to find.
#### matcher
Type: `Function`
A function that will be called with each directory until it returns a `string` with the path, which stops the search, or the root directory has been reached and nothing was found. Useful if you want to match files with certain patterns, set of permissions, or other advanced use cases.
When using async mode, the `matcher` may optionally be an async or promise-returning function that returns the path.
#### options
Type: `object`
##### cwd
Type: `string`<br>
Default: `process.cwd()`
Directory to start from.
##### type
Type: `string`<br>
Default: `file`<br>
Values: `file` `directory`
The type of paths that can match.
##### allowSymlinks
Type: `boolean`<br>
Default: `true`
Allow symbolic links to match if they point to the chosen path type.
### findUp.stop
A [`Symbol`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol) that can be returned by a `matcher` function to stop the search and cause `findUp` to immediately return `undefined`. Useful as a performance optimization in case the current working directory is deeply nested in the filesystem.
```js
const path = require('path');
const findUp = require('find-up');
(async () => {
await findUp(directory => {
return path.basename(directory) === 'work' ? findUp.stop : 'logo.png';
});
})();
```
## Security
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
## Related
- [find-up-cli](https://github.com/sindresorhus/find-up-cli) - CLI for this module
- [pkg-up](https://github.com/sindresorhus/pkg-up) - Find the closest package.json file
- [pkg-dir](https://github.com/sindresorhus/pkg-dir) - Find the root directory of an npm package
- [resolve-from](https://github.com/sindresorhus/resolve-from) - Resolve the path of a module like `require.resolve()` but from a given path
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)

94
node_modules/husky/node_modules/pkg-dir/package.json generated vendored Normal file
View file

@ -0,0 +1,94 @@
{
"_args": [
[
"pkg-dir@4.2.0",
"C:\\Users\\damccorm\\Documents\\setup-node"
]
],
"_development": true,
"_from": "pkg-dir@4.2.0",
"_id": "pkg-dir@4.2.0",
"_inBundle": false,
"_integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==",
"_location": "/husky/pkg-dir",
"_phantomChildren": {
"locate-path": "5.0.0"
},
"_requested": {
"type": "version",
"registry": true,
"raw": "pkg-dir@4.2.0",
"name": "pkg-dir",
"escapedName": "pkg-dir",
"rawSpec": "4.2.0",
"saveSpec": null,
"fetchSpec": "4.2.0"
},
"_requiredBy": [
"/husky"
],
"_resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz",
"_spec": "4.2.0",
"_where": "C:\\Users\\damccorm\\Documents\\setup-node",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/pkg-dir/issues"
},
"dependencies": {
"find-up": "^4.0.0"
},
"description": "Find the root directory of a Node.js project or npm package",
"devDependencies": {
"ava": "^1.4.1",
"tempy": "^0.3.0",
"tsd": "^0.7.2",
"xo": "^0.24.0"
},
"engines": {
"node": ">=8"
},
"files": [
"index.js",
"index.d.ts"
],
"homepage": "https://github.com/sindresorhus/pkg-dir#readme",
"keywords": [
"package",
"json",
"root",
"npm",
"entry",
"find",
"up",
"find-up",
"findup",
"look-up",
"look",
"file",
"search",
"match",
"resolve",
"parent",
"parents",
"folder",
"directory",
"dir",
"walk",
"walking",
"path"
],
"license": "MIT",
"name": "pkg-dir",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/pkg-dir.git"
},
"scripts": {
"test": "xo && ava && tsd"
},
"version": "4.2.0"
}

66
node_modules/husky/node_modules/pkg-dir/readme.md generated vendored Normal file
View file

@ -0,0 +1,66 @@
# pkg-dir [![Build Status](https://travis-ci.org/sindresorhus/pkg-dir.svg?branch=master)](https://travis-ci.org/sindresorhus/pkg-dir)
> Find the root directory of a Node.js project or npm package
## Install
```
$ npm install pkg-dir
```
## Usage
```
/
└── Users
└── sindresorhus
└── foo
├── package.json
└── bar
├── baz
└── example.js
```
```js
// example.js
const pkgDir = require('pkg-dir');
(async () => {
const rootDir = await pkgDir(__dirname);
console.log(rootDir);
//=> '/Users/sindresorhus/foo'
})();
```
## API
### pkgDir([cwd])
Returns a `Promise` for either the project root path or `undefined` if it couldn't be found.
### pkgDir.sync([cwd])
Returns the project root path or `undefined` if it couldn't be found.
#### cwd
Type: `string`<br>
Default: `process.cwd()`
Directory to start from.
## Related
- [pkg-dir-cli](https://github.com/sindresorhus/pkg-dir-cli) - CLI for this module
- [pkg-up](https://github.com/sindresorhus/pkg-up) - Find the closest package.json file
- [find-up](https://github.com/sindresorhus/find-up) - Find a file by walking up parent directories
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)

67
node_modules/husky/node_modules/read-pkg/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,67 @@
import * as typeFest from 'type-fest';
import normalize = require('normalize-package-data');
declare namespace readPkg {
interface Options {
/**
[Normalize](https://github.com/npm/normalize-package-data#what-normalization-currently-entails) the package data.
@default true
*/
readonly normalize?: boolean;
/**
Current working directory.
@default process.cwd()
*/
readonly cwd?: string;
}
interface NormalizeOptions extends Options {
readonly normalize?: true;
}
type NormalizedPackageJson = PackageJson & normalize.Package;
type PackageJson = typeFest.PackageJson;
}
declare const readPkg: {
/**
@returns The parsed JSON.
@example
```
import readPkg = require('read-pkg');
(async () => {
console.log(await readPkg());
//=> {name: 'read-pkg', …}
console.log(await readPkg({cwd: 'some-other-directory'});
//=> {name: 'unicorn', …}
})();
```
*/
(options?: readPkg.NormalizeOptions): Promise<readPkg.NormalizedPackageJson>;
(options: readPkg.Options): Promise<readPkg.PackageJson>;
/**
@returns The parsed JSON.
@example
```
import readPkg = require('read-pkg');
console.log(readPkg.sync());
//=> {name: 'read-pkg', …}
console.log(readPkg.sync({cwd: 'some-other-directory'});
//=> {name: 'unicorn', …}
```
*/
sync(options?: readPkg.NormalizeOptions): readPkg.NormalizedPackageJson;
sync(options: readPkg.Options): readPkg.PackageJson;
};
export = readPkg;

41
node_modules/husky/node_modules/read-pkg/index.js generated vendored Normal file
View file

@ -0,0 +1,41 @@
'use strict';
const {promisify} = require('util');
const fs = require('fs');
const path = require('path');
const parseJson = require('parse-json');
const readFileAsync = promisify(fs.readFile);
module.exports = async options => {
options = {
cwd: process.cwd(),
normalize: true,
...options
};
const filePath = path.resolve(options.cwd, 'package.json');
const json = parseJson(await readFileAsync(filePath, 'utf8'));
if (options.normalize) {
require('normalize-package-data')(json);
}
return json;
};
module.exports.sync = options => {
options = {
cwd: process.cwd(),
normalize: true,
...options
};
const filePath = path.resolve(options.cwd, 'package.json');
const json = parseJson(fs.readFileSync(filePath, 'utf8'));
if (options.normalize) {
require('normalize-package-data')(json);
}
return json;
};

9
node_modules/husky/node_modules/read-pkg/license generated vendored Normal file
View file

@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
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 rights 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.

85
node_modules/husky/node_modules/read-pkg/package.json generated vendored Normal file
View file

@ -0,0 +1,85 @@
{
"_args": [
[
"read-pkg@5.1.1",
"C:\\Users\\damccorm\\Documents\\setup-node"
]
],
"_development": true,
"_from": "read-pkg@5.1.1",
"_id": "read-pkg@5.1.1",
"_inBundle": false,
"_integrity": "sha512-dFcTLQi6BZ+aFUaICg7er+/usEoqFdQxiEBsEMNGoipenihtxxtdrQuBXvyANCEI8VuUIVYFgeHGx9sLLvim4w==",
"_location": "/husky/read-pkg",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "read-pkg@5.1.1",
"name": "read-pkg",
"escapedName": "read-pkg",
"rawSpec": "5.1.1",
"saveSpec": null,
"fetchSpec": "5.1.1"
},
"_requiredBy": [
"/husky"
],
"_resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.1.1.tgz",
"_spec": "5.1.1",
"_where": "C:\\Users\\damccorm\\Documents\\setup-node",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/read-pkg/issues"
},
"dependencies": {
"@types/normalize-package-data": "^2.4.0",
"normalize-package-data": "^2.5.0",
"parse-json": "^4.0.0",
"type-fest": "^0.4.1"
},
"description": "Read a package.json file",
"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
},
"engines": {
"node": ">=8"
},
"files": [
"index.js",
"index.d.ts"
],
"homepage": "https://github.com/sindresorhus/read-pkg#readme",
"keywords": [
"json",
"read",
"parse",
"file",
"fs",
"graceful",
"load",
"package",
"normalize"
],
"license": "MIT",
"name": "read-pkg",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/read-pkg.git"
},
"scripts": {
"test": "xo && ava && tsd"
},
"version": "5.1.1",
"xo": {
"ignores": [
"test/test.js"
]
}
}

73
node_modules/husky/node_modules/read-pkg/readme.md generated vendored Normal file
View file

@ -0,0 +1,73 @@
# read-pkg [![Build Status](https://travis-ci.org/sindresorhus/read-pkg.svg?branch=master)](https://travis-ci.org/sindresorhus/read-pkg)
> Read a package.json file
## Why
- [Gracefully handles filesystem issues](https://github.com/isaacs/node-graceful-fs)
- [Throws more helpful JSON errors](https://github.com/sindresorhus/parse-json)
- [Normalizes the data](https://github.com/npm/normalize-package-data#what-normalization-currently-entails)
## Install
```
$ npm install read-pkg
```
## Usage
```js
const readPkg = require('read-pkg');
(async () => {
console.log(await readPkg());
//=> {name: 'read-pkg', …}
console.log(await readPkg({cwd: 'some-other-directory'});
//=> {name: 'unicorn', …}
})();
```
## API
### readPkg([options])
Returns a `Promise<object>` with the parsed JSON.
### readPkg.sync([options])
Returns the parsed JSON.
#### options
Type: `object`
##### cwd
Type: `string`<br>
Default: `process.cwd()`
Current working directory.
##### normalize
Type: `boolean`<br>
Default: `true`
[Normalize](https://github.com/npm/normalize-package-data#what-normalization-currently-entails) the package data.
## Related
- [read-pkg-up](https://github.com/sindresorhus/read-pkg-up) - Read the closest package.json file
- [write-pkg](https://github.com/sindresorhus/write-pkg) - Write a `package.json` file
- [load-json-file](https://github.com/sindresorhus/load-json-file) - Read and parse a JSON file
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)

25
node_modules/husky/node_modules/slash/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,25 @@
/**
Convert Windows backslash paths to slash paths: `foo\\bar` `foo/bar`.
[Forward-slash paths can be used in Windows](http://superuser.com/a/176395/6877) as long as they're not extended-length paths and don't contain any non-ascii characters.
@param path - A Windows backslash path.
@returns A path with forward slashes.
@example
```
import * as path from 'path';
import slash = require('slash');
const string = path.join('foo', 'bar');
// Unix => foo/bar
// Windows => foo\\bar
slash(string);
// Unix => foo/bar
// Windows => foo/bar
```
*/
declare function slash(path: string): string;
export = slash;

11
node_modules/husky/node_modules/slash/index.js generated vendored Normal file
View file

@ -0,0 +1,11 @@
'use strict';
module.exports = path => {
const isExtendedLengthPath = /^\\\\\?\\/.test(path);
const hasNonAscii = /[^\u0000-\u0080]+/.test(path); // eslint-disable-line no-control-regex
if (isExtendedLengthPath || hasNonAscii) {
return path;
}
return path.replace(/\\/g, '/');
};

9
node_modules/husky/node_modules/slash/license generated vendored Normal file
View file

@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
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 rights 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.

71
node_modules/husky/node_modules/slash/package.json generated vendored Normal file
View file

@ -0,0 +1,71 @@
{
"_args": [
[
"slash@3.0.0",
"C:\\Users\\damccorm\\Documents\\setup-node"
]
],
"_development": true,
"_from": "slash@3.0.0",
"_id": "slash@3.0.0",
"_inBundle": false,
"_integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==",
"_location": "/husky/slash",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "slash@3.0.0",
"name": "slash",
"escapedName": "slash",
"rawSpec": "3.0.0",
"saveSpec": null,
"fetchSpec": "3.0.0"
},
"_requiredBy": [
"/husky"
],
"_resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
"_spec": "3.0.0",
"_where": "C:\\Users\\damccorm\\Documents\\setup-node",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/slash/issues"
},
"description": "Convert Windows backslash paths to slash paths",
"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
},
"engines": {
"node": ">=8"
},
"files": [
"index.js",
"index.d.ts"
],
"homepage": "https://github.com/sindresorhus/slash#readme",
"keywords": [
"path",
"seperator",
"slash",
"backslash",
"windows",
"convert"
],
"license": "MIT",
"name": "slash",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/slash.git"
},
"scripts": {
"test": "xo && ava && tsd"
},
"version": "3.0.0"
}

44
node_modules/husky/node_modules/slash/readme.md generated vendored Normal file
View file

@ -0,0 +1,44 @@
# slash [![Build Status](https://travis-ci.org/sindresorhus/slash.svg?branch=master)](https://travis-ci.org/sindresorhus/slash)
> Convert Windows backslash paths to slash paths: `foo\\bar``foo/bar`
[Forward-slash paths can be used in Windows](http://superuser.com/a/176395/6877) as long as they're not extended-length paths and don't contain any non-ascii characters.
This was created since the `path` methods in Node.js outputs `\\` paths on Windows.
## Install
```
$ npm install slash
```
## Usage
```js
const path = require('path');
const slash = require('slash');
const string = path.join('foo', 'bar');
// Unix => foo/bar
// Windows => foo\\bar
slash(string);
// Unix => foo/bar
// Windows => foo/bar
```
## API
### slash(path)
Type: `string`
Accepts a Windows backslash path and returns a path with forward slashes.
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)

139
node_modules/husky/package.json generated vendored Normal file
View file

@ -0,0 +1,139 @@
{
"_args": [
[
"husky@2.3.0",
"C:\\Users\\damccorm\\Documents\\setup-node"
]
],
"_development": true,
"_from": "husky@2.3.0",
"_id": "husky@2.3.0",
"_inBundle": false,
"_integrity": "sha512-A/ZQSEILoq+mQM3yC3RIBSaw1bYXdkKnyyKVSUiJl+iBjVZc5LQEXdGY1ZjrDxC4IzfRPiJ0IqzEQGCN5TQa/A==",
"_location": "/husky",
"_phantomChildren": {
"@types/normalize-package-data": "2.4.0",
"normalize-package-data": "2.5.0",
"p-limit": "2.2.0",
"parse-json": "4.0.0",
"type-fest": "0.4.1"
},
"_requested": {
"type": "version",
"registry": true,
"raw": "husky@2.3.0",
"name": "husky",
"escapedName": "husky",
"rawSpec": "2.3.0",
"saveSpec": null,
"fetchSpec": "2.3.0"
},
"_requiredBy": [
"#DEV:/"
],
"_resolved": "https://registry.npmjs.org/husky/-/husky-2.3.0.tgz",
"_spec": "2.3.0",
"_where": "C:\\Users\\damccorm\\Documents\\setup-node",
"author": {
"name": "Typicode",
"email": "typicode@gmail.com"
},
"bin": {
"husky-upgrade": "./lib/upgrader/bin.js"
},
"bugs": {
"url": "https://github.com/typicode/husky/issues"
},
"dependencies": {
"cosmiconfig": "^5.2.0",
"execa": "^1.0.0",
"find-up": "^3.0.0",
"get-stdin": "^7.0.0",
"is-ci": "^2.0.0",
"pkg-dir": "^4.1.0",
"please-upgrade-node": "^3.1.1",
"read-pkg": "^5.1.1",
"run-node": "^1.0.0",
"slash": "^3.0.0"
},
"description": "Prevents bad commit or push (git hooks, pre-commit/precommit, pre-push/prepush, post-merge/postmerge and all that stuff...)",
"devDependencies": {
"@types/cosmiconfig": "^5.0.3",
"@types/find-up": "^2.1.1",
"@types/jest": "^24.0.13",
"@types/mkdirp": "^0.5.2",
"@types/node": "^12.0.1",
"@types/read-pkg": "^4.0.0",
"@typescript-eslint/eslint-plugin": "^1.9.0",
"@typescript-eslint/parser": "^1.9.0",
"del": "^4.1.1",
"del-cli": "^1.1.0",
"eslint": "^5.16.0",
"eslint-config-prettier": "^4.2.0",
"eslint-config-xo-space": "^0.21.0",
"eslint-plugin-prettier": "^3.1.0",
"formatree": "^1.0.2",
"jest": "^24.8.0",
"mkdirp": "^0.5.1",
"pinst": "^1.1.1",
"pkg-ok": "^2.3.1",
"prettier": "^1.17.1",
"tempy": "^0.3.0",
"ts-jest": "^24.0.2",
"typescript": "^3.4.5"
},
"engines": {
"node": ">=8"
},
"homepage": "https://github.com/typicode/husky#readme",
"jest": {
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
]
},
"keywords": [
"git",
"hook",
"hooks",
"pre-commit",
"precommit",
"post-commit",
"postcommit",
"pre-push",
"prepush",
"post-merge",
"postmerge",
"test",
"lint"
],
"license": "MIT",
"name": "husky",
"repository": {
"type": "git",
"url": "git+https://github.com/typicode/husky.git"
},
"scripts": {
"build": "del-cli lib && tsc",
"devinstall": "npm run build && npm run _install -- node_modules/husky && node scripts/dev-fix-path",
"devuninstall": "npm run build && npm run preuninstall -- node_modules/husky",
"fix": "npm run lint -- --fix",
"install": "node husky install",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx --ignore-path .gitignore",
"postpublish": "pinst --disable",
"postversion": "git push && git push --tags",
"prepublishOnly": "npm run test && npm run build && pinst --enable && pkg-ok",
"preuninstall": "node husky uninstall",
"test": "npm run lint && jest",
"version": "jest -u && git add -A src/installer/__tests__/__snapshots__"
},
"version": "2.3.0"
}

13
node_modules/husky/run.js generated vendored Normal file
View file

@ -0,0 +1,13 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const pleaseUpgradeNode = require('please-upgrade-node')
const pkg = require('./package.json')
// Node version isn't supported, skip
pleaseUpgradeNode(pkg, {
message(requiredVersion) {
return 'Husky requires Node ' + requiredVersion + ", can't run Git hook."
}
})
// Node version is supported, continue
require('./lib/runner/bin')