parent
949ce5e5a6
commit
1af857c6a9
18
CHANGELOG.md
18
CHANGELOG.md
|
|
@ -1,3 +1,12 @@
|
||||||
|
## [3.9.5](https://github.com/TriPSs/conventional-changelog-action/compare/v3.9.4...v3.9.5) (2021-10-05)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Retry again with the node_modules ([949ce5e](https://github.com/TriPSs/conventional-changelog-action/commit/949ce5e5a6447f5232585b381468821acbf713f2))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [3.9.4](https://github.com/TriPSs/conventional-changelog-action/compare/v3.9.3...v3.9.4) (2021-10-05)
|
## [3.9.4](https://github.com/TriPSs/conventional-changelog-action/compare/v3.9.3...v3.9.4) (2021-10-05)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -34,12 +43,3 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [3.9.0](https://github.com/TriPSs/conventional-changelog-action/compare/v3.8.0...v3.9.0) (2021-10-05)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* Added `git-push` option to skip pushing git changes ([9b90fb3](https://github.com/TriPSs/conventional-changelog-action/commit/9b90fb3eeafcfac330320d99235c4462cd7c7614))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,7 @@
|
||||||
*{{#if scope}} **{{scope}}:**
|
* {{header}}
|
||||||
{{~/if}} {{#if subject}}
|
|
||||||
{{~subject}}
|
|
||||||
{{~else}}
|
|
||||||
{{~header}}
|
|
||||||
{{~/if}}
|
|
||||||
|
|
||||||
{{~!-- commit link --}} {{#if @root.linkReferences~}}
|
{{~!-- commit link --}} {{#if @root.linkReferences~}}
|
||||||
([{{shortHash}}](
|
([{{hash}}](
|
||||||
{{~#if @root.repository}}
|
{{~#if @root.repository}}
|
||||||
{{~#if @root.host}}
|
{{~#if @root.host}}
|
||||||
{{~@root.host}}/
|
{{~@root.host}}/
|
||||||
|
|
@ -20,7 +15,7 @@
|
||||||
{{~/if}}/
|
{{~/if}}/
|
||||||
{{~@root.commit}}/{{hash}}))
|
{{~@root.commit}}/{{hash}}))
|
||||||
{{~else}}
|
{{~else}}
|
||||||
{{~shortHash}}
|
{{~hash}}
|
||||||
{{~/if}}
|
{{~/if}}
|
||||||
|
|
||||||
{{~!-- commit references --}}
|
{{~!-- commit references --}}
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,7 @@
|
||||||
### {{title}}
|
### {{title}}
|
||||||
|
|
||||||
{{#each notes}}
|
{{#each notes}}
|
||||||
* {{#if commit.scope}}**{{commit.scope}}:** {{/if}}{{text}}
|
* {{text}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
||||||
|
|
@ -1,25 +1,9 @@
|
||||||
{{#if isPatch~}}
|
## {{#if isPatch~}} <small>
|
||||||
##
|
{{~/if~}} {{version}}
|
||||||
{{~else~}}
|
{{~#if title}} "{{title}}"
|
||||||
#
|
|
||||||
{{~/if}} {{#if @root.linkCompare~}}
|
|
||||||
[{{version}}](
|
|
||||||
{{~#if @root.repository~}}
|
|
||||||
{{~#if @root.host}}
|
|
||||||
{{~@root.host}}/
|
|
||||||
{{~/if}}
|
|
||||||
{{~#if @root.owner}}
|
|
||||||
{{~@root.owner}}/
|
|
||||||
{{~/if}}
|
|
||||||
{{~@root.repository}}
|
|
||||||
{{~else}}
|
|
||||||
{{~@root.repoUrl}}
|
|
||||||
{{~/if~}}
|
{{~/if~}}
|
||||||
/compare/{{previousTag}}...{{currentTag}})
|
{{~#if date}} ({{date}})
|
||||||
{{~else}}
|
{{~/if~}}
|
||||||
{{~version}}
|
{{~#if isPatch~}} </small>
|
||||||
{{~/if}}
|
{{~/if}}
|
||||||
{{~#if title}} "{{title}}"
|
|
||||||
{{~/if}}
|
|
||||||
{{~#if date}} ({{date}})
|
|
||||||
{{/if}}
|
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -1,16 +1,11 @@
|
||||||
{{> header}}
|
{{> header}}
|
||||||
|
|
||||||
{{#each commitGroups}}
|
{{#each commitGroups}}
|
||||||
|
|
||||||
{{#if title}}
|
|
||||||
### {{title}}
|
|
||||||
|
|
||||||
{{/if}}
|
|
||||||
{{#each commits}}
|
{{#each commits}}
|
||||||
{{> commit root=@root}}
|
{{> commit root=@root}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
||||||
{{> footer}}
|
{{> footer}}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
../JSONStream/bin.js
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
../@commitlint/cli/cli.js
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
../conventional-changelog-writer/cli.js
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
../conventional-commits-parser/cli.js
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
../conventional-recommended-bump/cli.js
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
../get-pkg-repo/src/cli.js
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
../git-raw-commits/cli.js
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
../git-semver-tags/cli.js
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
../handlebars/bin/handlebars
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
../husky/bin/run.js
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
../husky/lib/upgrader/bin.js
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
../@vercel/ncc/dist/ncc/cli.js
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
../which/bin/node-which
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
../opencollective-postinstall/index.js
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
../semver/bin/semver.js
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
../ts-node/dist/bin.js
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
../ts-node/dist/bin-script.js
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
../ts-node/dist/bin-transpile.js
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
../ts-node/dist/bin-script-deprecated.js
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
../uglify-js/bin/uglifyjs
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright 2019 GitHub
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
@ -0,0 +1,312 @@
|
||||||
|
# `@actions/core`
|
||||||
|
|
||||||
|
> Core functions for setting results, logging, registering secrets and exporting variables across actions
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### Import the package
|
||||||
|
|
||||||
|
```js
|
||||||
|
// javascript
|
||||||
|
const core = require('@actions/core');
|
||||||
|
|
||||||
|
// typescript
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Inputs/Outputs
|
||||||
|
|
||||||
|
Action inputs can be read with `getInput` which returns a `string` or `getBooleanInput` which parses a boolean based on the [yaml 1.2 specification](https://yaml.org/spec/1.2/spec.html#id2804923). If `required` set to be false, the input should have a default value in `action.yml`.
|
||||||
|
|
||||||
|
Outputs can be set with `setOutput` which makes them available to be mapped into inputs of other actions to ensure they are decoupled.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const myInput = core.getInput('inputName', { required: true });
|
||||||
|
const myBooleanInput = core.getBooleanInput('booleanInputName', { required: true });
|
||||||
|
const myMultilineInput = core.getMultilineInput('multilineInputName', { required: true });
|
||||||
|
core.setOutput('outputKey', 'outputVal');
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Exporting variables
|
||||||
|
|
||||||
|
Since each step runs in a separate process, you can use `exportVariable` to add it to this step and future steps environment blocks.
|
||||||
|
|
||||||
|
```js
|
||||||
|
core.exportVariable('envVar', 'Val');
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Setting a secret
|
||||||
|
|
||||||
|
Setting a secret registers the secret with the runner to ensure it is masked in logs.
|
||||||
|
|
||||||
|
```js
|
||||||
|
core.setSecret('myPassword');
|
||||||
|
```
|
||||||
|
|
||||||
|
#### PATH Manipulation
|
||||||
|
|
||||||
|
To make a tool's path available in the path for the remainder of the job (without altering the machine or containers state), use `addPath`. The runner will prepend the path given to the jobs PATH.
|
||||||
|
|
||||||
|
```js
|
||||||
|
core.addPath('/path/to/mytool');
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Exit codes
|
||||||
|
|
||||||
|
You should use this library to set the failing exit code for your action. If status is not set and the script runs to completion, that will lead to a success.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const core = require('@actions/core');
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Do stuff
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
// setFailed logs the message and sets a failing exit code
|
||||||
|
core.setFailed(`Action failed with error ${err}`);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that `setNeutral` is not yet implemented in actions V2 but equivalent functionality is being planned.
|
||||||
|
|
||||||
|
#### Logging
|
||||||
|
|
||||||
|
Finally, this library provides some utilities for logging. Note that debug logging is hidden from the logs by default. This behavior can be toggled by enabling the [Step Debug Logs](../../docs/action-debugging.md#step-debug-logs).
|
||||||
|
|
||||||
|
```js
|
||||||
|
const core = require('@actions/core');
|
||||||
|
|
||||||
|
const myInput = core.getInput('input');
|
||||||
|
try {
|
||||||
|
core.debug('Inside try block');
|
||||||
|
|
||||||
|
if (!myInput) {
|
||||||
|
core.warning('myInput was not set');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (core.isDebug()) {
|
||||||
|
// curl -v https://github.com
|
||||||
|
} else {
|
||||||
|
// curl https://github.com
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do stuff
|
||||||
|
core.info('Output to the actions build log')
|
||||||
|
|
||||||
|
core.notice('This is a message that will also emit an annotation')
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
core.error(`Error ${err}, action may still succeed though`);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
This library can also wrap chunks of output in foldable groups.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const core = require('@actions/core')
|
||||||
|
|
||||||
|
// Manually wrap output
|
||||||
|
core.startGroup('Do some function')
|
||||||
|
doSomeFunction()
|
||||||
|
core.endGroup()
|
||||||
|
|
||||||
|
// Wrap an asynchronous function call
|
||||||
|
const result = await core.group('Do something async', async () => {
|
||||||
|
const response = await doSomeHTTPRequest()
|
||||||
|
return response
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Annotations
|
||||||
|
|
||||||
|
This library has 3 methods that will produce [annotations](https://docs.github.com/en/rest/reference/checks#create-a-check-run).
|
||||||
|
```js
|
||||||
|
core.error('This is a bad error. This will also fail the build.')
|
||||||
|
|
||||||
|
core.warning('Something went wrong, but it\'s not bad enough to fail the build.')
|
||||||
|
|
||||||
|
core.notice('Something happened that you might want to know about.')
|
||||||
|
```
|
||||||
|
|
||||||
|
These will surface to the UI in the Actions page and on Pull Requests. They look something like this:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
These annotations can also be attached to particular lines and columns of your source files to show exactly where a problem is occuring.
|
||||||
|
|
||||||
|
These options are:
|
||||||
|
```typescript
|
||||||
|
export interface AnnotationProperties {
|
||||||
|
/**
|
||||||
|
* A title for the annotation.
|
||||||
|
*/
|
||||||
|
title?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the file for which the annotation should be created.
|
||||||
|
*/
|
||||||
|
file?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The start line for the annotation.
|
||||||
|
*/
|
||||||
|
startLine?: number
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The end line for the annotation. Defaults to `startLine` when `startLine` is provided.
|
||||||
|
*/
|
||||||
|
endLine?: number
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The start column for the annotation. Cannot be sent when `startLine` and `endLine` are different values.
|
||||||
|
*/
|
||||||
|
startColumn?: number
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The start column for the annotation. Cannot be sent when `startLine` and `endLine` are different values.
|
||||||
|
* Defaults to `startColumn` when `startColumn` is provided.
|
||||||
|
*/
|
||||||
|
endColumn?: number
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Styling output
|
||||||
|
|
||||||
|
Colored output is supported in the Action logs via standard [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code). 3/4 bit, 8 bit and 24 bit colors are all supported.
|
||||||
|
|
||||||
|
Foreground colors:
|
||||||
|
|
||||||
|
```js
|
||||||
|
// 3/4 bit
|
||||||
|
core.info('\u001b[35mThis foreground will be magenta')
|
||||||
|
|
||||||
|
// 8 bit
|
||||||
|
core.info('\u001b[38;5;6mThis foreground will be cyan')
|
||||||
|
|
||||||
|
// 24 bit
|
||||||
|
core.info('\u001b[38;2;255;0;0mThis foreground will be bright red')
|
||||||
|
```
|
||||||
|
|
||||||
|
Background colors:
|
||||||
|
|
||||||
|
```js
|
||||||
|
// 3/4 bit
|
||||||
|
core.info('\u001b[43mThis background will be yellow');
|
||||||
|
|
||||||
|
// 8 bit
|
||||||
|
core.info('\u001b[48;5;6mThis background will be cyan')
|
||||||
|
|
||||||
|
// 24 bit
|
||||||
|
core.info('\u001b[48;2;255;0;0mThis background will be bright red')
|
||||||
|
```
|
||||||
|
|
||||||
|
Special styles:
|
||||||
|
|
||||||
|
```js
|
||||||
|
core.info('\u001b[1mBold text')
|
||||||
|
core.info('\u001b[3mItalic text')
|
||||||
|
core.info('\u001b[4mUnderlined text')
|
||||||
|
```
|
||||||
|
|
||||||
|
ANSI escape codes can be combined with one another:
|
||||||
|
|
||||||
|
```js
|
||||||
|
core.info('\u001b[31;46mRed foreground with a cyan background and \u001b[1mbold text at the end');
|
||||||
|
```
|
||||||
|
|
||||||
|
> Note: Escape codes reset at the start of each line
|
||||||
|
|
||||||
|
```js
|
||||||
|
core.info('\u001b[35mThis foreground will be magenta')
|
||||||
|
core.info('This foreground will reset to the default')
|
||||||
|
```
|
||||||
|
|
||||||
|
Manually typing escape codes can be a little difficult, but you can use third party modules such as [ansi-styles](https://github.com/chalk/ansi-styles).
|
||||||
|
|
||||||
|
```js
|
||||||
|
const style = require('ansi-styles');
|
||||||
|
core.info(style.color.ansi16m.hex('#abcdef') + 'Hello world!')
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Action state
|
||||||
|
|
||||||
|
You can use this library to save state and get state for sharing information between a given wrapper action:
|
||||||
|
|
||||||
|
**action.yml**:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
name: 'Wrapper action sample'
|
||||||
|
inputs:
|
||||||
|
name:
|
||||||
|
default: 'GitHub'
|
||||||
|
runs:
|
||||||
|
using: 'node12'
|
||||||
|
main: 'main.js'
|
||||||
|
post: 'cleanup.js'
|
||||||
|
```
|
||||||
|
|
||||||
|
In action's `main.js`:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const core = require('@actions/core');
|
||||||
|
|
||||||
|
core.saveState("pidToKill", 12345);
|
||||||
|
```
|
||||||
|
|
||||||
|
In action's `cleanup.js`:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const core = require('@actions/core');
|
||||||
|
|
||||||
|
var pid = core.getState("pidToKill");
|
||||||
|
|
||||||
|
process.kill(pid);
|
||||||
|
```
|
||||||
|
|
||||||
|
#### OIDC Token
|
||||||
|
|
||||||
|
You can use these methods to interact with the GitHub OIDC provider and get a JWT ID token which would help to get access token from third party cloud providers.
|
||||||
|
|
||||||
|
**Method Name**: getIDToken()
|
||||||
|
|
||||||
|
**Inputs**
|
||||||
|
|
||||||
|
audience : optional
|
||||||
|
|
||||||
|
**Outputs**
|
||||||
|
|
||||||
|
A [JWT](https://jwt.io/) ID Token
|
||||||
|
|
||||||
|
In action's `main.ts`:
|
||||||
|
```js
|
||||||
|
const core = require('@actions/core');
|
||||||
|
async function getIDTokenAction(): Promise<void> {
|
||||||
|
|
||||||
|
const audience = core.getInput('audience', {required: false})
|
||||||
|
|
||||||
|
const id_token1 = await core.getIDToken() // ID Token with default audience
|
||||||
|
const id_token2 = await core.getIDToken(audience) // ID token with custom audience
|
||||||
|
|
||||||
|
// this id_token can be used to get access token from third party cloud providers
|
||||||
|
}
|
||||||
|
getIDTokenAction()
|
||||||
|
```
|
||||||
|
|
||||||
|
In action's `actions.yml`:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
name: 'GetIDToken'
|
||||||
|
description: 'Get ID token from Github OIDC provider'
|
||||||
|
inputs:
|
||||||
|
audience:
|
||||||
|
description: 'Audience for which the ID token is intended for'
|
||||||
|
required: false
|
||||||
|
outputs:
|
||||||
|
id_token1:
|
||||||
|
description: 'ID token obtained from OIDC provider'
|
||||||
|
id_token2:
|
||||||
|
description: 'ID token obtained from OIDC provider'
|
||||||
|
runs:
|
||||||
|
using: 'node12'
|
||||||
|
main: 'dist/index.js'
|
||||||
|
```
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
{
|
||||||
|
"name": "@actions/core",
|
||||||
|
"version": "1.6.0",
|
||||||
|
"description": "Actions core lib",
|
||||||
|
"keywords": [
|
||||||
|
"github",
|
||||||
|
"actions",
|
||||||
|
"core"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/actions/toolkit/tree/main/packages/core",
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "lib/core.js",
|
||||||
|
"types": "lib/core.d.ts",
|
||||||
|
"directories": {
|
||||||
|
"lib": "lib",
|
||||||
|
"test": "__tests__"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"lib",
|
||||||
|
"!.DS_Store"
|
||||||
|
],
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/actions/toolkit.git",
|
||||||
|
"directory": "packages/core"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"audit-moderate": "npm install && npm audit --json --audit-level=moderate > audit.json",
|
||||||
|
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||||
|
"tsc": "tsc"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/actions/toolkit/issues"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@actions/http-client": "^1.0.11"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^12.0.2"
|
||||||
|
}
|
||||||
|
|
||||||
|
,"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.6.0.tgz"
|
||||||
|
,"_integrity": "sha512-NB1UAZomZlCV/LmJqkLhNTqtKfFXJZAUPcfl/zqG7EfsQdeUJtaWO98SGbuQ3pydJ3fHl2CvI/51OKYlCYYcaw=="
|
||||||
|
,"_from": "@actions/core@1.6.0"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright 2019 GitHub
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
# `@actions/exec`
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
#### Basic
|
||||||
|
|
||||||
|
You can use this package to execute tools in a cross platform way:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const exec = require('@actions/exec');
|
||||||
|
|
||||||
|
await exec.exec('node index.js');
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Args
|
||||||
|
|
||||||
|
You can also pass in arg arrays:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const exec = require('@actions/exec');
|
||||||
|
|
||||||
|
await exec.exec('node', ['index.js', 'foo=bar']);
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Output/options
|
||||||
|
|
||||||
|
Capture output or specify [other options](https://github.com/actions/toolkit/blob/d9347d4ab99fd507c0b9104b2cf79fb44fcc827d/packages/exec/src/interfaces.ts#L5):
|
||||||
|
|
||||||
|
```js
|
||||||
|
const exec = require('@actions/exec');
|
||||||
|
|
||||||
|
let myOutput = '';
|
||||||
|
let myError = '';
|
||||||
|
|
||||||
|
const options = {};
|
||||||
|
options.listeners = {
|
||||||
|
stdout: (data: Buffer) => {
|
||||||
|
myOutput += data.toString();
|
||||||
|
},
|
||||||
|
stderr: (data: Buffer) => {
|
||||||
|
myError += data.toString();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
options.cwd = './lib';
|
||||||
|
|
||||||
|
await exec.exec('node', ['index.js', 'foo=bar'], options);
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Exec tools not in the PATH
|
||||||
|
|
||||||
|
You can specify the full path for tools not in the PATH:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const exec = require('@actions/exec');
|
||||||
|
|
||||||
|
await exec.exec('"/path/to/my-tool"', ['arg1']);
|
||||||
|
```
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
{
|
||||||
|
"name": "@actions/exec",
|
||||||
|
"version": "1.1.0",
|
||||||
|
"description": "Actions exec lib",
|
||||||
|
"keywords": [
|
||||||
|
"github",
|
||||||
|
"actions",
|
||||||
|
"exec"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/actions/toolkit/tree/main/packages/exec",
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "lib/exec.js",
|
||||||
|
"types": "lib/exec.d.ts",
|
||||||
|
"directories": {
|
||||||
|
"lib": "lib",
|
||||||
|
"test": "__tests__"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"lib",
|
||||||
|
"!.DS_Store"
|
||||||
|
],
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/actions/toolkit.git",
|
||||||
|
"directory": "packages/exec"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"audit-moderate": "npm install && npm audit --json --audit-level=moderate > audit.json",
|
||||||
|
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||||
|
"tsc": "tsc"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/actions/toolkit/issues"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@actions/io": "^1.0.1"
|
||||||
|
}
|
||||||
|
|
||||||
|
,"_resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.1.0.tgz"
|
||||||
|
,"_integrity": "sha512-LImpN9AY0J1R1mEYJjVJfSZWU4zYOlEcwSTgPve1rFQqK5AwrEs6uWW5Rv70gbDIQIAUwI86z6B+9mPK4w9Sbg=="
|
||||||
|
,"_from": "@actions/exec@1.1.0"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
Actions Http Client for Node.js
|
||||||
|
|
||||||
|
Copyright (c) GitHub, Inc.
|
||||||
|
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
@ -0,0 +1,79 @@
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img src="actions.png">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
# Actions Http-Client
|
||||||
|
|
||||||
|
[](https://github.com/actions/http-client/actions)
|
||||||
|
|
||||||
|
A lightweight HTTP client optimized for use with actions, TypeScript with generics and async await.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- HTTP client with TypeScript generics and async/await/Promises
|
||||||
|
- Typings included so no need to acquire separately (great for intellisense and no versioning drift)
|
||||||
|
- [Proxy support](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/about-self-hosted-runners#using-a-proxy-server-with-self-hosted-runners) just works with actions and the runner
|
||||||
|
- Targets ES2019 (runner runs actions with node 12+). Only supported on node 12+.
|
||||||
|
- Basic, Bearer and PAT Support out of the box. Extensible handlers for others.
|
||||||
|
- Redirects supported
|
||||||
|
|
||||||
|
Features and releases [here](./RELEASES.md)
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```
|
||||||
|
npm install @actions/http-client --save
|
||||||
|
```
|
||||||
|
|
||||||
|
## Samples
|
||||||
|
|
||||||
|
See the [HTTP](./__tests__) tests for detailed examples.
|
||||||
|
|
||||||
|
## Errors
|
||||||
|
|
||||||
|
### HTTP
|
||||||
|
|
||||||
|
The HTTP client does not throw unless truly exceptional.
|
||||||
|
|
||||||
|
* A request that successfully executes resulting in a 404, 500 etc... will return a response object with a status code and a body.
|
||||||
|
* Redirects (3xx) will be followed by default.
|
||||||
|
|
||||||
|
See [HTTP tests](./__tests__) for detailed examples.
|
||||||
|
|
||||||
|
## Debugging
|
||||||
|
|
||||||
|
To enable detailed console logging of all HTTP requests and responses, set the NODE_DEBUG environment varible:
|
||||||
|
|
||||||
|
```
|
||||||
|
export NODE_DEBUG=http
|
||||||
|
```
|
||||||
|
|
||||||
|
## Node support
|
||||||
|
|
||||||
|
The http-client is built using the latest LTS version of Node 12. It may work on previous node LTS versions but it's tested and officially supported on Node12+.
|
||||||
|
|
||||||
|
## Support and Versioning
|
||||||
|
|
||||||
|
We follow semver and will hold compatibility between major versions and increment the minor version with new features and capabilities (while holding compat).
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
We welcome PRs. Please create an issue and if applicable, a design before proceeding with code.
|
||||||
|
|
||||||
|
once:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
To build:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ npm run build
|
||||||
|
```
|
||||||
|
|
||||||
|
To run all tests:
|
||||||
|
```bash
|
||||||
|
$ npm test
|
||||||
|
```
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
## Releases
|
||||||
|
|
||||||
|
## 1.0.10
|
||||||
|
|
||||||
|
Contains a bug fix where proxy is defined without a user and password. see [PR here](https://github.com/actions/http-client/pull/42)
|
||||||
|
|
||||||
|
## 1.0.9
|
||||||
|
Throw HttpClientError instead of a generic Error from the \<verb>Json() helper methods when the server responds with a non-successful status code.
|
||||||
|
|
||||||
|
## 1.0.8
|
||||||
|
Fixed security issue where a redirect (e.g. 302) to another domain would pass headers. The fix was to strip the authorization header if the hostname was different. More [details in PR #27](https://github.com/actions/http-client/pull/27)
|
||||||
|
|
||||||
|
## 1.0.7
|
||||||
|
Update NPM dependencies and add 429 to the list of HttpCodes
|
||||||
|
|
||||||
|
## 1.0.6
|
||||||
|
Automatically sends Content-Type and Accept application/json headers for \<verb>Json() helper methods if not set in the client or parameters.
|
||||||
|
|
||||||
|
## 1.0.5
|
||||||
|
Adds \<verb>Json() helper methods for json over http scenarios.
|
||||||
|
|
||||||
|
## 1.0.4
|
||||||
|
Started to add \<verb>Json() helper methods. Do not use this release for that. Use >= 1.0.5 since there was an issue with types.
|
||||||
|
|
||||||
|
## 1.0.1 to 1.0.3
|
||||||
|
Adds proxy support.
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
|
|
@ -0,0 +1,23 @@
|
||||||
|
import ifm = require('./interfaces');
|
||||||
|
export declare class BasicCredentialHandler implements ifm.IRequestHandler {
|
||||||
|
username: string;
|
||||||
|
password: string;
|
||||||
|
constructor(username: string, password: string);
|
||||||
|
prepareRequest(options: any): void;
|
||||||
|
canHandleAuthentication(response: ifm.IHttpClientResponse): boolean;
|
||||||
|
handleAuthentication(httpClient: ifm.IHttpClient, requestInfo: ifm.IRequestInfo, objs: any): Promise<ifm.IHttpClientResponse>;
|
||||||
|
}
|
||||||
|
export declare class BearerCredentialHandler implements ifm.IRequestHandler {
|
||||||
|
token: string;
|
||||||
|
constructor(token: string);
|
||||||
|
prepareRequest(options: any): void;
|
||||||
|
canHandleAuthentication(response: ifm.IHttpClientResponse): boolean;
|
||||||
|
handleAuthentication(httpClient: ifm.IHttpClient, requestInfo: ifm.IRequestInfo, objs: any): Promise<ifm.IHttpClientResponse>;
|
||||||
|
}
|
||||||
|
export declare class PersonalAccessTokenCredentialHandler implements ifm.IRequestHandler {
|
||||||
|
token: string;
|
||||||
|
constructor(token: string);
|
||||||
|
prepareRequest(options: any): void;
|
||||||
|
canHandleAuthentication(response: ifm.IHttpClientResponse): boolean;
|
||||||
|
handleAuthentication(httpClient: ifm.IHttpClient, requestInfo: ifm.IRequestInfo, objs: any): Promise<ifm.IHttpClientResponse>;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
class BasicCredentialHandler {
|
||||||
|
constructor(username, password) {
|
||||||
|
this.username = username;
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
prepareRequest(options) {
|
||||||
|
options.headers['Authorization'] =
|
||||||
|
'Basic ' +
|
||||||
|
Buffer.from(this.username + ':' + this.password).toString('base64');
|
||||||
|
}
|
||||||
|
// This handler cannot handle 401
|
||||||
|
canHandleAuthentication(response) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
handleAuthentication(httpClient, requestInfo, objs) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.BasicCredentialHandler = BasicCredentialHandler;
|
||||||
|
class BearerCredentialHandler {
|
||||||
|
constructor(token) {
|
||||||
|
this.token = token;
|
||||||
|
}
|
||||||
|
// currently implements pre-authorization
|
||||||
|
// TODO: support preAuth = false where it hooks on 401
|
||||||
|
prepareRequest(options) {
|
||||||
|
options.headers['Authorization'] = 'Bearer ' + this.token;
|
||||||
|
}
|
||||||
|
// This handler cannot handle 401
|
||||||
|
canHandleAuthentication(response) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
handleAuthentication(httpClient, requestInfo, objs) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.BearerCredentialHandler = BearerCredentialHandler;
|
||||||
|
class PersonalAccessTokenCredentialHandler {
|
||||||
|
constructor(token) {
|
||||||
|
this.token = token;
|
||||||
|
}
|
||||||
|
// currently implements pre-authorization
|
||||||
|
// TODO: support preAuth = false where it hooks on 401
|
||||||
|
prepareRequest(options) {
|
||||||
|
options.headers['Authorization'] =
|
||||||
|
'Basic ' + Buffer.from('PAT:' + this.token).toString('base64');
|
||||||
|
}
|
||||||
|
// This handler cannot handle 401
|
||||||
|
canHandleAuthentication(response) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
handleAuthentication(httpClient, requestInfo, objs) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler;
|
||||||
|
|
@ -0,0 +1,124 @@
|
||||||
|
/// <reference types="node" />
|
||||||
|
import http = require('http');
|
||||||
|
import ifm = require('./interfaces');
|
||||||
|
export declare enum HttpCodes {
|
||||||
|
OK = 200,
|
||||||
|
MultipleChoices = 300,
|
||||||
|
MovedPermanently = 301,
|
||||||
|
ResourceMoved = 302,
|
||||||
|
SeeOther = 303,
|
||||||
|
NotModified = 304,
|
||||||
|
UseProxy = 305,
|
||||||
|
SwitchProxy = 306,
|
||||||
|
TemporaryRedirect = 307,
|
||||||
|
PermanentRedirect = 308,
|
||||||
|
BadRequest = 400,
|
||||||
|
Unauthorized = 401,
|
||||||
|
PaymentRequired = 402,
|
||||||
|
Forbidden = 403,
|
||||||
|
NotFound = 404,
|
||||||
|
MethodNotAllowed = 405,
|
||||||
|
NotAcceptable = 406,
|
||||||
|
ProxyAuthenticationRequired = 407,
|
||||||
|
RequestTimeout = 408,
|
||||||
|
Conflict = 409,
|
||||||
|
Gone = 410,
|
||||||
|
TooManyRequests = 429,
|
||||||
|
InternalServerError = 500,
|
||||||
|
NotImplemented = 501,
|
||||||
|
BadGateway = 502,
|
||||||
|
ServiceUnavailable = 503,
|
||||||
|
GatewayTimeout = 504
|
||||||
|
}
|
||||||
|
export declare enum Headers {
|
||||||
|
Accept = "accept",
|
||||||
|
ContentType = "content-type"
|
||||||
|
}
|
||||||
|
export declare enum MediaTypes {
|
||||||
|
ApplicationJson = "application/json"
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns the proxy URL, depending upon the supplied url and proxy environment variables.
|
||||||
|
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
||||||
|
*/
|
||||||
|
export declare function getProxyUrl(serverUrl: string): string;
|
||||||
|
export declare class HttpClientError extends Error {
|
||||||
|
constructor(message: string, statusCode: number);
|
||||||
|
statusCode: number;
|
||||||
|
result?: any;
|
||||||
|
}
|
||||||
|
export declare class HttpClientResponse implements ifm.IHttpClientResponse {
|
||||||
|
constructor(message: http.IncomingMessage);
|
||||||
|
message: http.IncomingMessage;
|
||||||
|
readBody(): Promise<string>;
|
||||||
|
}
|
||||||
|
export declare function isHttps(requestUrl: string): boolean;
|
||||||
|
export declare class HttpClient {
|
||||||
|
userAgent: string | undefined;
|
||||||
|
handlers: ifm.IRequestHandler[];
|
||||||
|
requestOptions: ifm.IRequestOptions;
|
||||||
|
private _ignoreSslError;
|
||||||
|
private _socketTimeout;
|
||||||
|
private _allowRedirects;
|
||||||
|
private _allowRedirectDowngrade;
|
||||||
|
private _maxRedirects;
|
||||||
|
private _allowRetries;
|
||||||
|
private _maxRetries;
|
||||||
|
private _agent;
|
||||||
|
private _proxyAgent;
|
||||||
|
private _keepAlive;
|
||||||
|
private _disposed;
|
||||||
|
constructor(userAgent?: string, handlers?: ifm.IRequestHandler[], requestOptions?: ifm.IRequestOptions);
|
||||||
|
options(requestUrl: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
||||||
|
get(requestUrl: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
||||||
|
del(requestUrl: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
||||||
|
post(requestUrl: string, data: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
||||||
|
patch(requestUrl: string, data: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
||||||
|
put(requestUrl: string, data: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
||||||
|
head(requestUrl: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
||||||
|
sendStream(verb: string, requestUrl: string, stream: NodeJS.ReadableStream, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
||||||
|
/**
|
||||||
|
* Gets a typed object from an endpoint
|
||||||
|
* Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise
|
||||||
|
*/
|
||||||
|
getJson<T>(requestUrl: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.ITypedResponse<T>>;
|
||||||
|
postJson<T>(requestUrl: string, obj: any, additionalHeaders?: ifm.IHeaders): Promise<ifm.ITypedResponse<T>>;
|
||||||
|
putJson<T>(requestUrl: string, obj: any, additionalHeaders?: ifm.IHeaders): Promise<ifm.ITypedResponse<T>>;
|
||||||
|
patchJson<T>(requestUrl: string, obj: any, additionalHeaders?: ifm.IHeaders): Promise<ifm.ITypedResponse<T>>;
|
||||||
|
/**
|
||||||
|
* Makes a raw http request.
|
||||||
|
* All other methods such as get, post, patch, and request ultimately call this.
|
||||||
|
* Prefer get, del, post and patch
|
||||||
|
*/
|
||||||
|
request(verb: string, requestUrl: string, data: string | NodeJS.ReadableStream, headers: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
||||||
|
/**
|
||||||
|
* Needs to be called if keepAlive is set to true in request options.
|
||||||
|
*/
|
||||||
|
dispose(): void;
|
||||||
|
/**
|
||||||
|
* Raw request.
|
||||||
|
* @param info
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
requestRaw(info: ifm.IRequestInfo, data: string | NodeJS.ReadableStream): Promise<ifm.IHttpClientResponse>;
|
||||||
|
/**
|
||||||
|
* Raw request with callback.
|
||||||
|
* @param info
|
||||||
|
* @param data
|
||||||
|
* @param onResult
|
||||||
|
*/
|
||||||
|
requestRawWithCallback(info: ifm.IRequestInfo, data: string | NodeJS.ReadableStream, onResult: (err: any, res: ifm.IHttpClientResponse) => void): void;
|
||||||
|
/**
|
||||||
|
* Gets an http agent. This function is useful when you need an http agent that handles
|
||||||
|
* routing through a proxy server - depending upon the url and proxy environment variables.
|
||||||
|
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
||||||
|
*/
|
||||||
|
getAgent(serverUrl: string): http.Agent;
|
||||||
|
private _prepareRequest;
|
||||||
|
private _mergeHeaders;
|
||||||
|
private _getExistingOrDefaultHeader;
|
||||||
|
private _getAgent;
|
||||||
|
private _performExponentialBackoff;
|
||||||
|
private static dateTimeDeserializer;
|
||||||
|
private _processResponse;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,537 @@
|
||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const http = require("http");
|
||||||
|
const https = require("https");
|
||||||
|
const pm = require("./proxy");
|
||||||
|
let tunnel;
|
||||||
|
var HttpCodes;
|
||||||
|
(function (HttpCodes) {
|
||||||
|
HttpCodes[HttpCodes["OK"] = 200] = "OK";
|
||||||
|
HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices";
|
||||||
|
HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently";
|
||||||
|
HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved";
|
||||||
|
HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther";
|
||||||
|
HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified";
|
||||||
|
HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy";
|
||||||
|
HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy";
|
||||||
|
HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect";
|
||||||
|
HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect";
|
||||||
|
HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest";
|
||||||
|
HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized";
|
||||||
|
HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired";
|
||||||
|
HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden";
|
||||||
|
HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound";
|
||||||
|
HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed";
|
||||||
|
HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable";
|
||||||
|
HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
|
||||||
|
HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout";
|
||||||
|
HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict";
|
||||||
|
HttpCodes[HttpCodes["Gone"] = 410] = "Gone";
|
||||||
|
HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests";
|
||||||
|
HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError";
|
||||||
|
HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented";
|
||||||
|
HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway";
|
||||||
|
HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable";
|
||||||
|
HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout";
|
||||||
|
})(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {}));
|
||||||
|
var Headers;
|
||||||
|
(function (Headers) {
|
||||||
|
Headers["Accept"] = "accept";
|
||||||
|
Headers["ContentType"] = "content-type";
|
||||||
|
})(Headers = exports.Headers || (exports.Headers = {}));
|
||||||
|
var MediaTypes;
|
||||||
|
(function (MediaTypes) {
|
||||||
|
MediaTypes["ApplicationJson"] = "application/json";
|
||||||
|
})(MediaTypes = exports.MediaTypes || (exports.MediaTypes = {}));
|
||||||
|
/**
|
||||||
|
* Returns the proxy URL, depending upon the supplied url and proxy environment variables.
|
||||||
|
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
||||||
|
*/
|
||||||
|
function getProxyUrl(serverUrl) {
|
||||||
|
let proxyUrl = pm.getProxyUrl(new URL(serverUrl));
|
||||||
|
return proxyUrl ? proxyUrl.href : '';
|
||||||
|
}
|
||||||
|
exports.getProxyUrl = getProxyUrl;
|
||||||
|
const HttpRedirectCodes = [
|
||||||
|
HttpCodes.MovedPermanently,
|
||||||
|
HttpCodes.ResourceMoved,
|
||||||
|
HttpCodes.SeeOther,
|
||||||
|
HttpCodes.TemporaryRedirect,
|
||||||
|
HttpCodes.PermanentRedirect
|
||||||
|
];
|
||||||
|
const HttpResponseRetryCodes = [
|
||||||
|
HttpCodes.BadGateway,
|
||||||
|
HttpCodes.ServiceUnavailable,
|
||||||
|
HttpCodes.GatewayTimeout
|
||||||
|
];
|
||||||
|
const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD'];
|
||||||
|
const ExponentialBackoffCeiling = 10;
|
||||||
|
const ExponentialBackoffTimeSlice = 5;
|
||||||
|
class HttpClientError extends Error {
|
||||||
|
constructor(message, statusCode) {
|
||||||
|
super(message);
|
||||||
|
this.name = 'HttpClientError';
|
||||||
|
this.statusCode = statusCode;
|
||||||
|
Object.setPrototypeOf(this, HttpClientError.prototype);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.HttpClientError = HttpClientError;
|
||||||
|
class HttpClientResponse {
|
||||||
|
constructor(message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
readBody() {
|
||||||
|
return new Promise(async (resolve, reject) => {
|
||||||
|
let output = Buffer.alloc(0);
|
||||||
|
this.message.on('data', (chunk) => {
|
||||||
|
output = Buffer.concat([output, chunk]);
|
||||||
|
});
|
||||||
|
this.message.on('end', () => {
|
||||||
|
resolve(output.toString());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.HttpClientResponse = HttpClientResponse;
|
||||||
|
function isHttps(requestUrl) {
|
||||||
|
let parsedUrl = new URL(requestUrl);
|
||||||
|
return parsedUrl.protocol === 'https:';
|
||||||
|
}
|
||||||
|
exports.isHttps = isHttps;
|
||||||
|
class HttpClient {
|
||||||
|
constructor(userAgent, handlers, requestOptions) {
|
||||||
|
this._ignoreSslError = false;
|
||||||
|
this._allowRedirects = true;
|
||||||
|
this._allowRedirectDowngrade = false;
|
||||||
|
this._maxRedirects = 50;
|
||||||
|
this._allowRetries = false;
|
||||||
|
this._maxRetries = 1;
|
||||||
|
this._keepAlive = false;
|
||||||
|
this._disposed = false;
|
||||||
|
this.userAgent = userAgent;
|
||||||
|
this.handlers = handlers || [];
|
||||||
|
this.requestOptions = requestOptions;
|
||||||
|
if (requestOptions) {
|
||||||
|
if (requestOptions.ignoreSslError != null) {
|
||||||
|
this._ignoreSslError = requestOptions.ignoreSslError;
|
||||||
|
}
|
||||||
|
this._socketTimeout = requestOptions.socketTimeout;
|
||||||
|
if (requestOptions.allowRedirects != null) {
|
||||||
|
this._allowRedirects = requestOptions.allowRedirects;
|
||||||
|
}
|
||||||
|
if (requestOptions.allowRedirectDowngrade != null) {
|
||||||
|
this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade;
|
||||||
|
}
|
||||||
|
if (requestOptions.maxRedirects != null) {
|
||||||
|
this._maxRedirects = Math.max(requestOptions.maxRedirects, 0);
|
||||||
|
}
|
||||||
|
if (requestOptions.keepAlive != null) {
|
||||||
|
this._keepAlive = requestOptions.keepAlive;
|
||||||
|
}
|
||||||
|
if (requestOptions.allowRetries != null) {
|
||||||
|
this._allowRetries = requestOptions.allowRetries;
|
||||||
|
}
|
||||||
|
if (requestOptions.maxRetries != null) {
|
||||||
|
this._maxRetries = requestOptions.maxRetries;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
options(requestUrl, additionalHeaders) {
|
||||||
|
return this.request('OPTIONS', requestUrl, null, additionalHeaders || {});
|
||||||
|
}
|
||||||
|
get(requestUrl, additionalHeaders) {
|
||||||
|
return this.request('GET', requestUrl, null, additionalHeaders || {});
|
||||||
|
}
|
||||||
|
del(requestUrl, additionalHeaders) {
|
||||||
|
return this.request('DELETE', requestUrl, null, additionalHeaders || {});
|
||||||
|
}
|
||||||
|
post(requestUrl, data, additionalHeaders) {
|
||||||
|
return this.request('POST', requestUrl, data, additionalHeaders || {});
|
||||||
|
}
|
||||||
|
patch(requestUrl, data, additionalHeaders) {
|
||||||
|
return this.request('PATCH', requestUrl, data, additionalHeaders || {});
|
||||||
|
}
|
||||||
|
put(requestUrl, data, additionalHeaders) {
|
||||||
|
return this.request('PUT', requestUrl, data, additionalHeaders || {});
|
||||||
|
}
|
||||||
|
head(requestUrl, additionalHeaders) {
|
||||||
|
return this.request('HEAD', requestUrl, null, additionalHeaders || {});
|
||||||
|
}
|
||||||
|
sendStream(verb, requestUrl, stream, additionalHeaders) {
|
||||||
|
return this.request(verb, requestUrl, stream, additionalHeaders);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Gets a typed object from an endpoint
|
||||||
|
* Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise
|
||||||
|
*/
|
||||||
|
async getJson(requestUrl, additionalHeaders = {}) {
|
||||||
|
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
||||||
|
let res = await this.get(requestUrl, additionalHeaders);
|
||||||
|
return this._processResponse(res, this.requestOptions);
|
||||||
|
}
|
||||||
|
async postJson(requestUrl, obj, additionalHeaders = {}) {
|
||||||
|
let data = JSON.stringify(obj, null, 2);
|
||||||
|
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
||||||
|
additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
|
||||||
|
let res = await this.post(requestUrl, data, additionalHeaders);
|
||||||
|
return this._processResponse(res, this.requestOptions);
|
||||||
|
}
|
||||||
|
async putJson(requestUrl, obj, additionalHeaders = {}) {
|
||||||
|
let data = JSON.stringify(obj, null, 2);
|
||||||
|
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
||||||
|
additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
|
||||||
|
let res = await this.put(requestUrl, data, additionalHeaders);
|
||||||
|
return this._processResponse(res, this.requestOptions);
|
||||||
|
}
|
||||||
|
async patchJson(requestUrl, obj, additionalHeaders = {}) {
|
||||||
|
let data = JSON.stringify(obj, null, 2);
|
||||||
|
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
||||||
|
additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
|
||||||
|
let res = await this.patch(requestUrl, data, additionalHeaders);
|
||||||
|
return this._processResponse(res, this.requestOptions);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Makes a raw http request.
|
||||||
|
* All other methods such as get, post, patch, and request ultimately call this.
|
||||||
|
* Prefer get, del, post and patch
|
||||||
|
*/
|
||||||
|
async request(verb, requestUrl, data, headers) {
|
||||||
|
if (this._disposed) {
|
||||||
|
throw new Error('Client has already been disposed.');
|
||||||
|
}
|
||||||
|
let parsedUrl = new URL(requestUrl);
|
||||||
|
let info = this._prepareRequest(verb, parsedUrl, headers);
|
||||||
|
// Only perform retries on reads since writes may not be idempotent.
|
||||||
|
let maxTries = this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1
|
||||||
|
? this._maxRetries + 1
|
||||||
|
: 1;
|
||||||
|
let numTries = 0;
|
||||||
|
let response;
|
||||||
|
while (numTries < maxTries) {
|
||||||
|
response = await this.requestRaw(info, data);
|
||||||
|
// Check if it's an authentication challenge
|
||||||
|
if (response &&
|
||||||
|
response.message &&
|
||||||
|
response.message.statusCode === HttpCodes.Unauthorized) {
|
||||||
|
let authenticationHandler;
|
||||||
|
for (let i = 0; i < this.handlers.length; i++) {
|
||||||
|
if (this.handlers[i].canHandleAuthentication(response)) {
|
||||||
|
authenticationHandler = this.handlers[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (authenticationHandler) {
|
||||||
|
return authenticationHandler.handleAuthentication(this, info, data);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// We have received an unauthorized response but have no handlers to handle it.
|
||||||
|
// Let the response return to the caller.
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let redirectsRemaining = this._maxRedirects;
|
||||||
|
while (HttpRedirectCodes.indexOf(response.message.statusCode) != -1 &&
|
||||||
|
this._allowRedirects &&
|
||||||
|
redirectsRemaining > 0) {
|
||||||
|
const redirectUrl = response.message.headers['location'];
|
||||||
|
if (!redirectUrl) {
|
||||||
|
// if there's no location to redirect to, we won't
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
let parsedRedirectUrl = new URL(redirectUrl);
|
||||||
|
if (parsedUrl.protocol == 'https:' &&
|
||||||
|
parsedUrl.protocol != parsedRedirectUrl.protocol &&
|
||||||
|
!this._allowRedirectDowngrade) {
|
||||||
|
throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');
|
||||||
|
}
|
||||||
|
// we need to finish reading the response before reassigning response
|
||||||
|
// which will leak the open socket.
|
||||||
|
await response.readBody();
|
||||||
|
// strip authorization header if redirected to a different hostname
|
||||||
|
if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {
|
||||||
|
for (let header in headers) {
|
||||||
|
// header names are case insensitive
|
||||||
|
if (header.toLowerCase() === 'authorization') {
|
||||||
|
delete headers[header];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// let's make the request with the new redirectUrl
|
||||||
|
info = this._prepareRequest(verb, parsedRedirectUrl, headers);
|
||||||
|
response = await this.requestRaw(info, data);
|
||||||
|
redirectsRemaining--;
|
||||||
|
}
|
||||||
|
if (HttpResponseRetryCodes.indexOf(response.message.statusCode) == -1) {
|
||||||
|
// If not a retry code, return immediately instead of retrying
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
numTries += 1;
|
||||||
|
if (numTries < maxTries) {
|
||||||
|
await response.readBody();
|
||||||
|
await this._performExponentialBackoff(numTries);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Needs to be called if keepAlive is set to true in request options.
|
||||||
|
*/
|
||||||
|
dispose() {
|
||||||
|
if (this._agent) {
|
||||||
|
this._agent.destroy();
|
||||||
|
}
|
||||||
|
this._disposed = true;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Raw request.
|
||||||
|
* @param info
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
requestRaw(info, data) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
let callbackForResult = function (err, res) {
|
||||||
|
if (err) {
|
||||||
|
reject(err);
|
||||||
|
}
|
||||||
|
resolve(res);
|
||||||
|
};
|
||||||
|
this.requestRawWithCallback(info, data, callbackForResult);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Raw request with callback.
|
||||||
|
* @param info
|
||||||
|
* @param data
|
||||||
|
* @param onResult
|
||||||
|
*/
|
||||||
|
requestRawWithCallback(info, data, onResult) {
|
||||||
|
let socket;
|
||||||
|
if (typeof data === 'string') {
|
||||||
|
info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8');
|
||||||
|
}
|
||||||
|
let callbackCalled = false;
|
||||||
|
let handleResult = (err, res) => {
|
||||||
|
if (!callbackCalled) {
|
||||||
|
callbackCalled = true;
|
||||||
|
onResult(err, res);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let req = info.httpModule.request(info.options, (msg) => {
|
||||||
|
let res = new HttpClientResponse(msg);
|
||||||
|
handleResult(null, res);
|
||||||
|
});
|
||||||
|
req.on('socket', sock => {
|
||||||
|
socket = sock;
|
||||||
|
});
|
||||||
|
// If we ever get disconnected, we want the socket to timeout eventually
|
||||||
|
req.setTimeout(this._socketTimeout || 3 * 60000, () => {
|
||||||
|
if (socket) {
|
||||||
|
socket.end();
|
||||||
|
}
|
||||||
|
handleResult(new Error('Request timeout: ' + info.options.path), null);
|
||||||
|
});
|
||||||
|
req.on('error', function (err) {
|
||||||
|
// err has statusCode property
|
||||||
|
// res should have headers
|
||||||
|
handleResult(err, null);
|
||||||
|
});
|
||||||
|
if (data && typeof data === 'string') {
|
||||||
|
req.write(data, 'utf8');
|
||||||
|
}
|
||||||
|
if (data && typeof data !== 'string') {
|
||||||
|
data.on('close', function () {
|
||||||
|
req.end();
|
||||||
|
});
|
||||||
|
data.pipe(req);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
req.end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Gets an http agent. This function is useful when you need an http agent that handles
|
||||||
|
* routing through a proxy server - depending upon the url and proxy environment variables.
|
||||||
|
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
||||||
|
*/
|
||||||
|
getAgent(serverUrl) {
|
||||||
|
let parsedUrl = new URL(serverUrl);
|
||||||
|
return this._getAgent(parsedUrl);
|
||||||
|
}
|
||||||
|
_prepareRequest(method, requestUrl, headers) {
|
||||||
|
const info = {};
|
||||||
|
info.parsedUrl = requestUrl;
|
||||||
|
const usingSsl = info.parsedUrl.protocol === 'https:';
|
||||||
|
info.httpModule = usingSsl ? https : http;
|
||||||
|
const defaultPort = usingSsl ? 443 : 80;
|
||||||
|
info.options = {};
|
||||||
|
info.options.host = info.parsedUrl.hostname;
|
||||||
|
info.options.port = info.parsedUrl.port
|
||||||
|
? parseInt(info.parsedUrl.port)
|
||||||
|
: defaultPort;
|
||||||
|
info.options.path =
|
||||||
|
(info.parsedUrl.pathname || '') + (info.parsedUrl.search || '');
|
||||||
|
info.options.method = method;
|
||||||
|
info.options.headers = this._mergeHeaders(headers);
|
||||||
|
if (this.userAgent != null) {
|
||||||
|
info.options.headers['user-agent'] = this.userAgent;
|
||||||
|
}
|
||||||
|
info.options.agent = this._getAgent(info.parsedUrl);
|
||||||
|
// gives handlers an opportunity to participate
|
||||||
|
if (this.handlers) {
|
||||||
|
this.handlers.forEach(handler => {
|
||||||
|
handler.prepareRequest(info.options);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
_mergeHeaders(headers) {
|
||||||
|
const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {});
|
||||||
|
if (this.requestOptions && this.requestOptions.headers) {
|
||||||
|
return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers));
|
||||||
|
}
|
||||||
|
return lowercaseKeys(headers || {});
|
||||||
|
}
|
||||||
|
_getExistingOrDefaultHeader(additionalHeaders, header, _default) {
|
||||||
|
const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {});
|
||||||
|
let clientHeader;
|
||||||
|
if (this.requestOptions && this.requestOptions.headers) {
|
||||||
|
clientHeader = lowercaseKeys(this.requestOptions.headers)[header];
|
||||||
|
}
|
||||||
|
return additionalHeaders[header] || clientHeader || _default;
|
||||||
|
}
|
||||||
|
_getAgent(parsedUrl) {
|
||||||
|
let agent;
|
||||||
|
let proxyUrl = pm.getProxyUrl(parsedUrl);
|
||||||
|
let useProxy = proxyUrl && proxyUrl.hostname;
|
||||||
|
if (this._keepAlive && useProxy) {
|
||||||
|
agent = this._proxyAgent;
|
||||||
|
}
|
||||||
|
if (this._keepAlive && !useProxy) {
|
||||||
|
agent = this._agent;
|
||||||
|
}
|
||||||
|
// if agent is already assigned use that agent.
|
||||||
|
if (!!agent) {
|
||||||
|
return agent;
|
||||||
|
}
|
||||||
|
const usingSsl = parsedUrl.protocol === 'https:';
|
||||||
|
let maxSockets = 100;
|
||||||
|
if (!!this.requestOptions) {
|
||||||
|
maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets;
|
||||||
|
}
|
||||||
|
if (useProxy) {
|
||||||
|
// If using proxy, need tunnel
|
||||||
|
if (!tunnel) {
|
||||||
|
tunnel = require('tunnel');
|
||||||
|
}
|
||||||
|
const agentOptions = {
|
||||||
|
maxSockets: maxSockets,
|
||||||
|
keepAlive: this._keepAlive,
|
||||||
|
proxy: {
|
||||||
|
...((proxyUrl.username || proxyUrl.password) && {
|
||||||
|
proxyAuth: `${proxyUrl.username}:${proxyUrl.password}`
|
||||||
|
}),
|
||||||
|
host: proxyUrl.hostname,
|
||||||
|
port: proxyUrl.port
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let tunnelAgent;
|
||||||
|
const overHttps = proxyUrl.protocol === 'https:';
|
||||||
|
if (usingSsl) {
|
||||||
|
tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp;
|
||||||
|
}
|
||||||
|
agent = tunnelAgent(agentOptions);
|
||||||
|
this._proxyAgent = agent;
|
||||||
|
}
|
||||||
|
// if reusing agent across request and tunneling agent isn't assigned create a new agent
|
||||||
|
if (this._keepAlive && !agent) {
|
||||||
|
const options = { keepAlive: this._keepAlive, maxSockets: maxSockets };
|
||||||
|
agent = usingSsl ? new https.Agent(options) : new http.Agent(options);
|
||||||
|
this._agent = agent;
|
||||||
|
}
|
||||||
|
// if not using private agent and tunnel agent isn't setup then use global agent
|
||||||
|
if (!agent) {
|
||||||
|
agent = usingSsl ? https.globalAgent : http.globalAgent;
|
||||||
|
}
|
||||||
|
if (usingSsl && this._ignoreSslError) {
|
||||||
|
// we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process
|
||||||
|
// http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options
|
||||||
|
// we have to cast it to any and change it directly
|
||||||
|
agent.options = Object.assign(agent.options || {}, {
|
||||||
|
rejectUnauthorized: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return agent;
|
||||||
|
}
|
||||||
|
_performExponentialBackoff(retryNumber) {
|
||||||
|
retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber);
|
||||||
|
const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber);
|
||||||
|
return new Promise(resolve => setTimeout(() => resolve(), ms));
|
||||||
|
}
|
||||||
|
static dateTimeDeserializer(key, value) {
|
||||||
|
if (typeof value === 'string') {
|
||||||
|
let a = new Date(value);
|
||||||
|
if (!isNaN(a.valueOf())) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
async _processResponse(res, options) {
|
||||||
|
return new Promise(async (resolve, reject) => {
|
||||||
|
const statusCode = res.message.statusCode;
|
||||||
|
const response = {
|
||||||
|
statusCode: statusCode,
|
||||||
|
result: null,
|
||||||
|
headers: {}
|
||||||
|
};
|
||||||
|
// not found leads to null obj returned
|
||||||
|
if (statusCode == HttpCodes.NotFound) {
|
||||||
|
resolve(response);
|
||||||
|
}
|
||||||
|
let obj;
|
||||||
|
let contents;
|
||||||
|
// get the result from the body
|
||||||
|
try {
|
||||||
|
contents = await res.readBody();
|
||||||
|
if (contents && contents.length > 0) {
|
||||||
|
if (options && options.deserializeDates) {
|
||||||
|
obj = JSON.parse(contents, HttpClient.dateTimeDeserializer);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
obj = JSON.parse(contents);
|
||||||
|
}
|
||||||
|
response.result = obj;
|
||||||
|
}
|
||||||
|
response.headers = res.message.headers;
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
// Invalid resource (contents not json); leaving result obj null
|
||||||
|
}
|
||||||
|
// note that 3xx redirects are handled by the http layer.
|
||||||
|
if (statusCode > 299) {
|
||||||
|
let msg;
|
||||||
|
// if exception/error in body, attempt to get better error
|
||||||
|
if (obj && obj.message) {
|
||||||
|
msg = obj.message;
|
||||||
|
}
|
||||||
|
else if (contents && contents.length > 0) {
|
||||||
|
// it may be the case that the exception is in the body message as string
|
||||||
|
msg = contents;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
msg = 'Failed request: (' + statusCode + ')';
|
||||||
|
}
|
||||||
|
let err = new HttpClientError(msg, statusCode);
|
||||||
|
err.result = response.result;
|
||||||
|
reject(err);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
resolve(response);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.HttpClient = HttpClient;
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
/// <reference types="node" />
|
||||||
|
import http = require('http');
|
||||||
|
export interface IHeaders {
|
||||||
|
[key: string]: any;
|
||||||
|
}
|
||||||
|
export interface IHttpClient {
|
||||||
|
options(requestUrl: string, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
||||||
|
get(requestUrl: string, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
||||||
|
del(requestUrl: string, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
||||||
|
post(requestUrl: string, data: string, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
||||||
|
patch(requestUrl: string, data: string, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
||||||
|
put(requestUrl: string, data: string, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
||||||
|
sendStream(verb: string, requestUrl: string, stream: NodeJS.ReadableStream, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
||||||
|
request(verb: string, requestUrl: string, data: string | NodeJS.ReadableStream, headers: IHeaders): Promise<IHttpClientResponse>;
|
||||||
|
requestRaw(info: IRequestInfo, data: string | NodeJS.ReadableStream): Promise<IHttpClientResponse>;
|
||||||
|
requestRawWithCallback(info: IRequestInfo, data: string | NodeJS.ReadableStream, onResult: (err: any, res: IHttpClientResponse) => void): void;
|
||||||
|
}
|
||||||
|
export interface IRequestHandler {
|
||||||
|
prepareRequest(options: http.RequestOptions): void;
|
||||||
|
canHandleAuthentication(response: IHttpClientResponse): boolean;
|
||||||
|
handleAuthentication(httpClient: IHttpClient, requestInfo: IRequestInfo, objs: any): Promise<IHttpClientResponse>;
|
||||||
|
}
|
||||||
|
export interface IHttpClientResponse {
|
||||||
|
message: http.IncomingMessage;
|
||||||
|
readBody(): Promise<string>;
|
||||||
|
}
|
||||||
|
export interface IRequestInfo {
|
||||||
|
options: http.RequestOptions;
|
||||||
|
parsedUrl: URL;
|
||||||
|
httpModule: any;
|
||||||
|
}
|
||||||
|
export interface IRequestOptions {
|
||||||
|
headers?: IHeaders;
|
||||||
|
socketTimeout?: number;
|
||||||
|
ignoreSslError?: boolean;
|
||||||
|
allowRedirects?: boolean;
|
||||||
|
allowRedirectDowngrade?: boolean;
|
||||||
|
maxRedirects?: number;
|
||||||
|
maxSockets?: number;
|
||||||
|
keepAlive?: boolean;
|
||||||
|
deserializeDates?: boolean;
|
||||||
|
allowRetries?: boolean;
|
||||||
|
maxRetries?: number;
|
||||||
|
}
|
||||||
|
export interface ITypedResponse<T> {
|
||||||
|
statusCode: number;
|
||||||
|
result: T | null;
|
||||||
|
headers: Object;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
{
|
||||||
|
"name": "@actions/http-client",
|
||||||
|
"version": "1.0.11",
|
||||||
|
"description": "Actions Http Client",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"build": "rm -Rf ./_out && tsc && cp package*.json ./_out && cp *.md ./_out && cp LICENSE ./_out && cp actions.png ./_out",
|
||||||
|
"test": "jest",
|
||||||
|
"format": "prettier --write *.ts && prettier --write **/*.ts",
|
||||||
|
"format-check": "prettier --check *.ts && prettier --check **/*.ts",
|
||||||
|
"audit-check": "npm audit --audit-level=moderate"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/actions/http-client.git"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"Actions",
|
||||||
|
"Http"
|
||||||
|
],
|
||||||
|
"author": "GitHub, Inc.",
|
||||||
|
"license": "MIT",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/actions/http-client/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/actions/http-client#readme",
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/jest": "^25.1.4",
|
||||||
|
"@types/node": "^12.12.31",
|
||||||
|
"jest": "^25.1.0",
|
||||||
|
"prettier": "^2.0.4",
|
||||||
|
"proxy": "^1.0.1",
|
||||||
|
"ts-jest": "^25.2.1",
|
||||||
|
"typescript": "^3.8.3"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"tunnel": "0.0.6"
|
||||||
|
}
|
||||||
|
|
||||||
|
,"_resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz"
|
||||||
|
,"_integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg=="
|
||||||
|
,"_from": "@actions/http-client@1.0.11"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
export declare function getProxyUrl(reqUrl: URL): URL | undefined;
|
||||||
|
export declare function checkBypass(reqUrl: URL): boolean;
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
function getProxyUrl(reqUrl) {
|
||||||
|
let usingSsl = reqUrl.protocol === 'https:';
|
||||||
|
let proxyUrl;
|
||||||
|
if (checkBypass(reqUrl)) {
|
||||||
|
return proxyUrl;
|
||||||
|
}
|
||||||
|
let proxyVar;
|
||||||
|
if (usingSsl) {
|
||||||
|
proxyVar = process.env['https_proxy'] || process.env['HTTPS_PROXY'];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
proxyVar = process.env['http_proxy'] || process.env['HTTP_PROXY'];
|
||||||
|
}
|
||||||
|
if (proxyVar) {
|
||||||
|
proxyUrl = new URL(proxyVar);
|
||||||
|
}
|
||||||
|
return proxyUrl;
|
||||||
|
}
|
||||||
|
exports.getProxyUrl = getProxyUrl;
|
||||||
|
function checkBypass(reqUrl) {
|
||||||
|
if (!reqUrl.hostname) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
let noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || '';
|
||||||
|
if (!noProxy) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// Determine the request port
|
||||||
|
let reqPort;
|
||||||
|
if (reqUrl.port) {
|
||||||
|
reqPort = Number(reqUrl.port);
|
||||||
|
}
|
||||||
|
else if (reqUrl.protocol === 'http:') {
|
||||||
|
reqPort = 80;
|
||||||
|
}
|
||||||
|
else if (reqUrl.protocol === 'https:') {
|
||||||
|
reqPort = 443;
|
||||||
|
}
|
||||||
|
// Format the request hostname and hostname with port
|
||||||
|
let upperReqHosts = [reqUrl.hostname.toUpperCase()];
|
||||||
|
if (typeof reqPort === 'number') {
|
||||||
|
upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`);
|
||||||
|
}
|
||||||
|
// Compare request host against noproxy
|
||||||
|
for (let upperNoProxyItem of noProxy
|
||||||
|
.split(',')
|
||||||
|
.map(x => x.trim().toUpperCase())
|
||||||
|
.filter(x => x)) {
|
||||||
|
if (upperReqHosts.some(x => x === upperNoProxyItem)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
exports.checkBypass = checkBypass;
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright 2019 GitHub
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
# `@actions/io`
|
||||||
|
|
||||||
|
> Core functions for cli filesystem scenarios
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
#### mkdir -p
|
||||||
|
|
||||||
|
Recursively make a directory. Follows rules specified in [man mkdir](https://linux.die.net/man/1/mkdir) with the `-p` option specified:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const io = require('@actions/io');
|
||||||
|
|
||||||
|
await io.mkdirP('path/to/make');
|
||||||
|
```
|
||||||
|
|
||||||
|
#### cp/mv
|
||||||
|
|
||||||
|
Copy or move files or folders. Follows rules specified in [man cp](https://linux.die.net/man/1/cp) and [man mv](https://linux.die.net/man/1/mv):
|
||||||
|
|
||||||
|
```js
|
||||||
|
const io = require('@actions/io');
|
||||||
|
|
||||||
|
// Recursive must be true for directories
|
||||||
|
const options = { recursive: true, force: false }
|
||||||
|
|
||||||
|
await io.cp('path/to/directory', 'path/to/dest', options);
|
||||||
|
await io.mv('path/to/file', 'path/to/dest');
|
||||||
|
```
|
||||||
|
|
||||||
|
#### rm -rf
|
||||||
|
|
||||||
|
Remove a file or folder recursively. Follows rules specified in [man rm](https://linux.die.net/man/1/rm) with the `-r` and `-f` rules specified.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const io = require('@actions/io');
|
||||||
|
|
||||||
|
await io.rmRF('path/to/directory');
|
||||||
|
await io.rmRF('path/to/file');
|
||||||
|
```
|
||||||
|
|
||||||
|
#### which
|
||||||
|
|
||||||
|
Get the path to a tool and resolves via paths. Follows the rules specified in [man which](https://linux.die.net/man/1/which).
|
||||||
|
|
||||||
|
```js
|
||||||
|
const exec = require('@actions/exec');
|
||||||
|
const io = require('@actions/io');
|
||||||
|
|
||||||
|
const pythonPath: string = await io.which('python', true)
|
||||||
|
|
||||||
|
await exec.exec(`"${pythonPath}"`, ['main.py']);
|
||||||
|
```
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
{
|
||||||
|
"name": "@actions/io",
|
||||||
|
"version": "1.1.1",
|
||||||
|
"description": "Actions io lib",
|
||||||
|
"keywords": [
|
||||||
|
"github",
|
||||||
|
"actions",
|
||||||
|
"io"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/actions/toolkit/tree/main/packages/io",
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "lib/io.js",
|
||||||
|
"types": "lib/io.d.ts",
|
||||||
|
"directories": {
|
||||||
|
"lib": "lib",
|
||||||
|
"test": "__tests__"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"lib"
|
||||||
|
],
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/actions/toolkit.git",
|
||||||
|
"directory": "packages/io"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"audit-moderate": "npm install && npm audit --json --audit-level=moderate > audit.json",
|
||||||
|
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||||
|
"tsc": "tsc"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/actions/toolkit/issues"
|
||||||
|
}
|
||||||
|
|
||||||
|
,"_resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.1.tgz"
|
||||||
|
,"_integrity": "sha512-Qi4JoKXjmE0O67wAOH6y0n26QXhMKMFo7GD/4IXNVcrtLjUlGjGuVys6pQgwF3ArfGTQu0XpqaNr0YhED2RaRA=="
|
||||||
|
,"_from": "@actions/io@1.1.1"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
# @babel/code-frame
|
||||||
|
|
||||||
|
> Generate errors that contain a code frame that point to source locations.
|
||||||
|
|
||||||
|
See our website [@babel/code-frame](https://babeljs.io/docs/en/next/babel-code-frame.html) for more information.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
Using npm:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm install --save-dev @babel/code-frame
|
||||||
|
```
|
||||||
|
|
||||||
|
or using yarn:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
yarn add @babel/code-frame --dev
|
||||||
|
```
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
{
|
||||||
|
"name": "@babel/code-frame",
|
||||||
|
"version": "7.10.4",
|
||||||
|
"description": "Generate errors that contain a code frame that point to source locations.",
|
||||||
|
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||||
|
"homepage": "https://babeljs.io/",
|
||||||
|
"license": "MIT",
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/babel/babel.git",
|
||||||
|
"directory": "packages/babel-code-frame"
|
||||||
|
},
|
||||||
|
"main": "lib/index.js",
|
||||||
|
"dependencies": {
|
||||||
|
"@babel/highlight": "^7.10.4"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"chalk": "^2.0.0",
|
||||||
|
"strip-ansi": "^4.0.0"
|
||||||
|
},
|
||||||
|
"gitHead": "7fd40d86a0d03ff0e9c3ea16b29689945433d4df"
|
||||||
|
|
||||||
|
,"_resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz"
|
||||||
|
,"_integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg=="
|
||||||
|
,"_from": "@babel/code-frame@7.10.4"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
# @babel/helper-validator-identifier
|
||||||
|
|
||||||
|
> Validate identifier/keywords name
|
||||||
|
|
||||||
|
See our website [@babel/helper-validator-identifier](https://babeljs.io/docs/en/next/babel-helper-validator-identifier.html) for more information.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
Using npm:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm install --save-dev @babel/helper-validator-identifier
|
||||||
|
```
|
||||||
|
|
||||||
|
or using yarn:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
yarn add @babel/helper-validator-identifier --dev
|
||||||
|
```
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"name": "@babel/helper-validator-identifier",
|
||||||
|
"version": "7.10.4",
|
||||||
|
"description": "Validate identifier/keywords name",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/babel/babel.git",
|
||||||
|
"directory": "packages/babel-helper-validator-identifier"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"main": "./lib/index.js",
|
||||||
|
"exports": "./lib/index.js",
|
||||||
|
"devDependencies": {
|
||||||
|
"charcodes": "^0.2.0",
|
||||||
|
"unicode-13.0.0": "^0.8.0"
|
||||||
|
},
|
||||||
|
"gitHead": "7fd40d86a0d03ff0e9c3ea16b29689945433d4df"
|
||||||
|
|
||||||
|
,"_resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz"
|
||||||
|
,"_integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw=="
|
||||||
|
,"_from": "@babel/helper-validator-identifier@7.10.4"
|
||||||
|
}
|
||||||
75
node_modules/@babel/helper-validator-identifier/scripts/generate-identifier-regex.js
generated
vendored
100644
75
node_modules/@babel/helper-validator-identifier/scripts/generate-identifier-regex.js
generated
vendored
100644
|
|
@ -0,0 +1,75 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
// Always use the latest available version of Unicode!
|
||||||
|
// https://tc39.github.io/ecma262/#sec-conformance
|
||||||
|
const version = "13.0.0";
|
||||||
|
|
||||||
|
const start = require("unicode-" +
|
||||||
|
version +
|
||||||
|
"/Binary_Property/ID_Start/code-points.js").filter(function (ch) {
|
||||||
|
return ch > 0x7f;
|
||||||
|
});
|
||||||
|
let last = -1;
|
||||||
|
const cont = [0x200c, 0x200d].concat(
|
||||||
|
require("unicode-" +
|
||||||
|
version +
|
||||||
|
"/Binary_Property/ID_Continue/code-points.js").filter(function (ch) {
|
||||||
|
return ch > 0x7f && search(start, ch, last + 1) == -1;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
function search(arr, ch, starting) {
|
||||||
|
for (let i = starting; arr[i] <= ch && i < arr.length; last = i++) {
|
||||||
|
if (arr[i] === ch) return i;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function pad(str, width) {
|
||||||
|
while (str.length < width) str = "0" + str;
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
function esc(code) {
|
||||||
|
const hex = code.toString(16);
|
||||||
|
if (hex.length <= 2) return "\\x" + pad(hex, 2);
|
||||||
|
else return "\\u" + pad(hex, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
function generate(chars) {
|
||||||
|
const astral = [];
|
||||||
|
let re = "";
|
||||||
|
for (let i = 0, at = 0x10000; i < chars.length; i++) {
|
||||||
|
const from = chars[i];
|
||||||
|
let to = from;
|
||||||
|
while (i < chars.length - 1 && chars[i + 1] == to + 1) {
|
||||||
|
i++;
|
||||||
|
to++;
|
||||||
|
}
|
||||||
|
if (to <= 0xffff) {
|
||||||
|
if (from == to) re += esc(from);
|
||||||
|
else if (from + 1 == to) re += esc(from) + esc(to);
|
||||||
|
else re += esc(from) + "-" + esc(to);
|
||||||
|
} else {
|
||||||
|
astral.push(from - at, to - from);
|
||||||
|
at = to;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return { nonASCII: re, astral: astral };
|
||||||
|
}
|
||||||
|
|
||||||
|
const startData = generate(start);
|
||||||
|
const contData = generate(cont);
|
||||||
|
|
||||||
|
console.log("/* prettier-ignore */");
|
||||||
|
console.log('let nonASCIIidentifierStartChars = "' + startData.nonASCII + '";');
|
||||||
|
console.log("/* prettier-ignore */");
|
||||||
|
console.log('let nonASCIIidentifierChars = "' + contData.nonASCII + '";');
|
||||||
|
console.log("/* prettier-ignore */");
|
||||||
|
console.log(
|
||||||
|
"const astralIdentifierStartCodes = " + JSON.stringify(startData.astral) + ";"
|
||||||
|
);
|
||||||
|
console.log("/* prettier-ignore */");
|
||||||
|
console.log(
|
||||||
|
"const astralIdentifierCodes = " + JSON.stringify(contData.astral) + ";"
|
||||||
|
);
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
# @babel/highlight
|
||||||
|
|
||||||
|
> Syntax highlight JavaScript strings for output in terminals.
|
||||||
|
|
||||||
|
See our website [@babel/highlight](https://babeljs.io/docs/en/next/babel-highlight.html) for more information.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
Using npm:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm install --save-dev @babel/highlight
|
||||||
|
```
|
||||||
|
|
||||||
|
or using yarn:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
yarn add @babel/highlight --dev
|
||||||
|
```
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
{
|
||||||
|
"name": "@babel/highlight",
|
||||||
|
"version": "7.10.4",
|
||||||
|
"description": "Syntax highlight JavaScript strings for output in terminals.",
|
||||||
|
"author": "suchipi <me@suchipi.com>",
|
||||||
|
"homepage": "https://babeljs.io/",
|
||||||
|
"license": "MIT",
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/babel/babel.git",
|
||||||
|
"directory": "packages/babel-highlight"
|
||||||
|
},
|
||||||
|
"main": "lib/index.js",
|
||||||
|
"dependencies": {
|
||||||
|
"@babel/helper-validator-identifier": "^7.10.4",
|
||||||
|
"chalk": "^2.0.0",
|
||||||
|
"js-tokens": "^4.0.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"strip-ansi": "^4.0.0"
|
||||||
|
},
|
||||||
|
"gitHead": "7fd40d86a0d03ff0e9c3ea16b29689945433d4df"
|
||||||
|
|
||||||
|
,"_resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz"
|
||||||
|
,"_integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA=="
|
||||||
|
,"_from": "@babel/highlight@7.10.4"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,852 @@
|
||||||
|
# Change Log
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
# [13.2.0](https://github.com/conventional-changelog/commitlint/compare/v13.1.0...v13.2.0) (2021-09-28)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/cli
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [13.1.0](https://github.com/conventional-changelog/commitlint/compare/v13.0.0...v13.1.0) (2021-07-24)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **cli:** remove hard coded comment char with linting `COMMIT_EDIT_MSG` ([#2618](https://github.com/conventional-changelog/commitlint/issues/2618)) ([5badf6d](https://github.com/conventional-changelog/commitlint/commit/5badf6dc08116ed3557e6c780e55764b4f07ca67)), closes [#2351](https://github.com/conventional-changelog/commitlint/issues/2351)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [13.0.0](https://github.com/conventional-changelog/commitlint/compare/v12.1.4...v13.0.0) (2021-05-24)
|
||||||
|
|
||||||
|
|
||||||
|
* chore!: remove node 10 support (#2596) ([4db4ba1](https://github.com/conventional-changelog/commitlint/commit/4db4ba1b0b312410a0f62100a93a80c246a6c410)), closes [#2596](https://github.com/conventional-changelog/commitlint/issues/2596)
|
||||||
|
|
||||||
|
|
||||||
|
### BREAKING CHANGES
|
||||||
|
|
||||||
|
* minimum node version is 12
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [12.1.3](https://github.com/conventional-changelog/commitlint/compare/v12.1.2...v12.1.3) (2021-05-12)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* update dependency fs-extra to v10 ([#2575](https://github.com/conventional-changelog/commitlint/issues/2575)) ([d47d2b5](https://github.com/conventional-changelog/commitlint/commit/d47d2b595b980adadd4fb8ff198c1914caeff18f))
|
||||||
|
* update dependency yargs to v17 ([#2574](https://github.com/conventional-changelog/commitlint/issues/2574)) ([81c38dd](https://github.com/conventional-changelog/commitlint/commit/81c38ddf15f239b525f673b26b2ee6606f2ee8f6))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [12.1.2](https://github.com/conventional-changelog/commitlint/compare/v12.1.1...v12.1.2) (2021-04-29)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/cli
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [12.1.1](https://github.com/conventional-changelog/commitlint/compare/v12.1.0...v12.1.1) (2021-04-02)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/cli
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [12.1.0](https://github.com/conventional-changelog/commitlint/compare/v12.0.1...v12.1.0) (2021-03-06)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/cli
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [12.0.1](https://github.com/conventional-changelog/commitlint/compare/v12.0.0...v12.0.1) (2021-02-23)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/cli
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [12.0.0](https://github.com/conventional-changelog/commitlint/compare/v11.0.0...v12.0.0) (2021-01-18)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* update dependency execa to v5 ([#2341](https://github.com/conventional-changelog/commitlint/issues/2341)) ([f349df9](https://github.com/conventional-changelog/commitlint/commit/f349df90f08096a9bcad46b5e55b411aac327a24))
|
||||||
|
* update dependency yargs to v16 ([204f36d](https://github.com/conventional-changelog/commitlint/commit/204f36d0a522afaf3a88739b401aea15ffa0b891))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **cli:** implement print-config cli flag ([#2391](https://github.com/conventional-changelog/commitlint/issues/2391)) ([8626883](https://github.com/conventional-changelog/commitlint/commit/86268833946dea9dcf1c15459456cd4427d17835))
|
||||||
|
* **load:** allow specifying helpUrl via config ([#2180](https://github.com/conventional-changelog/commitlint/issues/2180)) ([d6795a3](https://github.com/conventional-changelog/commitlint/commit/d6795a3c4633ba6efd7a0fcff48339dc291cd832))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [11.0.0](https://github.com/conventional-changelog/commitlint/compare/v10.0.0...v11.0.0) (2020-09-05)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **cli:** remove default value from edit option [#2065](https://github.com/conventional-changelog/commitlint/issues/2065) ([3d4116d](https://github.com/conventional-changelog/commitlint/commit/3d4116d044a2f5149a9c9c1d9fa35abf5e232479))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [10.0.0](https://github.com/conventional-changelog/commitlint/compare/v9.1.2...v10.0.0) (2020-08-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* update dependency execa to v4 ([#1936](https://github.com/conventional-changelog/commitlint/issues/1936)) ([8efb441](https://github.com/conventional-changelog/commitlint/commit/8efb44193058d286f7325327a6d33936b273ec91))
|
||||||
|
* update dependency fs-extra to v9 ([#1018](https://github.com/conventional-changelog/commitlint/issues/1018)) ([2df49fa](https://github.com/conventional-changelog/commitlint/commit/2df49fac907993ae78199a1012e918b0e2ff5621))
|
||||||
|
* update dependency get-stdin to v8 ([#1938](https://github.com/conventional-changelog/commitlint/issues/1938)) ([f94a5c8](https://github.com/conventional-changelog/commitlint/commit/f94a5c82861523aa1cf407ffe062f99ecbbfb4e4))
|
||||||
|
|
||||||
|
|
||||||
|
* refactor!: drop support for node 8 (#1999) ([751f39f](https://github.com/conventional-changelog/commitlint/commit/751f39f284ef232574a176c3c11b1982ee544166)), closes [#1999](https://github.com/conventional-changelog/commitlint/issues/1999)
|
||||||
|
|
||||||
|
|
||||||
|
### BREAKING CHANGES
|
||||||
|
|
||||||
|
* remove node 8 from circle-ci checks
|
||||||
|
|
||||||
|
also remove node 13 because we do not support experimental versions
|
||||||
|
|
||||||
|
* docs: update node v10 to latest LTS 10 version
|
||||||
|
|
||||||
|
Co-authored-by: Cedric van Putten <me@bycedric.com>
|
||||||
|
|
||||||
|
Co-authored-by: Cedric van Putten <me@bycedric.com>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [9.1.2](https://github.com/conventional-changelog/commitlint/compare/v9.1.1...v9.1.2) (2020-07-13)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/cli
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [9.1.1](https://github.com/conventional-changelog/commitlint/compare/v9.1.0...v9.1.1) (2020-06-30)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/cli
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [9.1.0](https://github.com/conventional-changelog/commitlint/compare/v9.0.1...v9.1.0) (2020-06-21)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* update dependency chalk to v4 ([#1275](https://github.com/conventional-changelog/commitlint/issues/1275)) ([a5d8fa1](https://github.com/conventional-changelog/commitlint/commit/a5d8fa118e8221361f14f5fd2b21d7aaad008a27))
|
||||||
|
* update dependency regenerator-runtime to v0.13.5 ([#1017](https://github.com/conventional-changelog/commitlint/issues/1017)) ([9c4fdf1](https://github.com/conventional-changelog/commitlint/commit/9c4fdf1b5f42677422532dad655af9aed9b43881))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [9.0.1](https://github.com/conventional-changelog/commitlint/compare/v9.0.0...v9.0.1) (2020-05-26)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* add missing @babel/runtime dep [#1738](https://github.com/conventional-changelog/commitlint/issues/1738) ([#1754](https://github.com/conventional-changelog/commitlint/issues/1754)) ([09afcd6](https://github.com/conventional-changelog/commitlint/commit/09afcd647a2c1d00538cf1c970e3790d936111f8))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [9.0.0](https://github.com/conventional-changelog/commitlint/compare/v8.3.5...v9.0.0) (2020-05-21)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **cli:** add missing regenerator-runtime to dependencies ([#919](https://github.com/conventional-changelog/commitlint/issues/919)) ([ee5eac9](https://github.com/conventional-changelog/commitlint/commit/ee5eac98fa97ba5ba17030c8d2705aee5c7f3a3a))
|
||||||
|
* [#840](https://github.com/conventional-changelog/commitlint/issues/840) add caret to lodash versions ([#843](https://github.com/conventional-changelog/commitlint/issues/843)) ([ffc0bac](https://github.com/conventional-changelog/commitlint/commit/ffc0bac26993acb2ab6a8fa51065f93c92b0d644))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [8.3.5](https://github.com/conventional-changelog/commitlint/compare/v8.3.4...v8.3.5) (2020-01-15)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/cli
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [8.3.4](https://github.com/conventional-changelog/commitlint/compare/v8.3.3...v8.3.4) (2020-01-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/cli
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [8.3.1](https://github.com/conventional-changelog/commitlint/compare/v8.3.0...v8.3.1) (2019-10-16)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/cli
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [8.3.0](https://github.com/conventional-changelog/commitlint/compare/v8.2.0...v8.3.0) (2019-10-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **cli:** add helpurl flag ([#789](https://github.com/conventional-changelog/commitlint/issues/789)) ([75cef4e](https://github.com/conventional-changelog/commitlint/commit/75cef4e))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [8.2.0](https://github.com/conventional-changelog/commitlint/compare/v8.1.0...v8.2.0) (2019-09-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* pass defaultIgnores from configuration in @commitlint/cli ([#771](https://github.com/conventional-changelog/commitlint/issues/771)) ([a259014](https://github.com/conventional-changelog/commitlint/commit/a259014))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [8.1.0](https://github.com/conventional-changelog/commitlint/compare/v8.0.0...v8.1.0) (2019-07-15)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* pass ignores from configuration in @commitlint/cli ([#668](https://github.com/conventional-changelog/commitlint/issues/668)) ([da99aaa](https://github.com/conventional-changelog/commitlint/commit/da99aaa))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [7.6.1](https://github.com/conventional-changelog/commitlint/compare/v7.6.0...v7.6.1) (2019-05-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/cli
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [7.6.0](https://github.com/conventional-changelog/commitlint/compare/v7.5.2...v7.6.0) (2019-05-06)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* avoid excessive help text [#606](https://github.com/conventional-changelog/commitlint/issues/606) ([#637](https://github.com/conventional-changelog/commitlint/issues/637)) ([8f3c3b1](https://github.com/conventional-changelog/commitlint/commit/8f3c3b1))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* adds support for plugins ([#228](https://github.com/conventional-changelog/commitlint/issues/228)) ([#588](https://github.com/conventional-changelog/commitlint/issues/588)) ([cea4564](https://github.com/conventional-changelog/commitlint/commit/cea4564))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [7.5.2](https://github.com/conventional-changelog/commitlint/compare/v7.5.1...v7.5.2) (2019-02-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **cli:** replace old links with new organisation links ([#578](https://github.com/conventional-changelog/commitlint/issues/578)) ([4075903](https://github.com/conventional-changelog/commitlint/commit/4075903))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [7.5.1](https://github.com/conventional-changelog/commitlint/compare/v7.5.0...v7.5.1) (2019-02-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/cli
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="7.5.0"></a>
|
||||||
|
# [7.5.0](https://github.com/conventional-changelog/commitlint/compare/v7.4.0...v7.5.0) (2019-01-31)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **cli:** avoid linebreak in empty input ([#523](https://github.com/conventional-changelog/commitlint/issues/523)) ([3141882](https://github.com/conventional-changelog/commitlint/commit/3141882))
|
||||||
|
* all broken website references ([#564](https://github.com/conventional-changelog/commitlint/issues/564)) ([82eeb5a](https://github.com/conventional-changelog/commitlint/commit/82eeb5a))
|
||||||
|
* cleanup message for input with no config ([#519](https://github.com/conventional-changelog/commitlint/issues/519)) ([7d9e760](https://github.com/conventional-changelog/commitlint/commit/7d9e760))
|
||||||
|
* replace all repository references with conventional changelog ([#561](https://github.com/conventional-changelog/commitlint/issues/561)) ([6c3afcd](https://github.com/conventional-changelog/commitlint/commit/6c3afcd))
|
||||||
|
* replace all website references with conventional changelog ([#563](https://github.com/conventional-changelog/commitlint/issues/563)) ([6b86fb1](https://github.com/conventional-changelog/commitlint/commit/6b86fb1))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="7.4.0"></a>
|
||||||
|
# [7.4.0](https://github.com/conventional-changelog/commitlint/compare/v7.3.2...v7.4.0) (2019-01-27)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/cli
|
||||||
|
|
||||||
|
<a name="7.3.2"></a>
|
||||||
|
## [7.3.2](https://github.com/conventional-changelog/commitlint/compare/v7.3.1...v7.3.2) (2019-01-15)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/cli
|
||||||
|
|
||||||
|
<a name="7.3.1"></a>
|
||||||
|
## [7.3.1](https://github.com/conventional-changelog/commitlint/compare/v7.3.0...v7.3.1) (2019-01-11)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/cli
|
||||||
|
|
||||||
|
<a name="7.3.0"></a>
|
||||||
|
# [7.3.0](https://github.com/conventional-changelog/commitlint/compare/v7.2.1...v7.3.0) (2019-01-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* add fallback with husky git params to deprecation handling ([#498](https://github.com/conventional-changelog/commitlint/issues/498)) ([5a34b8c](https://github.com/conventional-changelog/commitlint/commit/5a34b8c))
|
||||||
|
* avoid truncated output on macOS ([#503](https://github.com/conventional-changelog/commitlint/issues/503)) ([3192368](https://github.com/conventional-changelog/commitlint/commit/3192368))
|
||||||
|
* respect String.protoype.repeat API contract ([f27e7ac](https://github.com/conventional-changelog/commitlint/commit/f27e7ac))
|
||||||
|
* update to security-patched dependency versions ([97c033b](https://github.com/conventional-changelog/commitlint/commit/97c033b))
|
||||||
|
* use correct label for failing empty subjects ([#481](https://github.com/conventional-changelog/commitlint/issues/481)) ([2e7e34d](https://github.com/conventional-changelog/commitlint/commit/2e7e34d)), closes [#476](https://github.com/conventional-changelog/commitlint/issues/476)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* check stage before entering prompt ([#495](https://github.com/conventional-changelog/commitlint/issues/495)) ([3b3667a](https://github.com/conventional-changelog/commitlint/commit/3b3667a)), closes [#51](https://github.com/conventional-changelog/commitlint/issues/51) [#51](https://github.com/conventional-changelog/commitlint/issues/51)
|
||||||
|
* warn on empty config ([#491](https://github.com/conventional-changelog/commitlint/issues/491)) ([b6bd36e](https://github.com/conventional-changelog/commitlint/commit/b6bd36e)), closes [#107](https://github.com/conventional-changelog/commitlint/issues/107) [#107](https://github.com/conventional-changelog/commitlint/issues/107)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="7.2.1"></a>
|
||||||
|
## [7.2.1](https://github.com/conventional-changelog/commitlint/compare/v7.2.0...v7.2.1) (2018-10-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* improve format module resolving ([#464](https://github.com/conventional-changelog/commitlint/issues/464)) ([baed8b1](https://github.com/conventional-changelog/commitlint/commit/baed8b1))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="7.2.0"></a>
|
||||||
|
# [7.2.0](https://github.com/conventional-changelog/commitlint/compare/v7.1.2...v7.2.0) (2018-10-05)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **cli:** add format option for report output ([1ecf097](https://github.com/conventional-changelog/commitlint/commit/1ecf097))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="7.1.2"></a>
|
||||||
|
## [7.1.2](https://github.com/conventional-changelog/commitlint/compare/v7.1.1...v7.1.2) (2018-09-04)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/cli
|
||||||
|
|
||||||
|
<a name="7.1.0"></a>
|
||||||
|
# [7.1.0](https://github.com/conventional-changelog/commitlint/compare/v7.0.1...v7.1.0) (2018-08-29)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/cli
|
||||||
|
|
||||||
|
<a name="6.2.0"></a>
|
||||||
|
# [6.2.0](https://github.com/conventional-changelog/commitlint/compare/v6.1.3...v6.2.0) (2018-05-01)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* print commit message when the message is invalid ([86c34f1](https://github.com/conventional-changelog/commitlint/commit/86c34f1)), closes [#222](https://github.com/conventional-changelog/commitlint/issues/222)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="6.1.1"></a>
|
||||||
|
## [6.1.1](https://github.com/conventional-changelog/commitlint/compare/v6.1.0...v6.1.1) (2018-02-22)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/cli
|
||||||
|
|
||||||
|
<a name="6.1.0"></a>
|
||||||
|
# [6.1.0](https://github.com/conventional-changelog/commitlint/compare/v6.0.5...v6.1.0) (2018-02-03)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add "--config" option ([#261](https://github.com/conventional-changelog/commitlint/issues/261)) ([2c03ec6](https://github.com/conventional-changelog/commitlint/commit/2c03ec6))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="6.0.5"></a>
|
||||||
|
## [6.0.5](https://github.com/conventional-changelog/commitlint/compare/v6.0.4...v6.0.5) (2018-01-31)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/cli
|
||||||
|
|
||||||
|
<a name="6.0.4"></a>
|
||||||
|
## [6.0.4](https://github.com/conventional-changelog/commitlint/compare/v6.0.3...v6.0.4) (2018-01-31)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/cli
|
||||||
|
|
||||||
|
<a name="6.0.3"></a>
|
||||||
|
## [6.0.3](https://github.com/conventional-changelog/commitlint/compare/v6.0.2...v6.0.3) (2018-01-31)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/cli
|
||||||
|
|
||||||
|
<a name="6.0.2"></a>
|
||||||
|
## [6.0.2](https://github.com/conventional-changelog/commitlint/compare/v6.0.0...v6.0.2) (2018-01-12)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/cli
|
||||||
|
|
||||||
|
<a name="6.0.1"></a>
|
||||||
|
## [6.0.1](https://github.com/conventional-changelog/commitlint/compare/v6.0.0...v6.0.1) (2018-01-09)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/cli
|
||||||
|
|
||||||
|
<a name="6.0.0"></a>
|
||||||
|
# [6.0.0](https://github.com/conventional-changelog/commitlint/compare/v5.2.6...v6.0.0) (2018-01-09)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* correctly resolve parserOpts [#115](https://github.com/conventional-changelog/commitlint/issues/115) [#95](https://github.com/conventional-changelog/commitlint/issues/95) ([1353dd5](https://github.com/conventional-changelog/commitlint/commit/1353dd5))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="5.2.6"></a>
|
||||||
|
## [5.2.6](https://github.com/conventional-changelog/commitlint/compare/v5.2.5...v5.2.6) (2017-12-21)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/cli
|
||||||
|
|
||||||
|
<a name="5.2.5"></a>
|
||||||
|
## [5.2.5](https://github.com/conventional-changelog/commitlint/compare/v5.2.4...v5.2.5) (2017-12-08)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/cli
|
||||||
|
|
||||||
|
<a name="5.2.4"></a>
|
||||||
|
## [5.2.4](https://github.com/conventional-changelog/commitlint/compare/v5.2.3...v5.2.4) (2017-12-08)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/cli
|
||||||
|
|
||||||
|
<a name="5.2.3"></a>
|
||||||
|
## [5.2.3](https://github.com/conventional-changelog/commitlint/compare/v5.2.2...v5.2.3) (2017-12-05)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **cli:** add support for GIT_PARAMS on windows ([c62bd41](https://github.com/conventional-changelog/commitlint/commit/c62bd41)), closes [#103](https://github.com/conventional-changelog/commitlint/issues/103) [#175](https://github.com/conventional-changelog/commitlint/issues/175)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="5.2.0"></a>
|
||||||
|
# [5.2.0](https://github.com/conventional-changelog/commitlint/compare/v5.1.3...v5.2.0) (2017-11-30)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/cli
|
||||||
|
|
||||||
|
<a name="5.1.1"></a>
|
||||||
|
## [5.1.1](https://github.com/conventional-changelog/commitlint/compare/v5.1.0...v5.1.1) (2017-11-24)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/cli
|
||||||
|
|
||||||
|
<a name="5.1.0"></a>
|
||||||
|
# [5.1.0](https://github.com/conventional-changelog/commitlint/compare/v5.0.2...v5.1.0) (2017-11-24)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* update dependency concurrently to v3.5.1 ([#147](https://github.com/conventional-changelog/commitlint/issues/147)) ([a809d0f](https://github.com/conventional-changelog/commitlint/commit/a809d0f))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **travis-cli:** add reusable travis command line interface ([3e6e6a8](https://github.com/conventional-changelog/commitlint/commit/3e6e6a8))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="5.0.1"></a>
|
||||||
|
## [5.0.1](https://github.com/conventional-changelog/commitlint/compare/v5.0.0...v5.0.1) (2017-11-19)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/cli
|
||||||
|
|
||||||
|
<a name="4.3.0"></a>
|
||||||
|
# [4.3.0](https://github.com/conventional-changelog/commitlint/compare/v4.2.2...v4.3.0) (2017-11-08)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/cli
|
||||||
|
|
||||||
|
<a name="4.2.2"></a>
|
||||||
|
## [4.2.2](https://github.com/conventional-changelog/commitlint/compare/v4.2.1...v4.2.2) (2017-10-26)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/cli
|
||||||
|
|
||||||
|
<a name="4.2.1"></a>
|
||||||
|
## [4.2.1](https://github.com/conventional-changelog/commitlint/compare/v4.2.0...v4.2.1) (2017-10-18)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* nicer error messages ([#93](https://github.com/conventional-changelog/commitlint/issues/93)) ([dcfad61](https://github.com/conventional-changelog/commitlint/commit/dcfad61))
|
||||||
|
* **core:** consider config outside of current git repo ([f7234b6](https://github.com/conventional-changelog/commitlint/commit/f7234b6))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="4.2.0"></a>
|
||||||
|
# [4.2.0](https://github.com/conventional-changelog/commitlint/compare/v4.1.1...v4.2.0) (2017-10-14)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* edit flag now accepts the path to the commit file ([c881433](https://github.com/conventional-changelog/commitlint/commit/c881433)), closes [#40](https://github.com/conventional-changelog/commitlint/issues/40)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="4.1.1"></a>
|
||||||
|
## [4.1.1](https://github.com/conventional-changelog/commitlint/compare/v4.1.0...v4.1.1) (2017-10-09)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/cli
|
||||||
|
|
||||||
|
<a name="4.1.0"></a>
|
||||||
|
# [4.1.0](https://github.com/conventional-changelog/commitlint/compare/v4.0.0...v4.1.0) (2017-10-05)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/cli
|
||||||
|
|
||||||
|
<a name="4.0.0"></a>
|
||||||
|
# [4.0.0](https://github.com/conventional-changelog/commitlint/compare/v3.2.0...v4.0.0) (2017-10-04)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* enable alternative config formats ([#83](https://github.com/conventional-changelog/commitlint/issues/83)) ([91968b8](https://github.com/conventional-changelog/commitlint/commit/91968b8)), closes [#73](https://github.com/conventional-changelog/commitlint/issues/73)
|
||||||
|
|
||||||
|
|
||||||
|
### BREAKING CHANGES
|
||||||
|
|
||||||
|
* discontinue support of conventional-changelog-lintrc
|
||||||
|
|
||||||
|
* test: make git setup reliable
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.2.0"></a>
|
||||||
|
# 3.2.0 (2017-09-05)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add preset parser ([5cd2335](https://github.com/conventional-changelog/commitlint/commit/5cd2335))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.1.3"></a>
|
||||||
|
## 3.1.3 (2017-08-21)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **core:** determine git root correctly in sub directories ([#64](https://github.com/conventional-changelog/commitlint/issues/64)) ([d594ec4](https://github.com/conventional-changelog/commitlint/commit/d594ec4)), closes [#62](https://github.com/conventional-changelog/commitlint/issues/62)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.1.2"></a>
|
||||||
|
## 3.1.2 (2017-08-07)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.1.1"></a>
|
||||||
|
## 3.1.1 (2017-08-07)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.0.4"></a>
|
||||||
|
## 3.0.4 (2017-08-04)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **core:** correct type validation message ([09c2b26](https://github.com/conventional-changelog/commitlint/commit/09c2b26))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.0.3"></a>
|
||||||
|
## 3.0.3 (2017-07-16)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.0.2"></a>
|
||||||
|
## 3.0.2 (2017-07-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **cli:** remove destructuring for node 4 support ([fe8caff](https://github.com/conventional-changelog/commitlint/commit/fe8caff))
|
||||||
|
* ensure node4 compat ([bfeb653](https://github.com/conventional-changelog/commitlint/commit/bfeb653))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.1.3"></a>
|
||||||
|
## 3.1.3 (2017-08-21)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **core:** determine git root correctly in sub directories ([#64](https://github.com/conventional-changelog/commitlint/issues/64)) ([d594ec4](https://github.com/conventional-changelog/commitlint/commit/d594ec4)), closes [#62](https://github.com/conventional-changelog/commitlint/issues/62)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.1.2"></a>
|
||||||
|
## 3.1.2 (2017-08-07)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.1.1"></a>
|
||||||
|
## 3.1.1 (2017-08-07)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.0.4"></a>
|
||||||
|
## 3.0.4 (2017-08-04)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **core:** correct type validation message ([09c2b26](https://github.com/conventional-changelog/commitlint/commit/09c2b26))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.0.3"></a>
|
||||||
|
## 3.0.3 (2017-07-16)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.0.2"></a>
|
||||||
|
## 3.0.2 (2017-07-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **cli:** remove destructuring for node 4 support ([fe8caff](https://github.com/conventional-changelog/commitlint/commit/fe8caff))
|
||||||
|
* ensure node4 compat ([bfeb653](https://github.com/conventional-changelog/commitlint/commit/bfeb653))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.1.2"></a>
|
||||||
|
## 3.1.2 (2017-08-07)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.1.1"></a>
|
||||||
|
## 3.1.1 (2017-08-07)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.0.4"></a>
|
||||||
|
## 3.0.4 (2017-08-04)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **core:** correct type validation message ([09c2b26](https://github.com/conventional-changelog/commitlint/commit/09c2b26))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.0.3"></a>
|
||||||
|
## 3.0.3 (2017-07-16)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.0.2"></a>
|
||||||
|
## 3.0.2 (2017-07-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **cli:** remove destructuring for node 4 support ([fe8caff](https://github.com/conventional-changelog/commitlint/commit/fe8caff))
|
||||||
|
* ensure node4 compat ([bfeb653](https://github.com/conventional-changelog/commitlint/commit/bfeb653))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.0.4"></a>
|
||||||
|
## 3.0.4 (2017-08-04)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **core:** correct type validation message ([09c2b26](https://github.com/conventional-changelog/commitlint/commit/09c2b26))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.0.3"></a>
|
||||||
|
## 3.0.3 (2017-07-16)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.0.2"></a>
|
||||||
|
## 3.0.2 (2017-07-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **cli:** remove destructuring for node 4 support ([fe8caff](https://github.com/conventional-changelog/commitlint/commit/fe8caff))
|
||||||
|
* ensure node4 compat ([bfeb653](https://github.com/conventional-changelog/commitlint/commit/bfeb653))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.0.3"></a>
|
||||||
|
## 3.0.3 (2017-07-16)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.0.2"></a>
|
||||||
|
## 3.0.2 (2017-07-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **cli:** remove destructuring for node 4 support ([fe8caff](https://github.com/conventional-changelog/commitlint/commit/fe8caff))
|
||||||
|
* ensure node4 compat ([bfeb653](https://github.com/conventional-changelog/commitlint/commit/bfeb653))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.0.2"></a>
|
||||||
|
## 3.0.2 (2017-07-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **cli:** remove destructuring for node 4 support ([fe8caff](https://github.com/conventional-changelog/commitlint/commit/fe8caff))
|
||||||
|
* ensure node4 compat ([bfeb653](https://github.com/conventional-changelog/commitlint/commit/bfeb653))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.0.1"></a>
|
||||||
|
## 3.0.1 (2017-07-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **cli:** remove destructuring for node 4 support ([fe8caff](https://github.com/conventional-changelog/commitlint/commit/fe8caff))
|
||||||
|
* ensure node4 compat ([bfeb653](https://github.com/conventional-changelog/commitlint/commit/bfeb653))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.0.1"></a>
|
||||||
|
## 3.0.1 (2017-07-11)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.0.0"></a>
|
||||||
|
# 3.0.0 (2017-07-10)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **cli:** remove destructuring for node 4 support ([94437e8](https://github.com/conventional-changelog/commitlint/commit/94437e8))
|
||||||
|
* ensure node4 compat ([a5e658a](https://github.com/conventional-changelog/commitlint/commit/a5e658a))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.0.0"></a>
|
||||||
|
# 3.0.0 (2017-07-10)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **cli:** remove destructuring for node 4 support ([94437e8](https://github.com/conventional-changelog/commitlint/commit/94437e8))
|
||||||
|
* ensure node4 compat ([a5e658a](https://github.com/conventional-changelog/commitlint/commit/a5e658a))
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
> Lint commit messages
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img width="750" src="https://conventional-changelog.github.io/commitlint/assets/commitlint.svg">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
# @commitlint/cli
|
||||||
|
|
||||||
|
## Getting started
|
||||||
|
|
||||||
|
```
|
||||||
|
npm install --save-dev @commitlint/cli @commitlint/config-angular
|
||||||
|
echo "module.exports = {extends: ['@commitlint/config-angular']};" > commitlint.config.js
|
||||||
|
```
|
||||||
|
|
||||||
|
Consult [docs/cli](https://conventional-changelog.github.io/commitlint/#/reference-cli) for comprehensive documentation.
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
#!/usr/bin/env node
|
||||||
|
require('./lib/cli.js');
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
module.exports = path.join(__dirname, 'cli.js');
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2016 - present Mario Nebl
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
{
|
||||||
|
"name": "@commitlint/cli",
|
||||||
|
"version": "13.2.0",
|
||||||
|
"description": "Lint your commit messages",
|
||||||
|
"files": [
|
||||||
|
"index.js",
|
||||||
|
"cli.js",
|
||||||
|
"lib"
|
||||||
|
],
|
||||||
|
"bin": {
|
||||||
|
"commitlint": "./cli.js"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"deps": "dep-check",
|
||||||
|
"pkg": "pkg-check"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=v12"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/conventional-changelog/commitlint.git"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/conventional-changelog/commitlint/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/conventional-changelog/commitlint#readme",
|
||||||
|
"keywords": [
|
||||||
|
"conventional-changelog",
|
||||||
|
"commitlint",
|
||||||
|
"cli"
|
||||||
|
],
|
||||||
|
"author": {
|
||||||
|
"name": "Mario Nebl",
|
||||||
|
"email": "hello@herebecode.com"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"devDependencies": {
|
||||||
|
"@commitlint/test": "^13.2.0",
|
||||||
|
"@commitlint/utils": "^13.2.0",
|
||||||
|
"@types/node": "12.20.27",
|
||||||
|
"@types/yargs": "^17.0.0",
|
||||||
|
"execa": "^5.0.0",
|
||||||
|
"fs-extra": "^10.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@commitlint/format": "^13.2.0",
|
||||||
|
"@commitlint/lint": "^13.2.0",
|
||||||
|
"@commitlint/load": "^13.2.0",
|
||||||
|
"@commitlint/read": "^13.2.0",
|
||||||
|
"@commitlint/types": "^13.2.0",
|
||||||
|
"lodash": "^4.17.19",
|
||||||
|
"resolve-from": "5.0.0",
|
||||||
|
"resolve-global": "1.0.0",
|
||||||
|
"yargs": "^17.0.0"
|
||||||
|
},
|
||||||
|
"gitHead": "65e45339c79e46d01e35ec067edf14d225a3528a"
|
||||||
|
|
||||||
|
,"_resolved": "https://registry.npmjs.org/@commitlint/cli/-/cli-13.2.0.tgz"
|
||||||
|
,"_integrity": "sha512-RqG0cxxiwaL9OgQbA2ZEfZaVIRJmbtsZgnj5G07AjN7///s/40grSN4/kDl8YjUgvAZskPfJRoGGYNvHJ4zHWA=="
|
||||||
|
,"_from": "@commitlint/cli@13.2.0"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,353 @@
|
||||||
|
# Change Log
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
# [13.2.0](https://github.com/conventional-changelog/commitlint/compare/v13.1.0...v13.2.0) (2021-09-28)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/config-conventional
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [13.1.0](https://github.com/conventional-changelog/commitlint/compare/v13.0.0...v13.1.0) (2021-07-24)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **cz-commitlint:** fix minor formatting issues ([99d8881](https://github.com/conventional-changelog/commitlint/commit/99d8881d0d951deded6d9e31bbb279d04101549b))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [13.0.0](https://github.com/conventional-changelog/commitlint/compare/v12.1.4...v13.0.0) (2021-05-24)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add subject-exclamation-mark rule to improve error messages ([#2593](https://github.com/conventional-changelog/commitlint/issues/2593)) ([be701bd](https://github.com/conventional-changelog/commitlint/commit/be701bdb1de4e667b7a872767244285c4fa4fda4))
|
||||||
|
|
||||||
|
|
||||||
|
* chore!: remove node 10 support (#2596) ([4db4ba1](https://github.com/conventional-changelog/commitlint/commit/4db4ba1b0b312410a0f62100a93a80c246a6c410)), closes [#2596](https://github.com/conventional-changelog/commitlint/issues/2596)
|
||||||
|
|
||||||
|
|
||||||
|
### BREAKING CHANGES
|
||||||
|
|
||||||
|
* minimum node version is 12
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [12.1.3](https://github.com/conventional-changelog/commitlint/compare/v12.1.2...v12.1.3) (2021-05-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/config-conventional
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [12.1.2](https://github.com/conventional-changelog/commitlint/compare/v12.1.1...v12.1.2) (2021-04-29)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/config-conventional
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [12.1.1](https://github.com/conventional-changelog/commitlint/compare/v12.1.0...v12.1.1) (2021-04-02)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/config-conventional
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [12.1.0](https://github.com/conventional-changelog/commitlint/compare/v12.0.1...v12.1.0) (2021-03-06)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/config-conventional
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [12.0.1](https://github.com/conventional-changelog/commitlint/compare/v12.0.0...v12.0.1) (2021-02-23)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/config-conventional
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [12.0.0](https://github.com/conventional-changelog/commitlint/compare/v11.0.0...v12.0.0) (2021-01-18)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/config-conventional
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [11.0.0](https://github.com/conventional-changelog/commitlint/compare/v10.0.0...v11.0.0) (2020-09-05)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/config-conventional
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [10.0.0](https://github.com/conventional-changelog/commitlint/compare/v9.1.2...v10.0.0) (2020-08-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* update dependency ([#1993](https://github.com/conventional-changelog/commitlint/issues/1993)) ([32667e8](https://github.com/conventional-changelog/commitlint/commit/32667e8aa665cf94fe669ba048ad7abaf6abac6e))
|
||||||
|
|
||||||
|
|
||||||
|
* refactor!: drop support for node 8 (#1999) ([751f39f](https://github.com/conventional-changelog/commitlint/commit/751f39f284ef232574a176c3c11b1982ee544166)), closes [#1999](https://github.com/conventional-changelog/commitlint/issues/1999)
|
||||||
|
|
||||||
|
|
||||||
|
### BREAKING CHANGES
|
||||||
|
|
||||||
|
* remove node 8 from circle-ci checks
|
||||||
|
|
||||||
|
also remove node 13 because we do not support experimental versions
|
||||||
|
|
||||||
|
* docs: update node v10 to latest LTS 10 version
|
||||||
|
|
||||||
|
Co-authored-by: Cedric van Putten <me@bycedric.com>
|
||||||
|
|
||||||
|
Co-authored-by: Cedric van Putten <me@bycedric.com>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [9.1.2](https://github.com/conventional-changelog/commitlint/compare/v9.1.1...v9.1.2) (2020-07-13)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/config-conventional
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [9.1.1](https://github.com/conventional-changelog/commitlint/compare/v9.1.0...v9.1.1) (2020-06-30)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/config-conventional
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [9.1.0](https://github.com/conventional-changelog/commitlint/compare/v9.0.1...v9.1.0) (2020-06-21)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* update dependency conventional-changelog-conventionalcommits to v4.3.0 ([#1816](https://github.com/conventional-changelog/commitlint/issues/1816)) ([f99aeda](https://github.com/conventional-changelog/commitlint/commit/f99aeda068aabdb250e2c9819da7229a695154b9))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [9.0.1](https://github.com/conventional-changelog/commitlint/compare/v9.0.0...v9.0.1) (2020-05-26)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/config-conventional
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [9.0.0](https://github.com/conventional-changelog/commitlint/compare/v8.3.5...v9.0.0) (2020-05-21)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* drop support for 'improvement' type ([#899](https://github.com/conventional-changelog/commitlint/issues/899)) ([b27ab08](https://github.com/conventional-changelog/commitlint/commit/b27ab08544373cfb72a4808756e2e8126ea96a97))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **config-conventional:** footer/body-max-line ([#436](https://github.com/conventional-changelog/commitlint/issues/436)) ([8b394c9](https://github.com/conventional-changelog/commitlint/commit/8b394c94ffe37322d734bd4944add4a6cb2a4689))
|
||||||
|
* **config-conventional:** increase header-max-length to 100 ([#860](https://github.com/conventional-changelog/commitlint/issues/860)) ([ff11998](https://github.com/conventional-changelog/commitlint/commit/ff11998e0cf6fcd4f03bc18ab27b1bdd6bf21906)), closes [#859](https://github.com/conventional-changelog/commitlint/issues/859)
|
||||||
|
|
||||||
|
|
||||||
|
### BREAKING CHANGES
|
||||||
|
|
||||||
|
* 'improvement' type will now be rejected by this config.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [8.3.4](https://github.com/conventional-changelog/commitlint/compare/v8.3.3...v8.3.4) (2020-01-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/config-conventional
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [8.3.0](https://github.com/conventional-changelog/commitlint/compare/v8.2.0...v8.3.0) (2019-10-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **config-conventional:** use parser with short breaking change support ([#821](https://github.com/conventional-changelog/commitlint/issues/821)) ([4b5300a](https://github.com/conventional-changelog/commitlint/commit/4b5300a))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [8.2.0](https://github.com/conventional-changelog/commitlint/compare/v8.1.0...v8.2.0) (2019-09-16)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/config-conventional
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [8.1.0](https://github.com/conventional-changelog/commitlint/compare/v8.0.0...v8.1.0) (2019-07-15)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/config-conventional
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [7.6.0](https://github.com/conventional-changelog/commitlint/compare/v7.5.2...v7.6.0) (2019-05-06)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/config-conventional
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="7.5.0"></a>
|
||||||
|
# [7.5.0](https://github.com/conventional-changelog/commitlint/compare/v7.4.0...v7.5.0) (2019-01-31)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* all broken website references ([#564](https://github.com/conventional-changelog/commitlint/issues/564)) ([82eeb5a](https://github.com/conventional-changelog/commitlint/commit/82eeb5a))
|
||||||
|
* replace all repository references with conventional changelog ([#561](https://github.com/conventional-changelog/commitlint/issues/561)) ([6c3afcd](https://github.com/conventional-changelog/commitlint/commit/6c3afcd))
|
||||||
|
* replace all website references with conventional changelog ([#563](https://github.com/conventional-changelog/commitlint/issues/563)) ([6b86fb1](https://github.com/conventional-changelog/commitlint/commit/6b86fb1))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="7.3.1"></a>
|
||||||
|
## [7.3.1](https://github.com/conventional-changelog/commitlint/compare/v7.3.0...v7.3.1) (2019-01-11)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/config-conventional
|
||||||
|
|
||||||
|
<a name="7.3.0"></a>
|
||||||
|
# [7.3.0](https://github.com/conventional-changelog/commitlint/compare/v7.2.1...v7.3.0) (2019-01-11)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/config-conventional
|
||||||
|
|
||||||
|
<a name="7.1.2"></a>
|
||||||
|
## [7.1.2](https://github.com/conventional-changelog/commitlint/compare/v7.1.1...v7.1.2) (2018-09-04)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/config-conventional
|
||||||
|
|
||||||
|
<a name="7.1.0"></a>
|
||||||
|
# [7.1.0](https://github.com/conventional-changelog/commitlint/compare/v7.0.1...v7.1.0) (2018-08-29)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/config-conventional
|
||||||
|
|
||||||
|
<a name="6.1.1"></a>
|
||||||
|
## [6.1.1](https://github.com/conventional-changelog/commitlint/compare/v6.1.0...v6.1.1) (2018-02-22)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/config-conventional
|
||||||
|
|
||||||
|
<a name="6.1.0"></a>
|
||||||
|
# [6.1.0](https://github.com/conventional-changelog/commitlint/compare/v6.0.5...v6.1.0) (2018-02-03)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/config-conventional
|
||||||
|
|
||||||
|
<a name="6.0.4"></a>
|
||||||
|
## [6.0.4](https://github.com/conventional-changelog/commitlint/compare/v6.0.3...v6.0.4) (2018-01-31)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/config-conventional
|
||||||
|
|
||||||
|
<a name="6.0.3"></a>
|
||||||
|
## [6.0.3](https://github.com/conventional-changelog/commitlint/compare/v6.0.2...v6.0.3) (2018-01-31)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/config-conventional
|
||||||
|
|
||||||
|
<a name="6.0.2"></a>
|
||||||
|
## [6.0.2](https://github.com/conventional-changelog/commitlint/compare/v6.0.0...v6.0.2) (2018-01-12)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/config-conventional
|
||||||
|
|
||||||
|
<a name="5.2.3"></a>
|
||||||
|
## [5.2.3](https://github.com/conventional-changelog/commitlint/compare/v5.2.2...v5.2.3) (2017-12-05)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/config-conventional
|
||||||
|
|
||||||
|
<a name="5.1.3"></a>
|
||||||
|
## [5.1.3](https://github.com/conventional-changelog/commitlint/compare/v5.1.2...v5.1.3) (2017-11-24)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **config-conventional:** add missing applicable attribute to type-enum ([a8db0b1](https://github.com/conventional-changelog/commitlint/commit/a8db0b1))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="5.1.1"></a>
|
||||||
|
## [5.1.1](https://github.com/conventional-changelog/commitlint/compare/v5.1.0...v5.1.1) (2017-11-24)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* set access for npm ([8aeaec2](https://github.com/conventional-changelog/commitlint/commit/8aeaec2))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="5.1.0"></a>
|
||||||
|
# [5.1.0](https://github.com/conventional-changelog/commitlint/compare/v5.0.2...v5.1.0) (2017-11-24)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **config-conventional:** remove unneeded dependency ([d0e62fd](https://github.com/conventional-changelog/commitlint/commit/d0e62fd))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add conventional-changelog package ([8bb0a85](https://github.com/conventional-changelog/commitlint/commit/8bb0a85))
|
||||||
|
|
@ -0,0 +1,224 @@
|
||||||
|
> Lint your conventional commits
|
||||||
|
|
||||||
|
# @commitlint/config-conventional
|
||||||
|
|
||||||
|
Shareable `commitlint` config enforcing [conventional commits](https://conventionalcommits.org/).
|
||||||
|
Use with [@commitlint/cli](https://npm.im/@commitlint/cli) and [@commitlint/prompt-cli](https://npm.im/@commitlint/prompt-cli).
|
||||||
|
|
||||||
|
## Getting started
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm install --save-dev @commitlint/config-conventional @commitlint/cli
|
||||||
|
echo "module.exports = {extends: ['@commitlint/config-conventional']};" > commitlint.config.js
|
||||||
|
```
|
||||||
|
|
||||||
|
## Rules
|
||||||
|
|
||||||
|
### Problems
|
||||||
|
|
||||||
|
The following rules are considered problems for `@commitlint/config-conventional` and will yield a non-zero exit code when not met.
|
||||||
|
|
||||||
|
Consult [docs/rules](https://conventional-changelog.github.io/commitlint/#/reference-rules) for a list of available rules.
|
||||||
|
|
||||||
|
#### type-enum
|
||||||
|
|
||||||
|
- **condition**: `type` is found in value
|
||||||
|
- **rule**: `always`
|
||||||
|
- **level**: `error`
|
||||||
|
- **value**
|
||||||
|
|
||||||
|
```
|
||||||
|
[
|
||||||
|
'build',
|
||||||
|
'chore',
|
||||||
|
'ci',
|
||||||
|
'docs',
|
||||||
|
'feat',
|
||||||
|
'fix',
|
||||||
|
'perf',
|
||||||
|
'refactor',
|
||||||
|
'revert',
|
||||||
|
'style',
|
||||||
|
'test'
|
||||||
|
];
|
||||||
|
```
|
||||||
|
|
||||||
|
```sh
|
||||||
|
echo "foo: some message" # fails
|
||||||
|
echo "fix: some message" # passes
|
||||||
|
```
|
||||||
|
|
||||||
|
#### type-case
|
||||||
|
|
||||||
|
- **description**: `type` is in case `value`
|
||||||
|
- **rule**: `always`
|
||||||
|
- **level**: `error`
|
||||||
|
- **value**
|
||||||
|
```
|
||||||
|
'lowerCase'
|
||||||
|
```
|
||||||
|
|
||||||
|
```sh
|
||||||
|
echo "FIX: some message" # fails
|
||||||
|
echo "fix: some message" # passes
|
||||||
|
```
|
||||||
|
|
||||||
|
#### type-empty
|
||||||
|
|
||||||
|
- **condition**: `type` is empty
|
||||||
|
- **rule**: `never`
|
||||||
|
- **level**: `error`
|
||||||
|
|
||||||
|
```sh
|
||||||
|
echo ": some message" # fails
|
||||||
|
echo "fix: some message" # passes
|
||||||
|
```
|
||||||
|
|
||||||
|
#### scope-case
|
||||||
|
|
||||||
|
- **condition**: `scope` is in case `value`
|
||||||
|
- **rule**: `always`
|
||||||
|
- **level**: `error`
|
||||||
|
|
||||||
|
```
|
||||||
|
'lowerCase'
|
||||||
|
```
|
||||||
|
|
||||||
|
```sh
|
||||||
|
echo "fix(SCOPE): some message" # fails
|
||||||
|
echo "fix(scope): some message" # passes
|
||||||
|
```
|
||||||
|
|
||||||
|
#### subject-case
|
||||||
|
|
||||||
|
- **condition**: `subject` is in one of the cases `['sentence-case', 'start-case', 'pascal-case', 'upper-case']`
|
||||||
|
- **rule**: `never`
|
||||||
|
- **level**: `error`
|
||||||
|
|
||||||
|
```sh
|
||||||
|
echo "fix(SCOPE): Some message" # fails
|
||||||
|
echo "fix(SCOPE): Some Message" # fails
|
||||||
|
echo "fix(SCOPE): SomeMessage" # fails
|
||||||
|
echo "fix(SCOPE): SOMEMESSAGE" # fails
|
||||||
|
echo "fix(scope): some message" # passes
|
||||||
|
echo "fix(scope): some Message" # passes
|
||||||
|
```
|
||||||
|
|
||||||
|
#### subject-empty
|
||||||
|
|
||||||
|
- **condition**: `subject` is empty
|
||||||
|
- **rule**: `never`
|
||||||
|
- **level**: `error`
|
||||||
|
|
||||||
|
```sh
|
||||||
|
echo "fix:" # fails
|
||||||
|
echo "fix: some message" # passes
|
||||||
|
```
|
||||||
|
|
||||||
|
#### subject-full-stop
|
||||||
|
|
||||||
|
- **condition**: `subject` ends with `value`
|
||||||
|
- **rule**: `never`
|
||||||
|
- **level**: `error`
|
||||||
|
- **value**
|
||||||
|
|
||||||
|
```
|
||||||
|
'.'
|
||||||
|
```
|
||||||
|
|
||||||
|
```sh
|
||||||
|
echo "fix: some message." # fails
|
||||||
|
echo "fix: some message" # passes
|
||||||
|
```
|
||||||
|
|
||||||
|
#### header-max-length
|
||||||
|
|
||||||
|
- **condition**: `header` has `value` or less characters
|
||||||
|
- **rule**: `always`
|
||||||
|
- **level**: `error`
|
||||||
|
- **value**
|
||||||
|
|
||||||
|
```
|
||||||
|
100
|
||||||
|
```
|
||||||
|
|
||||||
|
```sh
|
||||||
|
echo "fix: some message that is way too long and breaks the line max-length by several characters" # fails
|
||||||
|
echo "fix: some message" # passes
|
||||||
|
```
|
||||||
|
|
||||||
|
#### footer-leading-blank
|
||||||
|
|
||||||
|
- **condition**: `footer` should have a leading blank line
|
||||||
|
- **rule**: `always`
|
||||||
|
- level: `warning`
|
||||||
|
|
||||||
|
```sh
|
||||||
|
echo "fix: some message
|
||||||
|
BREAKING CHANGE: It will be significant" # warning
|
||||||
|
|
||||||
|
echo "fix: some message
|
||||||
|
|
||||||
|
BREAKING CHANGE: It will be significant" # passes
|
||||||
|
```
|
||||||
|
|
||||||
|
#### footer-max-line-length
|
||||||
|
|
||||||
|
- **condition**: `footer` each line has `value` or less characters
|
||||||
|
- **rule**: `always`
|
||||||
|
- level: `error`
|
||||||
|
- **value**
|
||||||
|
|
||||||
|
```
|
||||||
|
100
|
||||||
|
```
|
||||||
|
|
||||||
|
```sh
|
||||||
|
echo "fix: some message
|
||||||
|
|
||||||
|
BREAKING CHANGE: footer with multiple lines
|
||||||
|
has a message that is way too long and will break the line rule 'line-max-length' by several characters" # fails
|
||||||
|
|
||||||
|
echo "fix: some message
|
||||||
|
|
||||||
|
BREAKING CHANGE: footer with multiple lines
|
||||||
|
but still no line is too long" # passes
|
||||||
|
```
|
||||||
|
|
||||||
|
#### body-leading-blank
|
||||||
|
|
||||||
|
- **condition**: `body` should have a leading blank line
|
||||||
|
- **rule**: `always`
|
||||||
|
- level: `warning`
|
||||||
|
|
||||||
|
```sh
|
||||||
|
echo "fix: some message
|
||||||
|
body" # warning
|
||||||
|
|
||||||
|
echo "fix: some message
|
||||||
|
|
||||||
|
body" # passes
|
||||||
|
```
|
||||||
|
|
||||||
|
#### body-max-line-length
|
||||||
|
|
||||||
|
- **condition**: `body` each line has `value` or less characters
|
||||||
|
- **rule**: `always`
|
||||||
|
- level: `error`
|
||||||
|
- **value**
|
||||||
|
|
||||||
|
```
|
||||||
|
100
|
||||||
|
```
|
||||||
|
|
||||||
|
```sh
|
||||||
|
echo "fix: some message
|
||||||
|
|
||||||
|
body with multiple lines
|
||||||
|
has a message that is way too long and will break the line rule 'line-max-length' by several characters" # fails
|
||||||
|
|
||||||
|
echo "fix: some message
|
||||||
|
|
||||||
|
body with multiple lines
|
||||||
|
but still no line is too long" # passes
|
||||||
|
```
|
||||||
|
|
@ -0,0 +1,135 @@
|
||||||
|
module.exports = {
|
||||||
|
parserPreset: 'conventional-changelog-conventionalcommits',
|
||||||
|
rules: {
|
||||||
|
'body-leading-blank': [1, 'always'],
|
||||||
|
'body-max-line-length': [2, 'always', 100],
|
||||||
|
'footer-leading-blank': [1, 'always'],
|
||||||
|
'footer-max-line-length': [2, 'always', 100],
|
||||||
|
'header-max-length': [2, 'always', 100],
|
||||||
|
'subject-case': [
|
||||||
|
2,
|
||||||
|
'never',
|
||||||
|
['sentence-case', 'start-case', 'pascal-case', 'upper-case'],
|
||||||
|
],
|
||||||
|
'subject-empty': [2, 'never'],
|
||||||
|
'subject-full-stop': [2, 'never', '.'],
|
||||||
|
'type-case': [2, 'always', 'lower-case'],
|
||||||
|
'type-empty': [2, 'never'],
|
||||||
|
'type-enum': [
|
||||||
|
2,
|
||||||
|
'always',
|
||||||
|
[
|
||||||
|
'build',
|
||||||
|
'chore',
|
||||||
|
'ci',
|
||||||
|
'docs',
|
||||||
|
'feat',
|
||||||
|
'fix',
|
||||||
|
'perf',
|
||||||
|
'refactor',
|
||||||
|
'revert',
|
||||||
|
'style',
|
||||||
|
'test',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
},
|
||||||
|
prompt: {
|
||||||
|
questions: {
|
||||||
|
type: {
|
||||||
|
description: "Select the type of change that you're committing",
|
||||||
|
enum: {
|
||||||
|
feat: {
|
||||||
|
description: 'A new feature',
|
||||||
|
title: 'Features',
|
||||||
|
emoji: '✨',
|
||||||
|
},
|
||||||
|
fix: {
|
||||||
|
description: 'A bug fix',
|
||||||
|
title: 'Bug Fixes',
|
||||||
|
emoji: '🐛',
|
||||||
|
},
|
||||||
|
docs: {
|
||||||
|
description: 'Documentation only changes',
|
||||||
|
title: 'Documentation',
|
||||||
|
emoji: '📚',
|
||||||
|
},
|
||||||
|
style: {
|
||||||
|
description:
|
||||||
|
'Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)',
|
||||||
|
title: 'Styles',
|
||||||
|
emoji: '💎',
|
||||||
|
},
|
||||||
|
refactor: {
|
||||||
|
description:
|
||||||
|
'A code change that neither fixes a bug nor adds a feature',
|
||||||
|
title: 'Code Refactoring',
|
||||||
|
emoji: '📦',
|
||||||
|
},
|
||||||
|
perf: {
|
||||||
|
description: 'A code change that improves performance',
|
||||||
|
title: 'Performance Improvements',
|
||||||
|
emoji: '🚀',
|
||||||
|
},
|
||||||
|
test: {
|
||||||
|
description: 'Adding missing tests or correcting existing tests',
|
||||||
|
title: 'Tests',
|
||||||
|
emoji: '🚨',
|
||||||
|
},
|
||||||
|
build: {
|
||||||
|
description:
|
||||||
|
'Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)',
|
||||||
|
title: 'Builds',
|
||||||
|
emoji: '🛠',
|
||||||
|
},
|
||||||
|
ci: {
|
||||||
|
description:
|
||||||
|
'Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)',
|
||||||
|
title: 'Continuous Integrations',
|
||||||
|
emoji: '⚙️',
|
||||||
|
},
|
||||||
|
chore: {
|
||||||
|
description: "Other changes that don't modify src or test files",
|
||||||
|
title: 'Chores',
|
||||||
|
emoji: '♻️',
|
||||||
|
},
|
||||||
|
revert: {
|
||||||
|
description: 'Reverts a previous commit',
|
||||||
|
title: 'Reverts',
|
||||||
|
emoji: '🗑',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
scope: {
|
||||||
|
description:
|
||||||
|
'What is the scope of this change (e.g. component or file name)',
|
||||||
|
},
|
||||||
|
subject: {
|
||||||
|
description:
|
||||||
|
'Write a short, imperative tense description of the change',
|
||||||
|
},
|
||||||
|
body: {
|
||||||
|
description: 'Provide a longer description of the change',
|
||||||
|
},
|
||||||
|
isBreaking: {
|
||||||
|
description: 'Are there any breaking changes?',
|
||||||
|
},
|
||||||
|
breakingBody: {
|
||||||
|
description:
|
||||||
|
'A BREAKING CHANGE commit requires a body. Please enter a longer description of the commit itself',
|
||||||
|
},
|
||||||
|
breaking: {
|
||||||
|
description: 'Describe the breaking changes',
|
||||||
|
},
|
||||||
|
isIssueAffected: {
|
||||||
|
description: 'Does this change affect any open issues?',
|
||||||
|
},
|
||||||
|
issuesBody: {
|
||||||
|
description:
|
||||||
|
'If issues are closed, the commit requires a body. Please enter a longer description of the commit itself',
|
||||||
|
},
|
||||||
|
issues: {
|
||||||
|
description: 'Add issue references (e.g. "fix #123", "re #123".)',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2016 - present Mario Nebl
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
{
|
||||||
|
"name": "@commitlint/config-conventional",
|
||||||
|
"version": "13.2.0",
|
||||||
|
"description": "Shareable commitlint config enforcing conventional commits",
|
||||||
|
"files": [
|
||||||
|
"index.js"
|
||||||
|
],
|
||||||
|
"scripts": {
|
||||||
|
"deps": "dep-check",
|
||||||
|
"pkg": "pkg-check"
|
||||||
|
},
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/conventional-changelog/commitlint.git"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"conventional-changelog",
|
||||||
|
"commitlint",
|
||||||
|
"commitlint-config",
|
||||||
|
"angular"
|
||||||
|
],
|
||||||
|
"author": "Mario Nebl <hello@herebecode.com>",
|
||||||
|
"license": "MIT",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/conventional-changelog/commitlint/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/conventional-changelog/commitlint#readme",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=v12"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@commitlint/lint": "^13.2.0",
|
||||||
|
"@commitlint/utils": "^13.2.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"conventional-changelog-conventionalcommits": "^4.3.1"
|
||||||
|
},
|
||||||
|
"gitHead": "65e45339c79e46d01e35ec067edf14d225a3528a"
|
||||||
|
|
||||||
|
,"_resolved": "https://registry.npmjs.org/@commitlint/config-conventional/-/config-conventional-13.2.0.tgz"
|
||||||
|
,"_integrity": "sha512-7u7DdOiF+3qSdDlbQGfpvCH8DCQdLFvnI2+VucYmmV7E92iD6t9PBj+UjIoSQCaMAzYp27Vkall78AkcXBh6Xw=="
|
||||||
|
,"_from": "@commitlint/config-conventional@13.2.0"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,312 @@
|
||||||
|
# Change Log
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
# [13.2.0](https://github.com/conventional-changelog/commitlint/compare/v13.1.0...v13.2.0) (2021-09-28)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/ensure
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [13.1.0](https://github.com/conventional-changelog/commitlint/compare/v13.0.0...v13.1.0) (2021-07-24)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/ensure
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [13.0.0](https://github.com/conventional-changelog/commitlint/compare/v12.1.4...v13.0.0) (2021-05-24)
|
||||||
|
|
||||||
|
|
||||||
|
* chore!: remove node 10 support (#2596) ([4db4ba1](https://github.com/conventional-changelog/commitlint/commit/4db4ba1b0b312410a0f62100a93a80c246a6c410)), closes [#2596](https://github.com/conventional-changelog/commitlint/issues/2596)
|
||||||
|
|
||||||
|
|
||||||
|
### BREAKING CHANGES
|
||||||
|
|
||||||
|
* minimum node version is 12
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [12.1.3](https://github.com/conventional-changelog/commitlint/compare/v12.1.2...v12.1.3) (2021-05-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/ensure
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [12.1.2](https://github.com/conventional-changelog/commitlint/compare/v12.1.1...v12.1.2) (2021-04-29)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/ensure
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [12.1.1](https://github.com/conventional-changelog/commitlint/compare/v12.1.0...v12.1.1) (2021-04-02)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/ensure
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [12.0.1](https://github.com/conventional-changelog/commitlint/compare/v12.0.0...v12.0.1) (2021-02-23)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/ensure
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [12.0.0](https://github.com/conventional-changelog/commitlint/compare/v11.0.0...v12.0.0) (2021-01-18)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/ensure
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [11.0.0](https://github.com/conventional-changelog/commitlint/compare/v10.0.0...v11.0.0) (2020-09-05)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/ensure
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [10.0.0](https://github.com/conventional-changelog/commitlint/compare/v9.1.2...v10.0.0) (2020-08-16)
|
||||||
|
|
||||||
|
|
||||||
|
* refactor!: drop support for node 8 (#1999) ([751f39f](https://github.com/conventional-changelog/commitlint/commit/751f39f284ef232574a176c3c11b1982ee544166)), closes [#1999](https://github.com/conventional-changelog/commitlint/issues/1999)
|
||||||
|
|
||||||
|
|
||||||
|
### BREAKING CHANGES
|
||||||
|
|
||||||
|
* remove node 8 from circle-ci checks
|
||||||
|
|
||||||
|
also remove node 13 because we do not support experimental versions
|
||||||
|
|
||||||
|
* docs: update node v10 to latest LTS 10 version
|
||||||
|
|
||||||
|
Co-authored-by: Cedric van Putten <me@bycedric.com>
|
||||||
|
|
||||||
|
Co-authored-by: Cedric van Putten <me@bycedric.com>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [9.1.2](https://github.com/conventional-changelog/commitlint/compare/v9.1.1...v9.1.2) (2020-07-13)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/ensure
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [9.1.1](https://github.com/conventional-changelog/commitlint/compare/v9.1.0...v9.1.1) (2020-06-30)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/ensure
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [9.1.0](https://github.com/conventional-changelog/commitlint/compare/v9.0.1...v9.1.0) (2020-06-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/ensure
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [9.0.1](https://github.com/conventional-changelog/commitlint/compare/v9.0.0...v9.0.1) (2020-05-26)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/ensure
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [9.0.0](https://github.com/conventional-changelog/commitlint/compare/v8.3.5...v9.0.0) (2020-05-21)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* [#840](https://github.com/conventional-changelog/commitlint/issues/840) add caret to lodash versions ([#843](https://github.com/conventional-changelog/commitlint/issues/843)) ([ffc0bac](https://github.com/conventional-changelog/commitlint/commit/ffc0bac26993acb2ab6a8fa51065f93c92b0d644))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [8.3.4](https://github.com/conventional-changelog/commitlint/compare/v8.3.3...v8.3.4) (2020-01-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/ensure
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [8.3.0](https://github.com/conventional-changelog/commitlint/compare/v8.2.0...v8.3.0) (2019-10-16)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/ensure
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [8.2.0](https://github.com/conventional-changelog/commitlint/compare/v8.1.0...v8.2.0) (2019-09-16)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/ensure
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [8.1.0](https://github.com/conventional-changelog/commitlint/compare/v8.0.0...v8.1.0) (2019-07-15)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/ensure
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [7.6.0](https://github.com/conventional-changelog/commitlint/compare/v7.5.2...v7.6.0) (2019-05-06)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/ensure
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [7.5.2](https://github.com/conventional-changelog/commitlint/compare/v7.5.1...v7.5.2) (2019-02-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* failing sentence-case for subjects with slashes ([#574](https://github.com/conventional-changelog/commitlint/issues/574)) ([48a8602](https://github.com/conventional-changelog/commitlint/commit/48a8602))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="7.5.0"></a>
|
||||||
|
# [7.5.0](https://github.com/conventional-changelog/commitlint/compare/v7.4.0...v7.5.0) (2019-01-31)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* `sentence-case` allow upper-case characters in first word ([#531](https://github.com/conventional-changelog/commitlint/issues/531)) ([5a6a4a8](https://github.com/conventional-changelog/commitlint/commit/5a6a4a8)), closes [#211](https://github.com/conventional-changelog/commitlint/issues/211)
|
||||||
|
* replace all repository references with conventional changelog ([#561](https://github.com/conventional-changelog/commitlint/issues/561)) ([6c3afcd](https://github.com/conventional-changelog/commitlint/commit/6c3afcd))
|
||||||
|
* slash in scope [#291](https://github.com/conventional-changelog/commitlint/issues/291) ([#529](https://github.com/conventional-changelog/commitlint/issues/529)) ([b2b63e5](https://github.com/conventional-changelog/commitlint/commit/b2b63e5))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="7.3.1"></a>
|
||||||
|
## [7.3.1](https://github.com/conventional-changelog/commitlint/compare/v7.3.0...v7.3.1) (2019-01-11)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/ensure
|
||||||
|
|
||||||
|
<a name="7.3.0"></a>
|
||||||
|
# [7.3.0](https://github.com/conventional-changelog/commitlint/compare/v7.2.1...v7.3.0) (2019-01-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* fall back to conventional commit-parser settings for missing keys ([#496](https://github.com/conventional-changelog/commitlint/issues/496)) ([831a141](https://github.com/conventional-changelog/commitlint/commit/831a141)), closes [#399](https://github.com/conventional-changelog/commitlint/issues/399)
|
||||||
|
* update to security-patched dependency versions ([97c033b](https://github.com/conventional-changelog/commitlint/commit/97c033b))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="7.2.0"></a>
|
||||||
|
# [7.2.0](https://github.com/conventional-changelog/commitlint/compare/v7.1.2...v7.2.0) (2018-10-05)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* handle case rules for numerics correctly ([cadcfed](https://github.com/conventional-changelog/commitlint/commit/cadcfed))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="7.1.2"></a>
|
||||||
|
## [7.1.2](https://github.com/conventional-changelog/commitlint/compare/v7.1.1...v7.1.2) (2018-09-04)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/ensure
|
||||||
|
|
||||||
|
<a name="7.1.0"></a>
|
||||||
|
# [7.1.0](https://github.com/conventional-changelog/commitlint/compare/v7.0.1...v7.1.0) (2018-08-29)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add max line length to body/footer ([542f50e](https://github.com/conventional-changelog/commitlint/commit/542f50e))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="6.1.1"></a>
|
||||||
|
## [6.1.1](https://github.com/conventional-changelog/commitlint/compare/v6.1.0...v6.1.1) (2018-02-22)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **ensure:** ignore word delimiters for case matching [#291](https://github.com/conventional-changelog/commitlint/issues/291) ([fa69299](https://github.com/conventional-changelog/commitlint/commit/fa69299))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="6.1.0"></a>
|
||||||
|
# [6.1.0](https://github.com/conventional-changelog/commitlint/compare/v6.0.5...v6.1.0) (2018-02-03)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/ensure
|
||||||
|
|
||||||
|
<a name="6.0.4"></a>
|
||||||
|
## [6.0.4](https://github.com/conventional-changelog/commitlint/compare/v6.0.3...v6.0.4) (2018-01-31)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/ensure
|
||||||
|
|
||||||
|
<a name="6.0.3"></a>
|
||||||
|
## [6.0.3](https://github.com/conventional-changelog/commitlint/compare/v6.0.2...v6.0.3) (2018-01-31)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/ensure
|
||||||
|
|
||||||
|
<a name="6.0.2"></a>
|
||||||
|
## [6.0.2](https://github.com/conventional-changelog/commitlint/compare/v6.0.0...v6.0.2) (2018-01-12)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/ensure
|
||||||
|
|
||||||
|
<a name="6.0.0"></a>
|
||||||
|
# [6.0.0](https://github.com/conventional-changelog/commitlint/compare/v5.2.6...v6.0.0) (2018-01-09)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* sanitize ensure.case [#211](https://github.com/conventional-changelog/commitlint/issues/211) ([#217](https://github.com/conventional-changelog/commitlint/issues/217)) ([03aeefc](https://github.com/conventional-changelog/commitlint/commit/03aeefc))
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2016 - present Mario Nebl
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
{
|
||||||
|
"name": "@commitlint/ensure",
|
||||||
|
"version": "13.2.0",
|
||||||
|
"description": "Lint your commit messages",
|
||||||
|
"main": "lib/index.js",
|
||||||
|
"types": "lib/index.d.ts",
|
||||||
|
"files": [
|
||||||
|
"lib/"
|
||||||
|
],
|
||||||
|
"scripts": {
|
||||||
|
"deps": "dep-check",
|
||||||
|
"pkg": "pkg-check"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=v12"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/conventional-changelog/commitlint.git"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/conventional-changelog/commitlint/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/conventional-changelog/commitlint#readme",
|
||||||
|
"keywords": [
|
||||||
|
"conventional-changelog",
|
||||||
|
"commitlint",
|
||||||
|
"library",
|
||||||
|
"core"
|
||||||
|
],
|
||||||
|
"author": {
|
||||||
|
"name": "Mario Nebl",
|
||||||
|
"email": "hello@herebecode.com"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"devDependencies": {
|
||||||
|
"@commitlint/utils": "^13.2.0",
|
||||||
|
"@types/lodash": "^4.14.161",
|
||||||
|
"globby": "^11.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@commitlint/types": "^13.2.0",
|
||||||
|
"lodash": "^4.17.19"
|
||||||
|
},
|
||||||
|
"gitHead": "65e45339c79e46d01e35ec067edf14d225a3528a"
|
||||||
|
|
||||||
|
,"_resolved": "https://registry.npmjs.org/@commitlint/ensure/-/ensure-13.2.0.tgz"
|
||||||
|
,"_integrity": "sha512-rqhT62RehdLTRBu8OrPHnRCCd/7RmHEE4TiTlT4BLlr5ls5jlZhecOQWJ8np872uCNirrJ5NFjnjYYdbkNoW9Q=="
|
||||||
|
,"_from": "@commitlint/ensure@13.2.0"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,251 @@
|
||||||
|
# Change Log
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
# [13.2.0](https://github.com/conventional-changelog/commitlint/compare/v13.1.0...v13.2.0) (2021-09-28)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/execute-rule
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [13.0.0](https://github.com/conventional-changelog/commitlint/compare/v12.1.4...v13.0.0) (2021-05-24)
|
||||||
|
|
||||||
|
|
||||||
|
* chore!: remove node 10 support (#2596) ([4db4ba1](https://github.com/conventional-changelog/commitlint/commit/4db4ba1b0b312410a0f62100a93a80c246a6c410)), closes [#2596](https://github.com/conventional-changelog/commitlint/issues/2596)
|
||||||
|
|
||||||
|
|
||||||
|
### BREAKING CHANGES
|
||||||
|
|
||||||
|
* minimum node version is 12
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [12.1.3](https://github.com/conventional-changelog/commitlint/compare/v12.1.2...v12.1.3) (2021-05-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/execute-rule
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [12.1.1](https://github.com/conventional-changelog/commitlint/compare/v12.1.0...v12.1.1) (2021-04-02)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/execute-rule
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [12.0.1](https://github.com/conventional-changelog/commitlint/compare/v12.0.0...v12.0.1) (2021-02-23)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/execute-rule
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [12.0.0](https://github.com/conventional-changelog/commitlint/compare/v11.0.0...v12.0.0) (2021-01-18)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/execute-rule
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [11.0.0](https://github.com/conventional-changelog/commitlint/compare/v10.0.0...v11.0.0) (2020-09-05)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/execute-rule
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [10.0.0](https://github.com/conventional-changelog/commitlint/compare/v9.1.2...v10.0.0) (2020-08-16)
|
||||||
|
|
||||||
|
|
||||||
|
* refactor!: drop support for node 8 (#1999) ([751f39f](https://github.com/conventional-changelog/commitlint/commit/751f39f284ef232574a176c3c11b1982ee544166)), closes [#1999](https://github.com/conventional-changelog/commitlint/issues/1999)
|
||||||
|
|
||||||
|
|
||||||
|
### BREAKING CHANGES
|
||||||
|
|
||||||
|
* remove node 8 from circle-ci checks
|
||||||
|
|
||||||
|
also remove node 13 because we do not support experimental versions
|
||||||
|
|
||||||
|
* docs: update node v10 to latest LTS 10 version
|
||||||
|
|
||||||
|
Co-authored-by: Cedric van Putten <me@bycedric.com>
|
||||||
|
|
||||||
|
Co-authored-by: Cedric van Putten <me@bycedric.com>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [9.1.2](https://github.com/conventional-changelog/commitlint/compare/v9.1.1...v9.1.2) (2020-07-13)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/execute-rule
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [9.1.1](https://github.com/conventional-changelog/commitlint/compare/v9.1.0...v9.1.1) (2020-06-30)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/execute-rule
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [9.1.0](https://github.com/conventional-changelog/commitlint/compare/v9.0.1...v9.1.0) (2020-06-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/execute-rule
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [9.0.1](https://github.com/conventional-changelog/commitlint/compare/v9.0.0...v9.0.1) (2020-05-26)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/execute-rule
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [9.0.0](https://github.com/conventional-changelog/commitlint/compare/v8.3.5...v9.0.0) (2020-05-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/execute-rule
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [8.3.4](https://github.com/conventional-changelog/commitlint/compare/v8.3.3...v8.3.4) (2020-01-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/execute-rule
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [8.3.0](https://github.com/conventional-changelog/commitlint/compare/v8.2.0...v8.3.0) (2019-10-16)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/execute-rule
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [8.2.0](https://github.com/conventional-changelog/commitlint/compare/v8.1.0...v8.2.0) (2019-09-16)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/execute-rule
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [8.1.0](https://github.com/conventional-changelog/commitlint/compare/v8.0.0...v8.1.0) (2019-07-15)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/execute-rule
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [7.6.0](https://github.com/conventional-changelog/commitlint/compare/v7.5.2...v7.6.0) (2019-05-06)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/execute-rule
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="7.5.0"></a>
|
||||||
|
# [7.5.0](https://github.com/conventional-changelog/commitlint/compare/v7.4.0...v7.5.0) (2019-01-31)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* replace all repository references with conventional changelog ([#561](https://github.com/conventional-changelog/commitlint/issues/561)) ([6c3afcd](https://github.com/conventional-changelog/commitlint/commit/6c3afcd))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="7.3.1"></a>
|
||||||
|
## [7.3.1](https://github.com/conventional-changelog/commitlint/compare/v7.3.0...v7.3.1) (2019-01-11)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/execute-rule
|
||||||
|
|
||||||
|
<a name="7.3.0"></a>
|
||||||
|
# [7.3.0](https://github.com/conventional-changelog/commitlint/compare/v7.2.1...v7.3.0) (2019-01-11)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/execute-rule
|
||||||
|
|
||||||
|
<a name="7.1.2"></a>
|
||||||
|
## [7.1.2](https://github.com/conventional-changelog/commitlint/compare/v7.1.1...v7.1.2) (2018-09-04)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/execute-rule
|
||||||
|
|
||||||
|
<a name="6.1.1"></a>
|
||||||
|
## [6.1.1](https://github.com/conventional-changelog/commitlint/compare/v6.1.0...v6.1.1) (2018-02-22)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/execute-rule
|
||||||
|
|
||||||
|
<a name="6.1.0"></a>
|
||||||
|
# [6.1.0](https://github.com/conventional-changelog/commitlint/compare/v6.0.5...v6.1.0) (2018-02-03)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/execute-rule
|
||||||
|
|
||||||
|
<a name="6.0.4"></a>
|
||||||
|
## [6.0.4](https://github.com/conventional-changelog/commitlint/compare/v6.0.3...v6.0.4) (2018-01-31)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/execute-rule
|
||||||
|
|
||||||
|
<a name="6.0.3"></a>
|
||||||
|
## [6.0.3](https://github.com/conventional-changelog/commitlint/compare/v6.0.2...v6.0.3) (2018-01-31)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/execute-rule
|
||||||
|
|
||||||
|
<a name="6.0.2"></a>
|
||||||
|
## [6.0.2](https://github.com/conventional-changelog/commitlint/compare/v6.0.0...v6.0.2) (2018-01-12)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/execute-rule
|
||||||
|
|
||||||
|
<a name="6.0.0"></a>
|
||||||
|
# [6.0.0](https://github.com/conventional-changelog/commitlint/compare/v5.2.6...v6.0.0) (2018-01-09)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/execute-rule
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2016 - present Mario Nebl
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
{
|
||||||
|
"name": "@commitlint/execute-rule",
|
||||||
|
"version": "13.2.0",
|
||||||
|
"description": "Lint your commit messages",
|
||||||
|
"main": "lib/index.js",
|
||||||
|
"types": "lib/index.d.ts",
|
||||||
|
"files": [
|
||||||
|
"lib/"
|
||||||
|
],
|
||||||
|
"scripts": {
|
||||||
|
"deps": "dep-check",
|
||||||
|
"pkg": "pkg-check"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=v12"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/conventional-changelog/commitlint.git"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/conventional-changelog/commitlint/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/conventional-changelog/commitlint#readme",
|
||||||
|
"keywords": [
|
||||||
|
"conventional-changelog",
|
||||||
|
"commitlint",
|
||||||
|
"library",
|
||||||
|
"core"
|
||||||
|
],
|
||||||
|
"author": {
|
||||||
|
"name": "Mario Nebl",
|
||||||
|
"email": "hello@herebecode.com"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"devDependencies": {
|
||||||
|
"@commitlint/utils": "^13.2.0"
|
||||||
|
},
|
||||||
|
"gitHead": "65e45339c79e46d01e35ec067edf14d225a3528a"
|
||||||
|
|
||||||
|
,"_resolved": "https://registry.npmjs.org/@commitlint/execute-rule/-/execute-rule-13.2.0.tgz"
|
||||||
|
,"_integrity": "sha512-6nPwpN0hwTYmsH3WM4hCdN+NrMopgRIuQ0aqZa+jnwMoS/g6ljliQNYfL+m5WO306BaIu1W3yYpbW5aI8gEr0g=="
|
||||||
|
,"_from": "@commitlint/execute-rule@13.2.0"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,281 @@
|
||||||
|
# Change Log
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
# [13.2.0](https://github.com/conventional-changelog/commitlint/compare/v13.1.0...v13.2.0) (2021-09-28)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/format
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [13.1.0](https://github.com/conventional-changelog/commitlint/compare/v13.0.0...v13.1.0) (2021-07-24)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/format
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [13.0.0](https://github.com/conventional-changelog/commitlint/compare/v12.1.4...v13.0.0) (2021-05-24)
|
||||||
|
|
||||||
|
|
||||||
|
* chore!: remove node 10 support (#2596) ([4db4ba1](https://github.com/conventional-changelog/commitlint/commit/4db4ba1b0b312410a0f62100a93a80c246a6c410)), closes [#2596](https://github.com/conventional-changelog/commitlint/issues/2596)
|
||||||
|
|
||||||
|
|
||||||
|
### BREAKING CHANGES
|
||||||
|
|
||||||
|
* minimum node version is 12
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [12.1.3](https://github.com/conventional-changelog/commitlint/compare/v12.1.2...v12.1.3) (2021-05-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/format
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [12.1.2](https://github.com/conventional-changelog/commitlint/compare/v12.1.1...v12.1.2) (2021-04-29)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/format
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [12.1.1](https://github.com/conventional-changelog/commitlint/compare/v12.1.0...v12.1.1) (2021-04-02)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/format
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [12.0.1](https://github.com/conventional-changelog/commitlint/compare/v12.0.0...v12.0.1) (2021-02-23)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **types:** correct chalkColor type ([#2420](https://github.com/conventional-changelog/commitlint/issues/2420)) ([ef8bdad](https://github.com/conventional-changelog/commitlint/commit/ef8bdad96c9ee7c3ad67f8280818c7f49c1df1fe))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [12.0.0](https://github.com/conventional-changelog/commitlint/compare/v11.0.0...v12.0.0) (2021-01-18)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/format
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [11.0.0](https://github.com/conventional-changelog/commitlint/compare/v10.0.0...v11.0.0) (2020-09-05)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/format
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [10.0.0](https://github.com/conventional-changelog/commitlint/compare/v9.1.2...v10.0.0) (2020-08-16)
|
||||||
|
|
||||||
|
|
||||||
|
* refactor!: drop support for node 8 (#1999) ([751f39f](https://github.com/conventional-changelog/commitlint/commit/751f39f284ef232574a176c3c11b1982ee544166)), closes [#1999](https://github.com/conventional-changelog/commitlint/issues/1999)
|
||||||
|
|
||||||
|
|
||||||
|
### BREAKING CHANGES
|
||||||
|
|
||||||
|
* remove node 8 from circle-ci checks
|
||||||
|
|
||||||
|
also remove node 13 because we do not support experimental versions
|
||||||
|
|
||||||
|
* docs: update node v10 to latest LTS 10 version
|
||||||
|
|
||||||
|
Co-authored-by: Cedric van Putten <me@bycedric.com>
|
||||||
|
|
||||||
|
Co-authored-by: Cedric van Putten <me@bycedric.com>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [9.1.2](https://github.com/conventional-changelog/commitlint/compare/v9.1.1...v9.1.2) (2020-07-13)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/format
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [9.1.1](https://github.com/conventional-changelog/commitlint/compare/v9.1.0...v9.1.1) (2020-06-30)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/format
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [9.1.0](https://github.com/conventional-changelog/commitlint/compare/v9.0.1...v9.1.0) (2020-06-21)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* update dependency chalk to v4 ([#1275](https://github.com/conventional-changelog/commitlint/issues/1275)) ([a5d8fa1](https://github.com/conventional-changelog/commitlint/commit/a5d8fa118e8221361f14f5fd2b21d7aaad008a27))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [9.0.1](https://github.com/conventional-changelog/commitlint/compare/v9.0.0...v9.0.1) (2020-05-26)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/format
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [9.0.0](https://github.com/conventional-changelog/commitlint/compare/v8.3.5...v9.0.0) (2020-05-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/format
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [8.3.4](https://github.com/conventional-changelog/commitlint/compare/v8.3.3...v8.3.4) (2020-01-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/format
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [8.3.0](https://github.com/conventional-changelog/commitlint/compare/v8.2.0...v8.3.0) (2019-10-16)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/format
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [8.2.0](https://github.com/conventional-changelog/commitlint/compare/v8.1.0...v8.2.0) (2019-09-16)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/format
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [8.1.0](https://github.com/conventional-changelog/commitlint/compare/v8.0.0...v8.1.0) (2019-07-15)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/format
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [7.6.1](https://github.com/conventional-changelog/commitlint/compare/v7.6.0...v7.6.1) (2019-05-09)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* ensure format() is available as commonjs default export [#645](https://github.com/conventional-changelog/commitlint/issues/645) ([ec3da92](https://github.com/conventional-changelog/commitlint/commit/ec3da92))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [7.6.0](https://github.com/conventional-changelog/commitlint/compare/v7.5.2...v7.6.0) (2019-05-06)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* avoid excessive help text [#606](https://github.com/conventional-changelog/commitlint/issues/606) ([#637](https://github.com/conventional-changelog/commitlint/issues/637)) ([8f3c3b1](https://github.com/conventional-changelog/commitlint/commit/8f3c3b1))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="7.5.0"></a>
|
||||||
|
# [7.5.0](https://github.com/conventional-changelog/commitlint/compare/v7.4.0...v7.5.0) (2019-01-31)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* all broken website references ([#564](https://github.com/conventional-changelog/commitlint/issues/564)) ([82eeb5a](https://github.com/conventional-changelog/commitlint/commit/82eeb5a))
|
||||||
|
* cleanup message for input with no config ([#519](https://github.com/conventional-changelog/commitlint/issues/519)) ([7d9e760](https://github.com/conventional-changelog/commitlint/commit/7d9e760))
|
||||||
|
* replace all repository references with conventional changelog ([#561](https://github.com/conventional-changelog/commitlint/issues/561)) ([6c3afcd](https://github.com/conventional-changelog/commitlint/commit/6c3afcd))
|
||||||
|
* replace all website references with conventional changelog ([#563](https://github.com/conventional-changelog/commitlint/issues/563)) ([6b86fb1](https://github.com/conventional-changelog/commitlint/commit/6b86fb1))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="7.4.0"></a>
|
||||||
|
# [7.4.0](https://github.com/conventional-changelog/commitlint/compare/v7.3.2...v7.4.0) (2019-01-27)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* correction to need help link ([#540](https://github.com/conventional-changelog/commitlint/issues/540)) ([fa6168a](https://github.com/conventional-changelog/commitlint/commit/fa6168a))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="7.3.1"></a>
|
||||||
|
## [7.3.1](https://github.com/conventional-changelog/commitlint/compare/v7.3.0...v7.3.1) (2019-01-11)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/format
|
||||||
|
|
||||||
|
<a name="7.3.0"></a>
|
||||||
|
# [7.3.0](https://github.com/conventional-changelog/commitlint/compare/v7.2.1...v7.3.0) (2019-01-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **format:** add new line to result ([#518](https://github.com/conventional-changelog/commitlint/issues/518)) ([f1d443b](https://github.com/conventional-changelog/commitlint/commit/f1d443b)), closes [#504](https://github.com/conventional-changelog/commitlint/issues/504)
|
||||||
|
* update to security-patched dependency versions ([97c033b](https://github.com/conventional-changelog/commitlint/commit/97c033b))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="7.2.1"></a>
|
||||||
|
## [7.2.1](https://github.com/conventional-changelog/commitlint/compare/v7.2.0...v7.2.1) (2018-10-11)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/format
|
||||||
|
|
||||||
|
<a name="7.2.0"></a>
|
||||||
|
# [7.2.0](https://github.com/conventional-changelog/commitlint/compare/v7.1.2...v7.2.0) (2018-10-05)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/format
|
||||||
|
|
||||||
|
<a name="7.1.2"></a>
|
||||||
|
## [7.1.2](https://github.com/conventional-changelog/commitlint/compare/v7.1.1...v7.1.2) (2018-09-04)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/format
|
||||||
|
|
||||||
|
<a name="6.1.1"></a>
|
||||||
|
## [6.1.1](https://github.com/conventional-changelog/commitlint/compare/v6.1.0...v6.1.1) (2018-02-22)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @commitlint/format
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
> Format commitlint reports
|
||||||
|
|
||||||
|
# @commitlint/format
|
||||||
|
|
||||||
|
## Getting started
|
||||||
|
|
||||||
|
```shell
|
||||||
|
npm install --save @commitlint/format
|
||||||
|
```
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```js
|
||||||
|
const format = require('@commitlint/format').default;
|
||||||
|
|
||||||
|
const output = format(
|
||||||
|
{
|
||||||
|
valid: false,
|
||||||
|
errorCount: 1,
|
||||||
|
warningCount: 1,
|
||||||
|
results: [
|
||||||
|
{
|
||||||
|
valid: false,
|
||||||
|
input: 'some: commit message',
|
||||||
|
errors: [
|
||||||
|
{
|
||||||
|
valid: false,
|
||||||
|
level: 2,
|
||||||
|
name: 'some-error',
|
||||||
|
message: 'This will show up red as it has level 2',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
warnings: [
|
||||||
|
{
|
||||||
|
valid: true,
|
||||||
|
level: 0,
|
||||||
|
name: 'some-hint',
|
||||||
|
message: 'This will not show up as it has level 0',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
valid: false,
|
||||||
|
level: 1,
|
||||||
|
name: 'some-warning',
|
||||||
|
message: 'This will show up yellow as it has level 1',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
color: false,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
process.stdout.write(output);
|
||||||
|
|
||||||
|
/* => [
|
||||||
|
'✖ This will show up red as it has level 2 [some-error]',
|
||||||
|
' This will not show up as it has level 0 [some-hint]',
|
||||||
|
'⚠ This will show up yellow as it has level 1 [some-warning]',
|
||||||
|
'✖ found 1 problems, 2 warnings'
|
||||||
|
] */
|
||||||
|
```
|
||||||
|
|
||||||
|
Consult [docs/api](https://conventional-changelog.github.io/commitlint/#/reference-api) for comprehensive documentation.
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2016 - present Mario Nebl
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
@ -0,0 +1,345 @@
|
||||||
|
declare type CSSColor =
|
||||||
|
| 'aliceblue'
|
||||||
|
| 'antiquewhite'
|
||||||
|
| 'aqua'
|
||||||
|
| 'aquamarine'
|
||||||
|
| 'azure'
|
||||||
|
| 'beige'
|
||||||
|
| 'bisque'
|
||||||
|
| 'black'
|
||||||
|
| 'blanchedalmond'
|
||||||
|
| 'blue'
|
||||||
|
| 'blueviolet'
|
||||||
|
| 'brown'
|
||||||
|
| 'burlywood'
|
||||||
|
| 'cadetblue'
|
||||||
|
| 'chartreuse'
|
||||||
|
| 'chocolate'
|
||||||
|
| 'coral'
|
||||||
|
| 'cornflowerblue'
|
||||||
|
| 'cornsilk'
|
||||||
|
| 'crimson'
|
||||||
|
| 'cyan'
|
||||||
|
| 'darkblue'
|
||||||
|
| 'darkcyan'
|
||||||
|
| 'darkgoldenrod'
|
||||||
|
| 'darkgray'
|
||||||
|
| 'darkgreen'
|
||||||
|
| 'darkgrey'
|
||||||
|
| 'darkkhaki'
|
||||||
|
| 'darkmagenta'
|
||||||
|
| 'darkolivegreen'
|
||||||
|
| 'darkorange'
|
||||||
|
| 'darkorchid'
|
||||||
|
| 'darkred'
|
||||||
|
| 'darksalmon'
|
||||||
|
| 'darkseagreen'
|
||||||
|
| 'darkslateblue'
|
||||||
|
| 'darkslategray'
|
||||||
|
| 'darkslategrey'
|
||||||
|
| 'darkturquoise'
|
||||||
|
| 'darkviolet'
|
||||||
|
| 'deeppink'
|
||||||
|
| 'deepskyblue'
|
||||||
|
| 'dimgray'
|
||||||
|
| 'dimgrey'
|
||||||
|
| 'dodgerblue'
|
||||||
|
| 'firebrick'
|
||||||
|
| 'floralwhite'
|
||||||
|
| 'forestgreen'
|
||||||
|
| 'fuchsia'
|
||||||
|
| 'gainsboro'
|
||||||
|
| 'ghostwhite'
|
||||||
|
| 'gold'
|
||||||
|
| 'goldenrod'
|
||||||
|
| 'gray'
|
||||||
|
| 'green'
|
||||||
|
| 'greenyellow'
|
||||||
|
| 'grey'
|
||||||
|
| 'honeydew'
|
||||||
|
| 'hotpink'
|
||||||
|
| 'indianred'
|
||||||
|
| 'indigo'
|
||||||
|
| 'ivory'
|
||||||
|
| 'khaki'
|
||||||
|
| 'lavender'
|
||||||
|
| 'lavenderblush'
|
||||||
|
| 'lawngreen'
|
||||||
|
| 'lemonchiffon'
|
||||||
|
| 'lightblue'
|
||||||
|
| 'lightcoral'
|
||||||
|
| 'lightcyan'
|
||||||
|
| 'lightgoldenrodyellow'
|
||||||
|
| 'lightgray'
|
||||||
|
| 'lightgreen'
|
||||||
|
| 'lightgrey'
|
||||||
|
| 'lightpink'
|
||||||
|
| 'lightsalmon'
|
||||||
|
| 'lightseagreen'
|
||||||
|
| 'lightskyblue'
|
||||||
|
| 'lightslategray'
|
||||||
|
| 'lightslategrey'
|
||||||
|
| 'lightsteelblue'
|
||||||
|
| 'lightyellow'
|
||||||
|
| 'lime'
|
||||||
|
| 'limegreen'
|
||||||
|
| 'linen'
|
||||||
|
| 'magenta'
|
||||||
|
| 'maroon'
|
||||||
|
| 'mediumaquamarine'
|
||||||
|
| 'mediumblue'
|
||||||
|
| 'mediumorchid'
|
||||||
|
| 'mediumpurple'
|
||||||
|
| 'mediumseagreen'
|
||||||
|
| 'mediumslateblue'
|
||||||
|
| 'mediumspringgreen'
|
||||||
|
| 'mediumturquoise'
|
||||||
|
| 'mediumvioletred'
|
||||||
|
| 'midnightblue'
|
||||||
|
| 'mintcream'
|
||||||
|
| 'mistyrose'
|
||||||
|
| 'moccasin'
|
||||||
|
| 'navajowhite'
|
||||||
|
| 'navy'
|
||||||
|
| 'oldlace'
|
||||||
|
| 'olive'
|
||||||
|
| 'olivedrab'
|
||||||
|
| 'orange'
|
||||||
|
| 'orangered'
|
||||||
|
| 'orchid'
|
||||||
|
| 'palegoldenrod'
|
||||||
|
| 'palegreen'
|
||||||
|
| 'paleturquoise'
|
||||||
|
| 'palevioletred'
|
||||||
|
| 'papayawhip'
|
||||||
|
| 'peachpuff'
|
||||||
|
| 'peru'
|
||||||
|
| 'pink'
|
||||||
|
| 'plum'
|
||||||
|
| 'powderblue'
|
||||||
|
| 'purple'
|
||||||
|
| 'rebeccapurple'
|
||||||
|
| 'red'
|
||||||
|
| 'rosybrown'
|
||||||
|
| 'royalblue'
|
||||||
|
| 'saddlebrown'
|
||||||
|
| 'salmon'
|
||||||
|
| 'sandybrown'
|
||||||
|
| 'seagreen'
|
||||||
|
| 'seashell'
|
||||||
|
| 'sienna'
|
||||||
|
| 'silver'
|
||||||
|
| 'skyblue'
|
||||||
|
| 'slateblue'
|
||||||
|
| 'slategray'
|
||||||
|
| 'slategrey'
|
||||||
|
| 'snow'
|
||||||
|
| 'springgreen'
|
||||||
|
| 'steelblue'
|
||||||
|
| 'tan'
|
||||||
|
| 'teal'
|
||||||
|
| 'thistle'
|
||||||
|
| 'tomato'
|
||||||
|
| 'turquoise'
|
||||||
|
| 'violet'
|
||||||
|
| 'wheat'
|
||||||
|
| 'white'
|
||||||
|
| 'whitesmoke'
|
||||||
|
| 'yellow'
|
||||||
|
| 'yellowgreen';
|
||||||
|
|
||||||
|
declare namespace ansiStyles {
|
||||||
|
interface ColorConvert {
|
||||||
|
/**
|
||||||
|
The RGB color space.
|
||||||
|
|
||||||
|
@param red - (`0`-`255`)
|
||||||
|
@param green - (`0`-`255`)
|
||||||
|
@param blue - (`0`-`255`)
|
||||||
|
*/
|
||||||
|
rgb(red: number, green: number, blue: number): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The RGB HEX color space.
|
||||||
|
|
||||||
|
@param hex - A hexadecimal string containing RGB data.
|
||||||
|
*/
|
||||||
|
hex(hex: string): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
@param keyword - A CSS color name.
|
||||||
|
*/
|
||||||
|
keyword(keyword: CSSColor): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The HSL color space.
|
||||||
|
|
||||||
|
@param hue - (`0`-`360`)
|
||||||
|
@param saturation - (`0`-`100`)
|
||||||
|
@param lightness - (`0`-`100`)
|
||||||
|
*/
|
||||||
|
hsl(hue: number, saturation: number, lightness: number): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The HSV color space.
|
||||||
|
|
||||||
|
@param hue - (`0`-`360`)
|
||||||
|
@param saturation - (`0`-`100`)
|
||||||
|
@param value - (`0`-`100`)
|
||||||
|
*/
|
||||||
|
hsv(hue: number, saturation: number, value: number): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The HSV color space.
|
||||||
|
|
||||||
|
@param hue - (`0`-`360`)
|
||||||
|
@param whiteness - (`0`-`100`)
|
||||||
|
@param blackness - (`0`-`100`)
|
||||||
|
*/
|
||||||
|
hwb(hue: number, whiteness: number, blackness: number): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Use a [4-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4-bit) to set text color.
|
||||||
|
*/
|
||||||
|
ansi(ansi: number): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Use an [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color.
|
||||||
|
*/
|
||||||
|
ansi256(ansi: number): string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface CSPair {
|
||||||
|
/**
|
||||||
|
The ANSI terminal control sequence for starting this style.
|
||||||
|
*/
|
||||||
|
readonly open: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The ANSI terminal control sequence for ending this style.
|
||||||
|
*/
|
||||||
|
readonly close: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ColorBase {
|
||||||
|
readonly ansi: ColorConvert;
|
||||||
|
readonly ansi256: ColorConvert;
|
||||||
|
readonly ansi16m: ColorConvert;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The ANSI terminal control sequence for ending this color.
|
||||||
|
*/
|
||||||
|
readonly close: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Modifier {
|
||||||
|
/**
|
||||||
|
Resets the current color chain.
|
||||||
|
*/
|
||||||
|
readonly reset: CSPair;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Make text bold.
|
||||||
|
*/
|
||||||
|
readonly bold: CSPair;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Emitting only a small amount of light.
|
||||||
|
*/
|
||||||
|
readonly dim: CSPair;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Make text italic. (Not widely supported)
|
||||||
|
*/
|
||||||
|
readonly italic: CSPair;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Make text underline. (Not widely supported)
|
||||||
|
*/
|
||||||
|
readonly underline: CSPair;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Inverse background and foreground colors.
|
||||||
|
*/
|
||||||
|
readonly inverse: CSPair;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Prints the text, but makes it invisible.
|
||||||
|
*/
|
||||||
|
readonly hidden: CSPair;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Puts a horizontal line through the center of the text. (Not widely supported)
|
||||||
|
*/
|
||||||
|
readonly strikethrough: CSPair;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ForegroundColor {
|
||||||
|
readonly black: CSPair;
|
||||||
|
readonly red: CSPair;
|
||||||
|
readonly green: CSPair;
|
||||||
|
readonly yellow: CSPair;
|
||||||
|
readonly blue: CSPair;
|
||||||
|
readonly cyan: CSPair;
|
||||||
|
readonly magenta: CSPair;
|
||||||
|
readonly white: CSPair;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Alias for `blackBright`.
|
||||||
|
*/
|
||||||
|
readonly gray: CSPair;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Alias for `blackBright`.
|
||||||
|
*/
|
||||||
|
readonly grey: CSPair;
|
||||||
|
|
||||||
|
readonly blackBright: CSPair;
|
||||||
|
readonly redBright: CSPair;
|
||||||
|
readonly greenBright: CSPair;
|
||||||
|
readonly yellowBright: CSPair;
|
||||||
|
readonly blueBright: CSPair;
|
||||||
|
readonly cyanBright: CSPair;
|
||||||
|
readonly magentaBright: CSPair;
|
||||||
|
readonly whiteBright: CSPair;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface BackgroundColor {
|
||||||
|
readonly bgBlack: CSPair;
|
||||||
|
readonly bgRed: CSPair;
|
||||||
|
readonly bgGreen: CSPair;
|
||||||
|
readonly bgYellow: CSPair;
|
||||||
|
readonly bgBlue: CSPair;
|
||||||
|
readonly bgCyan: CSPair;
|
||||||
|
readonly bgMagenta: CSPair;
|
||||||
|
readonly bgWhite: CSPair;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Alias for `bgBlackBright`.
|
||||||
|
*/
|
||||||
|
readonly bgGray: CSPair;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Alias for `bgBlackBright`.
|
||||||
|
*/
|
||||||
|
readonly bgGrey: CSPair;
|
||||||
|
|
||||||
|
readonly bgBlackBright: CSPair;
|
||||||
|
readonly bgRedBright: CSPair;
|
||||||
|
readonly bgGreenBright: CSPair;
|
||||||
|
readonly bgYellowBright: CSPair;
|
||||||
|
readonly bgBlueBright: CSPair;
|
||||||
|
readonly bgCyanBright: CSPair;
|
||||||
|
readonly bgMagentaBright: CSPair;
|
||||||
|
readonly bgWhiteBright: CSPair;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare const ansiStyles: {
|
||||||
|
readonly modifier: ansiStyles.Modifier;
|
||||||
|
readonly color: ansiStyles.ForegroundColor & ansiStyles.ColorBase;
|
||||||
|
readonly bgColor: ansiStyles.BackgroundColor & ansiStyles.ColorBase;
|
||||||
|
readonly codes: ReadonlyMap<number, number>;
|
||||||
|
} & ansiStyles.BackgroundColor & ansiStyles.ForegroundColor & ansiStyles.Modifier;
|
||||||
|
|
||||||
|
export = ansiStyles;
|
||||||
|
|
@ -0,0 +1,163 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
const wrapAnsi16 = (fn, offset) => (...args) => {
|
||||||
|
const code = fn(...args);
|
||||||
|
return `\u001B[${code + offset}m`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const wrapAnsi256 = (fn, offset) => (...args) => {
|
||||||
|
const code = fn(...args);
|
||||||
|
return `\u001B[${38 + offset};5;${code}m`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const wrapAnsi16m = (fn, offset) => (...args) => {
|
||||||
|
const rgb = fn(...args);
|
||||||
|
return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const ansi2ansi = n => n;
|
||||||
|
const rgb2rgb = (r, g, b) => [r, g, b];
|
||||||
|
|
||||||
|
const setLazyProperty = (object, property, get) => {
|
||||||
|
Object.defineProperty(object, property, {
|
||||||
|
get: () => {
|
||||||
|
const value = get();
|
||||||
|
|
||||||
|
Object.defineProperty(object, property, {
|
||||||
|
value,
|
||||||
|
enumerable: true,
|
||||||
|
configurable: true
|
||||||
|
});
|
||||||
|
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
enumerable: true,
|
||||||
|
configurable: true
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** @type {typeof import('color-convert')} */
|
||||||
|
let colorConvert;
|
||||||
|
const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
|
||||||
|
if (colorConvert === undefined) {
|
||||||
|
colorConvert = require('color-convert');
|
||||||
|
}
|
||||||
|
|
||||||
|
const offset = isBackground ? 10 : 0;
|
||||||
|
const styles = {};
|
||||||
|
|
||||||
|
for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
|
||||||
|
const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;
|
||||||
|
if (sourceSpace === targetSpace) {
|
||||||
|
styles[name] = wrap(identity, offset);
|
||||||
|
} else if (typeof suite === 'object') {
|
||||||
|
styles[name] = wrap(suite[targetSpace], offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return styles;
|
||||||
|
};
|
||||||
|
|
||||||
|
function assembleStyles() {
|
||||||
|
const codes = new Map();
|
||||||
|
const styles = {
|
||||||
|
modifier: {
|
||||||
|
reset: [0, 0],
|
||||||
|
// 21 isn't widely supported and 22 does the same thing
|
||||||
|
bold: [1, 22],
|
||||||
|
dim: [2, 22],
|
||||||
|
italic: [3, 23],
|
||||||
|
underline: [4, 24],
|
||||||
|
inverse: [7, 27],
|
||||||
|
hidden: [8, 28],
|
||||||
|
strikethrough: [9, 29]
|
||||||
|
},
|
||||||
|
color: {
|
||||||
|
black: [30, 39],
|
||||||
|
red: [31, 39],
|
||||||
|
green: [32, 39],
|
||||||
|
yellow: [33, 39],
|
||||||
|
blue: [34, 39],
|
||||||
|
magenta: [35, 39],
|
||||||
|
cyan: [36, 39],
|
||||||
|
white: [37, 39],
|
||||||
|
|
||||||
|
// Bright color
|
||||||
|
blackBright: [90, 39],
|
||||||
|
redBright: [91, 39],
|
||||||
|
greenBright: [92, 39],
|
||||||
|
yellowBright: [93, 39],
|
||||||
|
blueBright: [94, 39],
|
||||||
|
magentaBright: [95, 39],
|
||||||
|
cyanBright: [96, 39],
|
||||||
|
whiteBright: [97, 39]
|
||||||
|
},
|
||||||
|
bgColor: {
|
||||||
|
bgBlack: [40, 49],
|
||||||
|
bgRed: [41, 49],
|
||||||
|
bgGreen: [42, 49],
|
||||||
|
bgYellow: [43, 49],
|
||||||
|
bgBlue: [44, 49],
|
||||||
|
bgMagenta: [45, 49],
|
||||||
|
bgCyan: [46, 49],
|
||||||
|
bgWhite: [47, 49],
|
||||||
|
|
||||||
|
// Bright color
|
||||||
|
bgBlackBright: [100, 49],
|
||||||
|
bgRedBright: [101, 49],
|
||||||
|
bgGreenBright: [102, 49],
|
||||||
|
bgYellowBright: [103, 49],
|
||||||
|
bgBlueBright: [104, 49],
|
||||||
|
bgMagentaBright: [105, 49],
|
||||||
|
bgCyanBright: [106, 49],
|
||||||
|
bgWhiteBright: [107, 49]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Alias bright black as gray (and grey)
|
||||||
|
styles.color.gray = styles.color.blackBright;
|
||||||
|
styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
|
||||||
|
styles.color.grey = styles.color.blackBright;
|
||||||
|
styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
|
||||||
|
|
||||||
|
for (const [groupName, group] of Object.entries(styles)) {
|
||||||
|
for (const [styleName, style] of Object.entries(group)) {
|
||||||
|
styles[styleName] = {
|
||||||
|
open: `\u001B[${style[0]}m`,
|
||||||
|
close: `\u001B[${style[1]}m`
|
||||||
|
};
|
||||||
|
|
||||||
|
group[styleName] = styles[styleName];
|
||||||
|
|
||||||
|
codes.set(style[0], style[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.defineProperty(styles, groupName, {
|
||||||
|
value: group,
|
||||||
|
enumerable: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.defineProperty(styles, 'codes', {
|
||||||
|
value: codes,
|
||||||
|
enumerable: false
|
||||||
|
});
|
||||||
|
|
||||||
|
styles.color.close = '\u001B[39m';
|
||||||
|
styles.bgColor.close = '\u001B[49m';
|
||||||
|
|
||||||
|
setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false));
|
||||||
|
setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false));
|
||||||
|
setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false));
|
||||||
|
setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true));
|
||||||
|
setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true));
|
||||||
|
setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true));
|
||||||
|
|
||||||
|
return styles;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make the export immutable
|
||||||
|
Object.defineProperty(module, 'exports', {
|
||||||
|
enumerable: true,
|
||||||
|
get: assembleStyles
|
||||||
|
});
|
||||||
|
|
@ -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.
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
{
|
||||||
|
"name": "ansi-styles",
|
||||||
|
"version": "4.3.0",
|
||||||
|
"description": "ANSI escape codes for styling strings in the terminal",
|
||||||
|
"license": "MIT",
|
||||||
|
"repository": "chalk/ansi-styles",
|
||||||
|
"funding": "https://github.com/chalk/ansi-styles?sponsor=1",
|
||||||
|
"author": {
|
||||||
|
"name": "Sindre Sorhus",
|
||||||
|
"email": "sindresorhus@gmail.com",
|
||||||
|
"url": "sindresorhus.com"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "xo && ava && tsd",
|
||||||
|
"screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js",
|
||||||
|
"index.d.ts"
|
||||||
|
],
|
||||||
|
"keywords": [
|
||||||
|
"ansi",
|
||||||
|
"styles",
|
||||||
|
"color",
|
||||||
|
"colour",
|
||||||
|
"colors",
|
||||||
|
"terminal",
|
||||||
|
"console",
|
||||||
|
"cli",
|
||||||
|
"string",
|
||||||
|
"tty",
|
||||||
|
"escape",
|
||||||
|
"formatting",
|
||||||
|
"rgb",
|
||||||
|
"256",
|
||||||
|
"shell",
|
||||||
|
"xterm",
|
||||||
|
"log",
|
||||||
|
"logging",
|
||||||
|
"command-line",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"color-convert": "^2.0.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/color-convert": "^1.9.0",
|
||||||
|
"ava": "^2.3.0",
|
||||||
|
"svg-term-cli": "^2.1.1",
|
||||||
|
"tsd": "^0.11.0",
|
||||||
|
"xo": "^0.25.3"
|
||||||
|
}
|
||||||
|
|
||||||
|
,"_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz"
|
||||||
|
,"_integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="
|
||||||
|
,"_from": "ansi-styles@4.3.0"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,152 @@
|
||||||
|
# ansi-styles [](https://travis-ci.org/chalk/ansi-styles)
|
||||||
|
|
||||||
|
> [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal
|
||||||
|
|
||||||
|
You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings.
|
||||||
|
|
||||||
|
<img src="screenshot.svg" width="900">
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```
|
||||||
|
$ npm install ansi-styles
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
const style = require('ansi-styles');
|
||||||
|
|
||||||
|
console.log(`${style.green.open}Hello world!${style.green.close}`);
|
||||||
|
|
||||||
|
|
||||||
|
// Color conversion between 16/256/truecolor
|
||||||
|
// NOTE: If conversion goes to 16 colors or 256 colors, the original color
|
||||||
|
// may be degraded to fit that color palette. This means terminals
|
||||||
|
// that do not support 16 million colors will best-match the
|
||||||
|
// original color.
|
||||||
|
console.log(style.bgColor.ansi.hsl(120, 80, 72) + 'Hello world!' + style.bgColor.close);
|
||||||
|
console.log(style.color.ansi256.rgb(199, 20, 250) + 'Hello world!' + style.color.close);
|
||||||
|
console.log(style.color.ansi16m.hex('#abcdef') + 'Hello world!' + style.color.close);
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
Each style has an `open` and `close` property.
|
||||||
|
|
||||||
|
## Styles
|
||||||
|
|
||||||
|
### Modifiers
|
||||||
|
|
||||||
|
- `reset`
|
||||||
|
- `bold`
|
||||||
|
- `dim`
|
||||||
|
- `italic` *(Not widely supported)*
|
||||||
|
- `underline`
|
||||||
|
- `inverse`
|
||||||
|
- `hidden`
|
||||||
|
- `strikethrough` *(Not widely supported)*
|
||||||
|
|
||||||
|
### Colors
|
||||||
|
|
||||||
|
- `black`
|
||||||
|
- `red`
|
||||||
|
- `green`
|
||||||
|
- `yellow`
|
||||||
|
- `blue`
|
||||||
|
- `magenta`
|
||||||
|
- `cyan`
|
||||||
|
- `white`
|
||||||
|
- `blackBright` (alias: `gray`, `grey`)
|
||||||
|
- `redBright`
|
||||||
|
- `greenBright`
|
||||||
|
- `yellowBright`
|
||||||
|
- `blueBright`
|
||||||
|
- `magentaBright`
|
||||||
|
- `cyanBright`
|
||||||
|
- `whiteBright`
|
||||||
|
|
||||||
|
### Background colors
|
||||||
|
|
||||||
|
- `bgBlack`
|
||||||
|
- `bgRed`
|
||||||
|
- `bgGreen`
|
||||||
|
- `bgYellow`
|
||||||
|
- `bgBlue`
|
||||||
|
- `bgMagenta`
|
||||||
|
- `bgCyan`
|
||||||
|
- `bgWhite`
|
||||||
|
- `bgBlackBright` (alias: `bgGray`, `bgGrey`)
|
||||||
|
- `bgRedBright`
|
||||||
|
- `bgGreenBright`
|
||||||
|
- `bgYellowBright`
|
||||||
|
- `bgBlueBright`
|
||||||
|
- `bgMagentaBright`
|
||||||
|
- `bgCyanBright`
|
||||||
|
- `bgWhiteBright`
|
||||||
|
|
||||||
|
## Advanced usage
|
||||||
|
|
||||||
|
By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module.
|
||||||
|
|
||||||
|
- `style.modifier`
|
||||||
|
- `style.color`
|
||||||
|
- `style.bgColor`
|
||||||
|
|
||||||
|
###### Example
|
||||||
|
|
||||||
|
```js
|
||||||
|
console.log(style.color.green.open);
|
||||||
|
```
|
||||||
|
|
||||||
|
Raw escape codes (i.e. without the CSI escape prefix `\u001B[` and render mode postfix `m`) are available under `style.codes`, which returns a `Map` with the open codes as keys and close codes as values.
|
||||||
|
|
||||||
|
###### Example
|
||||||
|
|
||||||
|
```js
|
||||||
|
console.log(style.codes.get(36));
|
||||||
|
//=> 39
|
||||||
|
```
|
||||||
|
|
||||||
|
## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728)
|
||||||
|
|
||||||
|
`ansi-styles` uses the [`color-convert`](https://github.com/Qix-/color-convert) package to allow for converting between various colors and ANSI escapes, with support for 256 and 16 million colors.
|
||||||
|
|
||||||
|
The following color spaces from `color-convert` are supported:
|
||||||
|
|
||||||
|
- `rgb`
|
||||||
|
- `hex`
|
||||||
|
- `keyword`
|
||||||
|
- `hsl`
|
||||||
|
- `hsv`
|
||||||
|
- `hwb`
|
||||||
|
- `ansi`
|
||||||
|
- `ansi256`
|
||||||
|
|
||||||
|
To use these, call the associated conversion function with the intended output, for example:
|
||||||
|
|
||||||
|
```js
|
||||||
|
style.color.ansi.rgb(100, 200, 15); // RGB to 16 color ansi foreground code
|
||||||
|
style.bgColor.ansi.rgb(100, 200, 15); // RGB to 16 color ansi background code
|
||||||
|
|
||||||
|
style.color.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
|
||||||
|
style.bgColor.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
|
||||||
|
|
||||||
|
style.color.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color foreground code
|
||||||
|
style.bgColor.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color background code
|
||||||
|
```
|
||||||
|
|
||||||
|
## Related
|
||||||
|
|
||||||
|
- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal
|
||||||
|
|
||||||
|
## Maintainers
|
||||||
|
|
||||||
|
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||||
|
- [Josh Junon](https://github.com/qix-)
|
||||||
|
|
||||||
|
## For enterprise
|
||||||
|
|
||||||
|
Available as part of the Tidelift Subscription.
|
||||||
|
|
||||||
|
The maintainers of `ansi-styles` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-ansi-styles?utm_source=npm-ansi-styles&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
||||||
|
|
@ -0,0 +1,415 @@
|
||||||
|
/**
|
||||||
|
Basic foreground colors.
|
||||||
|
|
||||||
|
[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support)
|
||||||
|
*/
|
||||||
|
declare type ForegroundColor =
|
||||||
|
| 'black'
|
||||||
|
| 'red'
|
||||||
|
| 'green'
|
||||||
|
| 'yellow'
|
||||||
|
| 'blue'
|
||||||
|
| 'magenta'
|
||||||
|
| 'cyan'
|
||||||
|
| 'white'
|
||||||
|
| 'gray'
|
||||||
|
| 'grey'
|
||||||
|
| 'blackBright'
|
||||||
|
| 'redBright'
|
||||||
|
| 'greenBright'
|
||||||
|
| 'yellowBright'
|
||||||
|
| 'blueBright'
|
||||||
|
| 'magentaBright'
|
||||||
|
| 'cyanBright'
|
||||||
|
| 'whiteBright';
|
||||||
|
|
||||||
|
/**
|
||||||
|
Basic background colors.
|
||||||
|
|
||||||
|
[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support)
|
||||||
|
*/
|
||||||
|
declare type BackgroundColor =
|
||||||
|
| 'bgBlack'
|
||||||
|
| 'bgRed'
|
||||||
|
| 'bgGreen'
|
||||||
|
| 'bgYellow'
|
||||||
|
| 'bgBlue'
|
||||||
|
| 'bgMagenta'
|
||||||
|
| 'bgCyan'
|
||||||
|
| 'bgWhite'
|
||||||
|
| 'bgGray'
|
||||||
|
| 'bgGrey'
|
||||||
|
| 'bgBlackBright'
|
||||||
|
| 'bgRedBright'
|
||||||
|
| 'bgGreenBright'
|
||||||
|
| 'bgYellowBright'
|
||||||
|
| 'bgBlueBright'
|
||||||
|
| 'bgMagentaBright'
|
||||||
|
| 'bgCyanBright'
|
||||||
|
| 'bgWhiteBright';
|
||||||
|
|
||||||
|
/**
|
||||||
|
Basic colors.
|
||||||
|
|
||||||
|
[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support)
|
||||||
|
*/
|
||||||
|
declare type Color = ForegroundColor | BackgroundColor;
|
||||||
|
|
||||||
|
declare type Modifiers =
|
||||||
|
| 'reset'
|
||||||
|
| 'bold'
|
||||||
|
| 'dim'
|
||||||
|
| 'italic'
|
||||||
|
| 'underline'
|
||||||
|
| 'inverse'
|
||||||
|
| 'hidden'
|
||||||
|
| 'strikethrough'
|
||||||
|
| 'visible';
|
||||||
|
|
||||||
|
declare namespace chalk {
|
||||||
|
/**
|
||||||
|
Levels:
|
||||||
|
- `0` - All colors disabled.
|
||||||
|
- `1` - Basic 16 colors support.
|
||||||
|
- `2` - ANSI 256 colors support.
|
||||||
|
- `3` - Truecolor 16 million colors support.
|
||||||
|
*/
|
||||||
|
type Level = 0 | 1 | 2 | 3;
|
||||||
|
|
||||||
|
interface Options {
|
||||||
|
/**
|
||||||
|
Specify the color support for Chalk.
|
||||||
|
|
||||||
|
By default, color support is automatically detected based on the environment.
|
||||||
|
|
||||||
|
Levels:
|
||||||
|
- `0` - All colors disabled.
|
||||||
|
- `1` - Basic 16 colors support.
|
||||||
|
- `2` - ANSI 256 colors support.
|
||||||
|
- `3` - Truecolor 16 million colors support.
|
||||||
|
*/
|
||||||
|
level?: Level;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return a new Chalk instance.
|
||||||
|
*/
|
||||||
|
type Instance = new (options?: Options) => Chalk;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Detect whether the terminal supports color.
|
||||||
|
*/
|
||||||
|
interface ColorSupport {
|
||||||
|
/**
|
||||||
|
The color level used by Chalk.
|
||||||
|
*/
|
||||||
|
level: Level;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return whether Chalk supports basic 16 colors.
|
||||||
|
*/
|
||||||
|
hasBasic: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return whether Chalk supports ANSI 256 colors.
|
||||||
|
*/
|
||||||
|
has256: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return whether Chalk supports Truecolor 16 million colors.
|
||||||
|
*/
|
||||||
|
has16m: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ChalkFunction {
|
||||||
|
/**
|
||||||
|
Use a template string.
|
||||||
|
|
||||||
|
@remarks Template literals are unsupported for nested calls (see [issue #341](https://github.com/chalk/chalk/issues/341))
|
||||||
|
|
||||||
|
@example
|
||||||
|
```
|
||||||
|
import chalk = require('chalk');
|
||||||
|
|
||||||
|
log(chalk`
|
||||||
|
CPU: {red ${cpu.totalPercent}%}
|
||||||
|
RAM: {green ${ram.used / ram.total * 100}%}
|
||||||
|
DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%}
|
||||||
|
`);
|
||||||
|
```
|
||||||
|
|
||||||
|
@example
|
||||||
|
```
|
||||||
|
import chalk = require('chalk');
|
||||||
|
|
||||||
|
log(chalk.red.bgBlack`2 + 3 = {bold ${2 + 3}}`)
|
||||||
|
```
|
||||||
|
*/
|
||||||
|
(text: TemplateStringsArray, ...placeholders: unknown[]): string;
|
||||||
|
|
||||||
|
(...text: unknown[]): string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Chalk extends ChalkFunction {
|
||||||
|
/**
|
||||||
|
Return a new Chalk instance.
|
||||||
|
*/
|
||||||
|
Instance: Instance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The color support for Chalk.
|
||||||
|
|
||||||
|
By default, color support is automatically detected based on the environment.
|
||||||
|
|
||||||
|
Levels:
|
||||||
|
- `0` - All colors disabled.
|
||||||
|
- `1` - Basic 16 colors support.
|
||||||
|
- `2` - ANSI 256 colors support.
|
||||||
|
- `3` - Truecolor 16 million colors support.
|
||||||
|
*/
|
||||||
|
level: Level;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Use HEX value to set text color.
|
||||||
|
|
||||||
|
@param color - Hexadecimal value representing the desired color.
|
||||||
|
|
||||||
|
@example
|
||||||
|
```
|
||||||
|
import chalk = require('chalk');
|
||||||
|
|
||||||
|
chalk.hex('#DEADED');
|
||||||
|
```
|
||||||
|
*/
|
||||||
|
hex(color: string): Chalk;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Use keyword color value to set text color.
|
||||||
|
|
||||||
|
@param color - Keyword value representing the desired color.
|
||||||
|
|
||||||
|
@example
|
||||||
|
```
|
||||||
|
import chalk = require('chalk');
|
||||||
|
|
||||||
|
chalk.keyword('orange');
|
||||||
|
```
|
||||||
|
*/
|
||||||
|
keyword(color: string): Chalk;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Use RGB values to set text color.
|
||||||
|
*/
|
||||||
|
rgb(red: number, green: number, blue: number): Chalk;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Use HSL values to set text color.
|
||||||
|
*/
|
||||||
|
hsl(hue: number, saturation: number, lightness: number): Chalk;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Use HSV values to set text color.
|
||||||
|
*/
|
||||||
|
hsv(hue: number, saturation: number, value: number): Chalk;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Use HWB values to set text color.
|
||||||
|
*/
|
||||||
|
hwb(hue: number, whiteness: number, blackness: number): Chalk;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set text color.
|
||||||
|
|
||||||
|
30 <= code && code < 38 || 90 <= code && code < 98
|
||||||
|
For example, 31 for red, 91 for redBright.
|
||||||
|
*/
|
||||||
|
ansi(code: number): Chalk;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color.
|
||||||
|
*/
|
||||||
|
ansi256(index: number): Chalk;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Use HEX value to set background color.
|
||||||
|
|
||||||
|
@param color - Hexadecimal value representing the desired color.
|
||||||
|
|
||||||
|
@example
|
||||||
|
```
|
||||||
|
import chalk = require('chalk');
|
||||||
|
|
||||||
|
chalk.bgHex('#DEADED');
|
||||||
|
```
|
||||||
|
*/
|
||||||
|
bgHex(color: string): Chalk;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Use keyword color value to set background color.
|
||||||
|
|
||||||
|
@param color - Keyword value representing the desired color.
|
||||||
|
|
||||||
|
@example
|
||||||
|
```
|
||||||
|
import chalk = require('chalk');
|
||||||
|
|
||||||
|
chalk.bgKeyword('orange');
|
||||||
|
```
|
||||||
|
*/
|
||||||
|
bgKeyword(color: string): Chalk;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Use RGB values to set background color.
|
||||||
|
*/
|
||||||
|
bgRgb(red: number, green: number, blue: number): Chalk;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Use HSL values to set background color.
|
||||||
|
*/
|
||||||
|
bgHsl(hue: number, saturation: number, lightness: number): Chalk;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Use HSV values to set background color.
|
||||||
|
*/
|
||||||
|
bgHsv(hue: number, saturation: number, value: number): Chalk;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Use HWB values to set background color.
|
||||||
|
*/
|
||||||
|
bgHwb(hue: number, whiteness: number, blackness: number): Chalk;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set background color.
|
||||||
|
|
||||||
|
30 <= code && code < 38 || 90 <= code && code < 98
|
||||||
|
For example, 31 for red, 91 for redBright.
|
||||||
|
Use the foreground code, not the background code (for example, not 41, nor 101).
|
||||||
|
*/
|
||||||
|
bgAnsi(code: number): Chalk;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set background color.
|
||||||
|
*/
|
||||||
|
bgAnsi256(index: number): Chalk;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Modifier: Resets the current color chain.
|
||||||
|
*/
|
||||||
|
readonly reset: Chalk;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Modifier: Make text bold.
|
||||||
|
*/
|
||||||
|
readonly bold: Chalk;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Modifier: Emitting only a small amount of light.
|
||||||
|
*/
|
||||||
|
readonly dim: Chalk;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Modifier: Make text italic. (Not widely supported)
|
||||||
|
*/
|
||||||
|
readonly italic: Chalk;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Modifier: Make text underline. (Not widely supported)
|
||||||
|
*/
|
||||||
|
readonly underline: Chalk;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Modifier: Inverse background and foreground colors.
|
||||||
|
*/
|
||||||
|
readonly inverse: Chalk;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Modifier: Prints the text, but makes it invisible.
|
||||||
|
*/
|
||||||
|
readonly hidden: Chalk;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Modifier: Puts a horizontal line through the center of the text. (Not widely supported)
|
||||||
|
*/
|
||||||
|
readonly strikethrough: Chalk;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Modifier: Prints the text only when Chalk has a color support level > 0.
|
||||||
|
Can be useful for things that are purely cosmetic.
|
||||||
|
*/
|
||||||
|
readonly visible: Chalk;
|
||||||
|
|
||||||
|
readonly black: Chalk;
|
||||||
|
readonly red: Chalk;
|
||||||
|
readonly green: Chalk;
|
||||||
|
readonly yellow: Chalk;
|
||||||
|
readonly blue: Chalk;
|
||||||
|
readonly magenta: Chalk;
|
||||||
|
readonly cyan: Chalk;
|
||||||
|
readonly white: Chalk;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Alias for `blackBright`.
|
||||||
|
*/
|
||||||
|
readonly gray: Chalk;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Alias for `blackBright`.
|
||||||
|
*/
|
||||||
|
readonly grey: Chalk;
|
||||||
|
|
||||||
|
readonly blackBright: Chalk;
|
||||||
|
readonly redBright: Chalk;
|
||||||
|
readonly greenBright: Chalk;
|
||||||
|
readonly yellowBright: Chalk;
|
||||||
|
readonly blueBright: Chalk;
|
||||||
|
readonly magentaBright: Chalk;
|
||||||
|
readonly cyanBright: Chalk;
|
||||||
|
readonly whiteBright: Chalk;
|
||||||
|
|
||||||
|
readonly bgBlack: Chalk;
|
||||||
|
readonly bgRed: Chalk;
|
||||||
|
readonly bgGreen: Chalk;
|
||||||
|
readonly bgYellow: Chalk;
|
||||||
|
readonly bgBlue: Chalk;
|
||||||
|
readonly bgMagenta: Chalk;
|
||||||
|
readonly bgCyan: Chalk;
|
||||||
|
readonly bgWhite: Chalk;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Alias for `bgBlackBright`.
|
||||||
|
*/
|
||||||
|
readonly bgGray: Chalk;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Alias for `bgBlackBright`.
|
||||||
|
*/
|
||||||
|
readonly bgGrey: Chalk;
|
||||||
|
|
||||||
|
readonly bgBlackBright: Chalk;
|
||||||
|
readonly bgRedBright: Chalk;
|
||||||
|
readonly bgGreenBright: Chalk;
|
||||||
|
readonly bgYellowBright: Chalk;
|
||||||
|
readonly bgBlueBright: Chalk;
|
||||||
|
readonly bgMagentaBright: Chalk;
|
||||||
|
readonly bgCyanBright: Chalk;
|
||||||
|
readonly bgWhiteBright: Chalk;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Main Chalk object that allows to chain styles together.
|
||||||
|
Call the last one as a method with a string argument.
|
||||||
|
Order doesn't matter, and later styles take precedent in case of a conflict.
|
||||||
|
This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`.
|
||||||
|
*/
|
||||||
|
declare const chalk: chalk.Chalk & chalk.ChalkFunction & {
|
||||||
|
supportsColor: chalk.ColorSupport | false;
|
||||||
|
Level: chalk.Level;
|
||||||
|
Color: Color;
|
||||||
|
ForegroundColor: ForegroundColor;
|
||||||
|
BackgroundColor: BackgroundColor;
|
||||||
|
Modifiers: Modifiers;
|
||||||
|
stderr: chalk.Chalk & {supportsColor: chalk.ColorSupport | false};
|
||||||
|
};
|
||||||
|
|
||||||
|
export = chalk;
|
||||||
|
|
@ -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.
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
{
|
||||||
|
"name": "chalk",
|
||||||
|
"version": "4.1.2",
|
||||||
|
"description": "Terminal string styling done right",
|
||||||
|
"license": "MIT",
|
||||||
|
"repository": "chalk/chalk",
|
||||||
|
"funding": "https://github.com/chalk/chalk?sponsor=1",
|
||||||
|
"main": "source",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "xo && nyc ava && tsd",
|
||||||
|
"bench": "matcha benchmark.js"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"source",
|
||||||
|
"index.d.ts"
|
||||||
|
],
|
||||||
|
"keywords": [
|
||||||
|
"color",
|
||||||
|
"colour",
|
||||||
|
"colors",
|
||||||
|
"terminal",
|
||||||
|
"console",
|
||||||
|
"cli",
|
||||||
|
"string",
|
||||||
|
"str",
|
||||||
|
"ansi",
|
||||||
|
"style",
|
||||||
|
"styles",
|
||||||
|
"tty",
|
||||||
|
"formatting",
|
||||||
|
"rgb",
|
||||||
|
"256",
|
||||||
|
"shell",
|
||||||
|
"xterm",
|
||||||
|
"log",
|
||||||
|
"logging",
|
||||||
|
"command-line",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"ansi-styles": "^4.1.0",
|
||||||
|
"supports-color": "^7.1.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"ava": "^2.4.0",
|
||||||
|
"coveralls": "^3.0.7",
|
||||||
|
"execa": "^4.0.0",
|
||||||
|
"import-fresh": "^3.1.0",
|
||||||
|
"matcha": "^0.7.0",
|
||||||
|
"nyc": "^15.0.0",
|
||||||
|
"resolve-from": "^5.0.0",
|
||||||
|
"tsd": "^0.7.4",
|
||||||
|
"xo": "^0.28.2"
|
||||||
|
},
|
||||||
|
"xo": {
|
||||||
|
"rules": {
|
||||||
|
"unicorn/prefer-string-slice": "off",
|
||||||
|
"unicorn/prefer-includes": "off",
|
||||||
|
"@typescript-eslint/member-ordering": "off",
|
||||||
|
"no-redeclare": "off",
|
||||||
|
"unicorn/string-content": "off",
|
||||||
|
"unicorn/better-regex": "off"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
,"_resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz"
|
||||||
|
,"_integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="
|
||||||
|
,"_from": "chalk@4.1.2"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,341 @@
|
||||||
|
<h1 align="center">
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<img width="320" src="media/logo.svg" alt="Chalk">
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
> Terminal string styling done right
|
||||||
|
|
||||||
|
[](https://travis-ci.org/chalk/chalk) [](https://coveralls.io/github/chalk/chalk?branch=master) [](https://www.npmjs.com/package/chalk?activeTab=dependents) [](https://www.npmjs.com/package/chalk) [](https://www.youtube.com/watch?v=9auOCbH5Ns4) [](https://github.com/xojs/xo)  [](https://repl.it/github/chalk/chalk)
|
||||||
|
|
||||||
|
<img src="https://cdn.jsdelivr.net/gh/chalk/ansi-styles@8261697c95bf34b6c7767e2cbe9941a851d59385/screenshot.svg" width="900">
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<div align="center">
|
||||||
|
<p>
|
||||||
|
<p>
|
||||||
|
<sup>
|
||||||
|
Sindre Sorhus' open source work is supported by the community on <a href="https://github.com/sponsors/sindresorhus">GitHub Sponsors</a> and <a href="https://stakes.social/0x44d871aebF0126Bf646753E2C976Aa7e68A66c15">Dev</a>
|
||||||
|
</sup>
|
||||||
|
</p>
|
||||||
|
<sup>Special thanks to:</sup>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<a href="https://standardresume.co/tech">
|
||||||
|
<img src="https://sindresorhus.com/assets/thanks/standard-resume-logo.svg" width="160"/>
|
||||||
|
</a>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<a href="https://retool.com/?utm_campaign=sindresorhus">
|
||||||
|
<img src="https://sindresorhus.com/assets/thanks/retool-logo.svg" width="230"/>
|
||||||
|
</a>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<a href="https://doppler.com/?utm_campaign=github_repo&utm_medium=referral&utm_content=chalk&utm_source=github">
|
||||||
|
<div>
|
||||||
|
<img src="https://dashboard.doppler.com/imgs/logo-long.svg" width="240" alt="Doppler">
|
||||||
|
</div>
|
||||||
|
<b>All your environment variables, in one place</b>
|
||||||
|
<div>
|
||||||
|
<span>Stop struggling with scattered API keys, hacking together home-brewed tools,</span>
|
||||||
|
<br>
|
||||||
|
<span>and avoiding access controls. Keep your team and servers in sync with Doppler.</span>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
<br>
|
||||||
|
<a href="https://uibakery.io/?utm_source=chalk&utm_medium=sponsor&utm_campaign=github">
|
||||||
|
<div>
|
||||||
|
<img src="https://sindresorhus.com/assets/thanks/uibakery-logo.jpg" width="270" alt="UI Bakery">
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
## Highlights
|
||||||
|
|
||||||
|
- Expressive API
|
||||||
|
- Highly performant
|
||||||
|
- Ability to nest styles
|
||||||
|
- [256/Truecolor color support](#256-and-truecolor-color-support)
|
||||||
|
- Auto-detects color support
|
||||||
|
- Doesn't extend `String.prototype`
|
||||||
|
- Clean and focused
|
||||||
|
- Actively maintained
|
||||||
|
- [Used by ~50,000 packages](https://www.npmjs.com/browse/depended/chalk) as of January 1, 2020
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ npm install chalk
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
const chalk = require('chalk');
|
||||||
|
|
||||||
|
console.log(chalk.blue('Hello world!'));
|
||||||
|
```
|
||||||
|
|
||||||
|
Chalk comes with an easy to use composable API where you just chain and nest the styles you want.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const chalk = require('chalk');
|
||||||
|
const log = console.log;
|
||||||
|
|
||||||
|
// Combine styled and normal strings
|
||||||
|
log(chalk.blue('Hello') + ' World' + chalk.red('!'));
|
||||||
|
|
||||||
|
// Compose multiple styles using the chainable API
|
||||||
|
log(chalk.blue.bgRed.bold('Hello world!'));
|
||||||
|
|
||||||
|
// Pass in multiple arguments
|
||||||
|
log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz'));
|
||||||
|
|
||||||
|
// Nest styles
|
||||||
|
log(chalk.red('Hello', chalk.underline.bgBlue('world') + '!'));
|
||||||
|
|
||||||
|
// Nest styles of the same type even (color, underline, background)
|
||||||
|
log(chalk.green(
|
||||||
|
'I am a green line ' +
|
||||||
|
chalk.blue.underline.bold('with a blue substring') +
|
||||||
|
' that becomes green again!'
|
||||||
|
));
|
||||||
|
|
||||||
|
// ES2015 template literal
|
||||||
|
log(`
|
||||||
|
CPU: ${chalk.red('90%')}
|
||||||
|
RAM: ${chalk.green('40%')}
|
||||||
|
DISK: ${chalk.yellow('70%')}
|
||||||
|
`);
|
||||||
|
|
||||||
|
// ES2015 tagged template literal
|
||||||
|
log(chalk`
|
||||||
|
CPU: {red ${cpu.totalPercent}%}
|
||||||
|
RAM: {green ${ram.used / ram.total * 100}%}
|
||||||
|
DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%}
|
||||||
|
`);
|
||||||
|
|
||||||
|
// Use RGB colors in terminal emulators that support it.
|
||||||
|
log(chalk.keyword('orange')('Yay for orange colored text!'));
|
||||||
|
log(chalk.rgb(123, 45, 67).underline('Underlined reddish color'));
|
||||||
|
log(chalk.hex('#DEADED').bold('Bold gray!'));
|
||||||
|
```
|
||||||
|
|
||||||
|
Easily define your own themes:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const chalk = require('chalk');
|
||||||
|
|
||||||
|
const error = chalk.bold.red;
|
||||||
|
const warning = chalk.keyword('orange');
|
||||||
|
|
||||||
|
console.log(error('Error!'));
|
||||||
|
console.log(warning('Warning!'));
|
||||||
|
```
|
||||||
|
|
||||||
|
Take advantage of console.log [string substitution](https://nodejs.org/docs/latest/api/console.html#console_console_log_data_args):
|
||||||
|
|
||||||
|
```js
|
||||||
|
const name = 'Sindre';
|
||||||
|
console.log(chalk.green('Hello %s'), name);
|
||||||
|
//=> 'Hello Sindre'
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### chalk.`<style>[.<style>...](string, [string...])`
|
||||||
|
|
||||||
|
Example: `chalk.red.bold.underline('Hello', 'world');`
|
||||||
|
|
||||||
|
Chain [styles](#styles) and call the last one as a method with a string argument. Order doesn't matter, and later styles take precedent in case of a conflict. This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`.
|
||||||
|
|
||||||
|
Multiple arguments will be separated by space.
|
||||||
|
|
||||||
|
### chalk.level
|
||||||
|
|
||||||
|
Specifies the level of color support.
|
||||||
|
|
||||||
|
Color support is automatically detected, but you can override it by setting the `level` property. You should however only do this in your own code as it applies globally to all Chalk consumers.
|
||||||
|
|
||||||
|
If you need to change this in a reusable module, create a new instance:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const ctx = new chalk.Instance({level: 0});
|
||||||
|
```
|
||||||
|
|
||||||
|
| Level | Description |
|
||||||
|
| :---: | :--- |
|
||||||
|
| `0` | All colors disabled |
|
||||||
|
| `1` | Basic color support (16 colors) |
|
||||||
|
| `2` | 256 color support |
|
||||||
|
| `3` | Truecolor support (16 million colors) |
|
||||||
|
|
||||||
|
### chalk.supportsColor
|
||||||
|
|
||||||
|
Detect whether the terminal [supports color](https://github.com/chalk/supports-color). Used internally and handled for you, but exposed for convenience.
|
||||||
|
|
||||||
|
Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, use the environment variable `FORCE_COLOR=1` (level 1), `FORCE_COLOR=2` (level 2), or `FORCE_COLOR=3` (level 3) to forcefully enable color, or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks.
|
||||||
|
|
||||||
|
Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively.
|
||||||
|
|
||||||
|
### chalk.stderr and chalk.stderr.supportsColor
|
||||||
|
|
||||||
|
`chalk.stderr` contains a separate instance configured with color support detected for `stderr` stream instead of `stdout`. Override rules from `chalk.supportsColor` apply to this too. `chalk.stderr.supportsColor` is exposed for convenience.
|
||||||
|
|
||||||
|
## Styles
|
||||||
|
|
||||||
|
### Modifiers
|
||||||
|
|
||||||
|
- `reset` - Resets the current color chain.
|
||||||
|
- `bold` - Make text bold.
|
||||||
|
- `dim` - Emitting only a small amount of light.
|
||||||
|
- `italic` - Make text italic. *(Not widely supported)*
|
||||||
|
- `underline` - Make text underline. *(Not widely supported)*
|
||||||
|
- `inverse`- Inverse background and foreground colors.
|
||||||
|
- `hidden` - Prints the text, but makes it invisible.
|
||||||
|
- `strikethrough` - Puts a horizontal line through the center of the text. *(Not widely supported)*
|
||||||
|
- `visible`- Prints the text only when Chalk has a color level > 0. Can be useful for things that are purely cosmetic.
|
||||||
|
|
||||||
|
### Colors
|
||||||
|
|
||||||
|
- `black`
|
||||||
|
- `red`
|
||||||
|
- `green`
|
||||||
|
- `yellow`
|
||||||
|
- `blue`
|
||||||
|
- `magenta`
|
||||||
|
- `cyan`
|
||||||
|
- `white`
|
||||||
|
- `blackBright` (alias: `gray`, `grey`)
|
||||||
|
- `redBright`
|
||||||
|
- `greenBright`
|
||||||
|
- `yellowBright`
|
||||||
|
- `blueBright`
|
||||||
|
- `magentaBright`
|
||||||
|
- `cyanBright`
|
||||||
|
- `whiteBright`
|
||||||
|
|
||||||
|
### Background colors
|
||||||
|
|
||||||
|
- `bgBlack`
|
||||||
|
- `bgRed`
|
||||||
|
- `bgGreen`
|
||||||
|
- `bgYellow`
|
||||||
|
- `bgBlue`
|
||||||
|
- `bgMagenta`
|
||||||
|
- `bgCyan`
|
||||||
|
- `bgWhite`
|
||||||
|
- `bgBlackBright` (alias: `bgGray`, `bgGrey`)
|
||||||
|
- `bgRedBright`
|
||||||
|
- `bgGreenBright`
|
||||||
|
- `bgYellowBright`
|
||||||
|
- `bgBlueBright`
|
||||||
|
- `bgMagentaBright`
|
||||||
|
- `bgCyanBright`
|
||||||
|
- `bgWhiteBright`
|
||||||
|
|
||||||
|
## Tagged template literal
|
||||||
|
|
||||||
|
Chalk can be used as a [tagged template literal](https://exploringjs.com/es6/ch_template-literals.html#_tagged-template-literals).
|
||||||
|
|
||||||
|
```js
|
||||||
|
const chalk = require('chalk');
|
||||||
|
|
||||||
|
const miles = 18;
|
||||||
|
const calculateFeet = miles => miles * 5280;
|
||||||
|
|
||||||
|
console.log(chalk`
|
||||||
|
There are {bold 5280 feet} in a mile.
|
||||||
|
In {bold ${miles} miles}, there are {green.bold ${calculateFeet(miles)} feet}.
|
||||||
|
`);
|
||||||
|
```
|
||||||
|
|
||||||
|
Blocks are delimited by an opening curly brace (`{`), a style, some content, and a closing curly brace (`}`).
|
||||||
|
|
||||||
|
Template styles are chained exactly like normal Chalk styles. The following three statements are equivalent:
|
||||||
|
|
||||||
|
```js
|
||||||
|
console.log(chalk.bold.rgb(10, 100, 200)('Hello!'));
|
||||||
|
console.log(chalk.bold.rgb(10, 100, 200)`Hello!`);
|
||||||
|
console.log(chalk`{bold.rgb(10,100,200) Hello!}`);
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that function styles (`rgb()`, `hsl()`, `keyword()`, etc.) may not contain spaces between parameters.
|
||||||
|
|
||||||
|
All interpolated values (`` chalk`${foo}` ``) are converted to strings via the `.toString()` method. All curly braces (`{` and `}`) in interpolated value strings are escaped.
|
||||||
|
|
||||||
|
## 256 and Truecolor color support
|
||||||
|
|
||||||
|
Chalk supports 256 colors and [Truecolor](https://gist.github.com/XVilka/8346728) (16 million colors) on supported terminal apps.
|
||||||
|
|
||||||
|
Colors are downsampled from 16 million RGB values to an ANSI color format that is supported by the terminal emulator (or by specifying `{level: n}` as a Chalk option). For example, Chalk configured to run at level 1 (basic color support) will downsample an RGB value of #FF0000 (red) to 31 (ANSI escape for red).
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
- `chalk.hex('#DEADED').underline('Hello, world!')`
|
||||||
|
- `chalk.keyword('orange')('Some orange text')`
|
||||||
|
- `chalk.rgb(15, 100, 204).inverse('Hello!')`
|
||||||
|
|
||||||
|
Background versions of these models are prefixed with `bg` and the first level of the module capitalized (e.g. `keyword` for foreground colors and `bgKeyword` for background colors).
|
||||||
|
|
||||||
|
- `chalk.bgHex('#DEADED').underline('Hello, world!')`
|
||||||
|
- `chalk.bgKeyword('orange')('Some orange text')`
|
||||||
|
- `chalk.bgRgb(15, 100, 204).inverse('Hello!')`
|
||||||
|
|
||||||
|
The following color models can be used:
|
||||||
|
|
||||||
|
- [`rgb`](https://en.wikipedia.org/wiki/RGB_color_model) - Example: `chalk.rgb(255, 136, 0).bold('Orange!')`
|
||||||
|
- [`hex`](https://en.wikipedia.org/wiki/Web_colors#Hex_triplet) - Example: `chalk.hex('#FF8800').bold('Orange!')`
|
||||||
|
- [`keyword`](https://www.w3.org/wiki/CSS/Properties/color/keywords) (CSS keywords) - Example: `chalk.keyword('orange').bold('Orange!')`
|
||||||
|
- [`hsl`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsl(32, 100, 50).bold('Orange!')`
|
||||||
|
- [`hsv`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsv(32, 100, 100).bold('Orange!')`
|
||||||
|
- [`hwb`](https://en.wikipedia.org/wiki/HWB_color_model) - Example: `chalk.hwb(32, 0, 50).bold('Orange!')`
|
||||||
|
- [`ansi`](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) - Example: `chalk.ansi(31).bgAnsi(93)('red on yellowBright')`
|
||||||
|
- [`ansi256`](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) - Example: `chalk.bgAnsi256(194)('Honeydew, more or less')`
|
||||||
|
|
||||||
|
## Windows
|
||||||
|
|
||||||
|
If you're on Windows, do yourself a favor and use [Windows Terminal](https://github.com/microsoft/terminal) instead of `cmd.exe`.
|
||||||
|
|
||||||
|
## Origin story
|
||||||
|
|
||||||
|
[colors.js](https://github.com/Marak/colors.js) used to be the most popular string styling module, but it has serious deficiencies like extending `String.prototype` which causes all kinds of [problems](https://github.com/yeoman/yo/issues/68) and the package is unmaintained. Although there are other packages, they either do too much or not enough. Chalk is a clean and focused alternative.
|
||||||
|
|
||||||
|
## chalk for enterprise
|
||||||
|
|
||||||
|
Available as part of the Tidelift Subscription.
|
||||||
|
|
||||||
|
The maintainers of chalk and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-chalk?utm_source=npm-chalk&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
||||||
|
|
||||||
|
## Related
|
||||||
|
|
||||||
|
- [chalk-cli](https://github.com/chalk/chalk-cli) - CLI for this module
|
||||||
|
- [ansi-styles](https://github.com/chalk/ansi-styles) - ANSI escape codes for styling strings in the terminal
|
||||||
|
- [supports-color](https://github.com/chalk/supports-color) - Detect whether a terminal supports color
|
||||||
|
- [strip-ansi](https://github.com/chalk/strip-ansi) - Strip ANSI escape codes
|
||||||
|
- [strip-ansi-stream](https://github.com/chalk/strip-ansi-stream) - Strip ANSI escape codes from a stream
|
||||||
|
- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes
|
||||||
|
- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes
|
||||||
|
- [wrap-ansi](https://github.com/chalk/wrap-ansi) - Wordwrap a string with ANSI escape codes
|
||||||
|
- [slice-ansi](https://github.com/chalk/slice-ansi) - Slice a string with ANSI escape codes
|
||||||
|
- [color-convert](https://github.com/qix-/color-convert) - Converts colors between different models
|
||||||
|
- [chalk-animation](https://github.com/bokub/chalk-animation) - Animate strings in the terminal
|
||||||
|
- [gradient-string](https://github.com/bokub/gradient-string) - Apply color gradients to strings
|
||||||
|
- [chalk-pipe](https://github.com/LitoMore/chalk-pipe) - Create chalk style schemes with simpler style strings
|
||||||
|
- [terminal-link](https://github.com/sindresorhus/terminal-link) - Create clickable links in the terminal
|
||||||
|
|
||||||
|
## Maintainers
|
||||||
|
|
||||||
|
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||||
|
- [Josh Junon](https://github.com/qix-)
|
||||||
|
|
@ -0,0 +1,229 @@
|
||||||
|
'use strict';
|
||||||
|
const ansiStyles = require('ansi-styles');
|
||||||
|
const {stdout: stdoutColor, stderr: stderrColor} = require('supports-color');
|
||||||
|
const {
|
||||||
|
stringReplaceAll,
|
||||||
|
stringEncaseCRLFWithFirstIndex
|
||||||
|
} = require('./util');
|
||||||
|
|
||||||
|
const {isArray} = Array;
|
||||||
|
|
||||||
|
// `supportsColor.level` → `ansiStyles.color[name]` mapping
|
||||||
|
const levelMapping = [
|
||||||
|
'ansi',
|
||||||
|
'ansi',
|
||||||
|
'ansi256',
|
||||||
|
'ansi16m'
|
||||||
|
];
|
||||||
|
|
||||||
|
const styles = Object.create(null);
|
||||||
|
|
||||||
|
const applyOptions = (object, options = {}) => {
|
||||||
|
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
||||||
|
throw new Error('The `level` option should be an integer from 0 to 3');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Detect level if not set manually
|
||||||
|
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
||||||
|
object.level = options.level === undefined ? colorLevel : options.level;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ChalkClass {
|
||||||
|
constructor(options) {
|
||||||
|
// eslint-disable-next-line no-constructor-return
|
||||||
|
return chalkFactory(options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const chalkFactory = options => {
|
||||||
|
const chalk = {};
|
||||||
|
applyOptions(chalk, options);
|
||||||
|
|
||||||
|
chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_);
|
||||||
|
|
||||||
|
Object.setPrototypeOf(chalk, Chalk.prototype);
|
||||||
|
Object.setPrototypeOf(chalk.template, chalk);
|
||||||
|
|
||||||
|
chalk.template.constructor = () => {
|
||||||
|
throw new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.');
|
||||||
|
};
|
||||||
|
|
||||||
|
chalk.template.Instance = ChalkClass;
|
||||||
|
|
||||||
|
return chalk.template;
|
||||||
|
};
|
||||||
|
|
||||||
|
function Chalk(options) {
|
||||||
|
return chalkFactory(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const [styleName, style] of Object.entries(ansiStyles)) {
|
||||||
|
styles[styleName] = {
|
||||||
|
get() {
|
||||||
|
const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
|
||||||
|
Object.defineProperty(this, styleName, {value: builder});
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
styles.visible = {
|
||||||
|
get() {
|
||||||
|
const builder = createBuilder(this, this._styler, true);
|
||||||
|
Object.defineProperty(this, 'visible', {value: builder});
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256'];
|
||||||
|
|
||||||
|
for (const model of usedModels) {
|
||||||
|
styles[model] = {
|
||||||
|
get() {
|
||||||
|
const {level} = this;
|
||||||
|
return function (...arguments_) {
|
||||||
|
const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
|
||||||
|
return createBuilder(this, styler, this._isEmpty);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const model of usedModels) {
|
||||||
|
const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
|
||||||
|
styles[bgModel] = {
|
||||||
|
get() {
|
||||||
|
const {level} = this;
|
||||||
|
return function (...arguments_) {
|
||||||
|
const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
|
||||||
|
return createBuilder(this, styler, this._isEmpty);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const proto = Object.defineProperties(() => {}, {
|
||||||
|
...styles,
|
||||||
|
level: {
|
||||||
|
enumerable: true,
|
||||||
|
get() {
|
||||||
|
return this._generator.level;
|
||||||
|
},
|
||||||
|
set(level) {
|
||||||
|
this._generator.level = level;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const createStyler = (open, close, parent) => {
|
||||||
|
let openAll;
|
||||||
|
let closeAll;
|
||||||
|
if (parent === undefined) {
|
||||||
|
openAll = open;
|
||||||
|
closeAll = close;
|
||||||
|
} else {
|
||||||
|
openAll = parent.openAll + open;
|
||||||
|
closeAll = close + parent.closeAll;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
open,
|
||||||
|
close,
|
||||||
|
openAll,
|
||||||
|
closeAll,
|
||||||
|
parent
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const createBuilder = (self, _styler, _isEmpty) => {
|
||||||
|
const builder = (...arguments_) => {
|
||||||
|
if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) {
|
||||||
|
// Called as a template literal, for example: chalk.red`2 + 3 = {bold ${2+3}}`
|
||||||
|
return applyStyle(builder, chalkTag(builder, ...arguments_));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Single argument is hot path, implicit coercion is faster than anything
|
||||||
|
// eslint-disable-next-line no-implicit-coercion
|
||||||
|
return applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' '));
|
||||||
|
};
|
||||||
|
|
||||||
|
// We alter the prototype because we must return a function, but there is
|
||||||
|
// no way to create a function with a different prototype
|
||||||
|
Object.setPrototypeOf(builder, proto);
|
||||||
|
|
||||||
|
builder._generator = self;
|
||||||
|
builder._styler = _styler;
|
||||||
|
builder._isEmpty = _isEmpty;
|
||||||
|
|
||||||
|
return builder;
|
||||||
|
};
|
||||||
|
|
||||||
|
const applyStyle = (self, string) => {
|
||||||
|
if (self.level <= 0 || !string) {
|
||||||
|
return self._isEmpty ? '' : string;
|
||||||
|
}
|
||||||
|
|
||||||
|
let styler = self._styler;
|
||||||
|
|
||||||
|
if (styler === undefined) {
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const {openAll, closeAll} = styler;
|
||||||
|
if (string.indexOf('\u001B') !== -1) {
|
||||||
|
while (styler !== undefined) {
|
||||||
|
// Replace any instances already present with a re-opening code
|
||||||
|
// otherwise only the part of the string until said closing code
|
||||||
|
// will be colored, and the rest will simply be 'plain'.
|
||||||
|
string = stringReplaceAll(string, styler.close, styler.open);
|
||||||
|
|
||||||
|
styler = styler.parent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// We can move both next actions out of loop, because remaining actions in loop won't have
|
||||||
|
// any/visible effect on parts we add here. Close the styling before a linebreak and reopen
|
||||||
|
// after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92
|
||||||
|
const lfIndex = string.indexOf('\n');
|
||||||
|
if (lfIndex !== -1) {
|
||||||
|
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
return openAll + string + closeAll;
|
||||||
|
};
|
||||||
|
|
||||||
|
let template;
|
||||||
|
const chalkTag = (chalk, ...strings) => {
|
||||||
|
const [firstString] = strings;
|
||||||
|
|
||||||
|
if (!isArray(firstString) || !isArray(firstString.raw)) {
|
||||||
|
// If chalk() was called by itself or with a string,
|
||||||
|
// return the string itself as a string.
|
||||||
|
return strings.join(' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
const arguments_ = strings.slice(1);
|
||||||
|
const parts = [firstString.raw[0]];
|
||||||
|
|
||||||
|
for (let i = 1; i < firstString.length; i++) {
|
||||||
|
parts.push(
|
||||||
|
String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'),
|
||||||
|
String(firstString.raw[i])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (template === undefined) {
|
||||||
|
template = require('./templates');
|
||||||
|
}
|
||||||
|
|
||||||
|
return template(chalk, parts.join(''));
|
||||||
|
};
|
||||||
|
|
||||||
|
Object.defineProperties(Chalk.prototype, styles);
|
||||||
|
|
||||||
|
const chalk = Chalk(); // eslint-disable-line new-cap
|
||||||
|
chalk.supportsColor = stdoutColor;
|
||||||
|
chalk.stderr = Chalk({level: stderrColor ? stderrColor.level : 0}); // eslint-disable-line new-cap
|
||||||
|
chalk.stderr.supportsColor = stderrColor;
|
||||||
|
|
||||||
|
module.exports = chalk;
|
||||||
134
node_modules/@commitlint/format/node_modules/chalk/source/templates.js
generated
vendored
100644
134
node_modules/@commitlint/format/node_modules/chalk/source/templates.js
generated
vendored
100644
|
|
@ -0,0 +1,134 @@
|
||||||
|
'use strict';
|
||||||
|
const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
|
||||||
|
const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
|
||||||
|
const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
|
||||||
|
const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
|
||||||
|
|
||||||
|
const ESCAPES = new Map([
|
||||||
|
['n', '\n'],
|
||||||
|
['r', '\r'],
|
||||||
|
['t', '\t'],
|
||||||
|
['b', '\b'],
|
||||||
|
['f', '\f'],
|
||||||
|
['v', '\v'],
|
||||||
|
['0', '\0'],
|
||||||
|
['\\', '\\'],
|
||||||
|
['e', '\u001B'],
|
||||||
|
['a', '\u0007']
|
||||||
|
]);
|
||||||
|
|
||||||
|
function unescape(c) {
|
||||||
|
const u = c[0] === 'u';
|
||||||
|
const bracket = c[1] === '{';
|
||||||
|
|
||||||
|
if ((u && !bracket && c.length === 5) || (c[0] === 'x' && c.length === 3)) {
|
||||||
|
return String.fromCharCode(parseInt(c.slice(1), 16));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (u && bracket) {
|
||||||
|
return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
|
||||||
|
}
|
||||||
|
|
||||||
|
return ESCAPES.get(c) || c;
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseArguments(name, arguments_) {
|
||||||
|
const results = [];
|
||||||
|
const chunks = arguments_.trim().split(/\s*,\s*/g);
|
||||||
|
let matches;
|
||||||
|
|
||||||
|
for (const chunk of chunks) {
|
||||||
|
const number = Number(chunk);
|
||||||
|
if (!Number.isNaN(number)) {
|
||||||
|
results.push(number);
|
||||||
|
} else if ((matches = chunk.match(STRING_REGEX))) {
|
||||||
|
results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
|
||||||
|
} else {
|
||||||
|
throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseStyle(style) {
|
||||||
|
STYLE_REGEX.lastIndex = 0;
|
||||||
|
|
||||||
|
const results = [];
|
||||||
|
let matches;
|
||||||
|
|
||||||
|
while ((matches = STYLE_REGEX.exec(style)) !== null) {
|
||||||
|
const name = matches[1];
|
||||||
|
|
||||||
|
if (matches[2]) {
|
||||||
|
const args = parseArguments(name, matches[2]);
|
||||||
|
results.push([name].concat(args));
|
||||||
|
} else {
|
||||||
|
results.push([name]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildStyle(chalk, styles) {
|
||||||
|
const enabled = {};
|
||||||
|
|
||||||
|
for (const layer of styles) {
|
||||||
|
for (const style of layer.styles) {
|
||||||
|
enabled[style[0]] = layer.inverse ? null : style.slice(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let current = chalk;
|
||||||
|
for (const [styleName, styles] of Object.entries(enabled)) {
|
||||||
|
if (!Array.isArray(styles)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(styleName in current)) {
|
||||||
|
throw new Error(`Unknown Chalk style: ${styleName}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
current = styles.length > 0 ? current[styleName](...styles) : current[styleName];
|
||||||
|
}
|
||||||
|
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = (chalk, temporary) => {
|
||||||
|
const styles = [];
|
||||||
|
const chunks = [];
|
||||||
|
let chunk = [];
|
||||||
|
|
||||||
|
// eslint-disable-next-line max-params
|
||||||
|
temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {
|
||||||
|
if (escapeCharacter) {
|
||||||
|
chunk.push(unescape(escapeCharacter));
|
||||||
|
} else if (style) {
|
||||||
|
const string = chunk.join('');
|
||||||
|
chunk = [];
|
||||||
|
chunks.push(styles.length === 0 ? string : buildStyle(chalk, styles)(string));
|
||||||
|
styles.push({inverse, styles: parseStyle(style)});
|
||||||
|
} else if (close) {
|
||||||
|
if (styles.length === 0) {
|
||||||
|
throw new Error('Found extraneous } in Chalk template literal');
|
||||||
|
}
|
||||||
|
|
||||||
|
chunks.push(buildStyle(chalk, styles)(chunk.join('')));
|
||||||
|
chunk = [];
|
||||||
|
styles.pop();
|
||||||
|
} else {
|
||||||
|
chunk.push(character);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
chunks.push(chunk.join(''));
|
||||||
|
|
||||||
|
if (styles.length > 0) {
|
||||||
|
const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`;
|
||||||
|
throw new Error(errMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
return chunks.join('');
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
const stringReplaceAll = (string, substring, replacer) => {
|
||||||
|
let index = string.indexOf(substring);
|
||||||
|
if (index === -1) {
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const substringLength = substring.length;
|
||||||
|
let endIndex = 0;
|
||||||
|
let returnValue = '';
|
||||||
|
do {
|
||||||
|
returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
|
||||||
|
endIndex = index + substringLength;
|
||||||
|
index = string.indexOf(substring, endIndex);
|
||||||
|
} while (index !== -1);
|
||||||
|
|
||||||
|
returnValue += string.substr(endIndex);
|
||||||
|
return returnValue;
|
||||||
|
};
|
||||||
|
|
||||||
|
const stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => {
|
||||||
|
let endIndex = 0;
|
||||||
|
let returnValue = '';
|
||||||
|
do {
|
||||||
|
const gotCR = string[index - 1] === '\r';
|
||||||
|
returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix;
|
||||||
|
endIndex = index + 1;
|
||||||
|
index = string.indexOf('\n', endIndex);
|
||||||
|
} while (index !== -1);
|
||||||
|
|
||||||
|
returnValue += string.substr(endIndex);
|
||||||
|
return returnValue;
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
stringReplaceAll,
|
||||||
|
stringEncaseCRLFWithFirstIndex
|
||||||
|
};
|
||||||
54
node_modules/@commitlint/format/node_modules/color-convert/CHANGELOG.md
generated
vendored
100644
54
node_modules/@commitlint/format/node_modules/color-convert/CHANGELOG.md
generated
vendored
100644
|
|
@ -0,0 +1,54 @@
|
||||||
|
# 1.0.0 - 2016-01-07
|
||||||
|
|
||||||
|
- Removed: unused speed test
|
||||||
|
- Added: Automatic routing between previously unsupported conversions
|
||||||
|
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||||
|
- Removed: `xxx2xxx()` and `xxx2xxxRaw()` functions
|
||||||
|
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||||
|
- Removed: `convert()` class
|
||||||
|
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||||
|
- Changed: all functions to lookup dictionary
|
||||||
|
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||||
|
- Changed: `ansi` to `ansi256`
|
||||||
|
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||||
|
- Fixed: argument grouping for functions requiring only one argument
|
||||||
|
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||||
|
|
||||||
|
# 0.6.0 - 2015-07-23
|
||||||
|
|
||||||
|
- Added: methods to handle
|
||||||
|
[ANSI](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors) 16/256 colors:
|
||||||
|
- rgb2ansi16
|
||||||
|
- rgb2ansi
|
||||||
|
- hsl2ansi16
|
||||||
|
- hsl2ansi
|
||||||
|
- hsv2ansi16
|
||||||
|
- hsv2ansi
|
||||||
|
- hwb2ansi16
|
||||||
|
- hwb2ansi
|
||||||
|
- cmyk2ansi16
|
||||||
|
- cmyk2ansi
|
||||||
|
- keyword2ansi16
|
||||||
|
- keyword2ansi
|
||||||
|
- ansi162rgb
|
||||||
|
- ansi162hsl
|
||||||
|
- ansi162hsv
|
||||||
|
- ansi162hwb
|
||||||
|
- ansi162cmyk
|
||||||
|
- ansi162keyword
|
||||||
|
- ansi2rgb
|
||||||
|
- ansi2hsl
|
||||||
|
- ansi2hsv
|
||||||
|
- ansi2hwb
|
||||||
|
- ansi2cmyk
|
||||||
|
- ansi2keyword
|
||||||
|
([#18](https://github.com/harthur/color-convert/pull/18))
|
||||||
|
|
||||||
|
# 0.5.3 - 2015-06-02
|
||||||
|
|
||||||
|
- Fixed: hsl2hsv does not return `NaN` anymore when using `[0,0,0]`
|
||||||
|
([#15](https://github.com/harthur/color-convert/issues/15))
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Check out commit logs for older releases
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
Copyright (c) 2011-2016 Heather Arthur <fayearthur@gmail.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.
|
||||||
|
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
# color-convert
|
||||||
|
|
||||||
|
[](https://travis-ci.org/Qix-/color-convert)
|
||||||
|
|
||||||
|
Color-convert is a color conversion library for JavaScript and node.
|
||||||
|
It converts all ways between `rgb`, `hsl`, `hsv`, `hwb`, `cmyk`, `ansi`, `ansi16`, `hex` strings, and CSS `keyword`s (will round to closest):
|
||||||
|
|
||||||
|
```js
|
||||||
|
var convert = require('color-convert');
|
||||||
|
|
||||||
|
convert.rgb.hsl(140, 200, 100); // [96, 48, 59]
|
||||||
|
convert.keyword.rgb('blue'); // [0, 0, 255]
|
||||||
|
|
||||||
|
var rgbChannels = convert.rgb.channels; // 3
|
||||||
|
var cmykChannels = convert.cmyk.channels; // 4
|
||||||
|
var ansiChannels = convert.ansi16.channels; // 1
|
||||||
|
```
|
||||||
|
|
||||||
|
# Install
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ npm install color-convert
|
||||||
|
```
|
||||||
|
|
||||||
|
# API
|
||||||
|
|
||||||
|
Simply get the property of the _from_ and _to_ conversion that you're looking for.
|
||||||
|
|
||||||
|
All functions have a rounded and unrounded variant. By default, return values are rounded. To get the unrounded (raw) results, simply tack on `.raw` to the function.
|
||||||
|
|
||||||
|
All 'from' functions have a hidden property called `.channels` that indicates the number of channels the function expects (not including alpha).
|
||||||
|
|
||||||
|
```js
|
||||||
|
var convert = require('color-convert');
|
||||||
|
|
||||||
|
// Hex to LAB
|
||||||
|
convert.hex.lab('DEADBF'); // [ 76, 21, -2 ]
|
||||||
|
convert.hex.lab.raw('DEADBF'); // [ 75.56213190997677, 20.653827952644754, -2.290532499330533 ]
|
||||||
|
|
||||||
|
// RGB to CMYK
|
||||||
|
convert.rgb.cmyk(167, 255, 4); // [ 35, 0, 98, 0 ]
|
||||||
|
convert.rgb.cmyk.raw(167, 255, 4); // [ 34.509803921568626, 0, 98.43137254901961, 0 ]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Arrays
|
||||||
|
All functions that accept multiple arguments also support passing an array.
|
||||||
|
|
||||||
|
Note that this does **not** apply to functions that convert from a color that only requires one value (e.g. `keyword`, `ansi256`, `hex`, etc.)
|
||||||
|
|
||||||
|
```js
|
||||||
|
var convert = require('color-convert');
|
||||||
|
|
||||||
|
convert.rgb.hex(123, 45, 67); // '7B2D43'
|
||||||
|
convert.rgb.hex([123, 45, 67]); // '7B2D43'
|
||||||
|
```
|
||||||
|
|
||||||
|
## Routing
|
||||||
|
|
||||||
|
Conversions that don't have an _explicitly_ defined conversion (in [conversions.js](conversions.js)), but can be converted by means of sub-conversions (e.g. XYZ -> **RGB** -> CMYK), are automatically routed together. This allows just about any color model supported by `color-convert` to be converted to any other model, so long as a sub-conversion path exists. This is also true for conversions requiring more than one step in between (e.g. LCH -> **LAB** -> **XYZ** -> **RGB** -> Hex).
|
||||||
|
|
||||||
|
Keep in mind that extensive conversions _may_ result in a loss of precision, and exist only to be complete. For a list of "direct" (single-step) conversions, see [conversions.js](conversions.js).
|
||||||
|
|
||||||
|
# Contribute
|
||||||
|
|
||||||
|
If there is a new model you would like to support, or want to add a direct conversion between two existing models, please send us a pull request.
|
||||||
|
|
||||||
|
# License
|
||||||
|
Copyright © 2011-2016, Heather Arthur and Josh Junon. Licensed under the [MIT License](LICENSE).
|
||||||
839
node_modules/@commitlint/format/node_modules/color-convert/conversions.js
generated
vendored
100644
839
node_modules/@commitlint/format/node_modules/color-convert/conversions.js
generated
vendored
100644
|
|
@ -0,0 +1,839 @@
|
||||||
|
/* MIT license */
|
||||||
|
/* eslint-disable no-mixed-operators */
|
||||||
|
const cssKeywords = require('color-name');
|
||||||
|
|
||||||
|
// NOTE: conversions should only return primitive values (i.e. arrays, or
|
||||||
|
// values that give correct `typeof` results).
|
||||||
|
// do not use box values types (i.e. Number(), String(), etc.)
|
||||||
|
|
||||||
|
const reverseKeywords = {};
|
||||||
|
for (const key of Object.keys(cssKeywords)) {
|
||||||
|
reverseKeywords[cssKeywords[key]] = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
const convert = {
|
||||||
|
rgb: {channels: 3, labels: 'rgb'},
|
||||||
|
hsl: {channels: 3, labels: 'hsl'},
|
||||||
|
hsv: {channels: 3, labels: 'hsv'},
|
||||||
|
hwb: {channels: 3, labels: 'hwb'},
|
||||||
|
cmyk: {channels: 4, labels: 'cmyk'},
|
||||||
|
xyz: {channels: 3, labels: 'xyz'},
|
||||||
|
lab: {channels: 3, labels: 'lab'},
|
||||||
|
lch: {channels: 3, labels: 'lch'},
|
||||||
|
hex: {channels: 1, labels: ['hex']},
|
||||||
|
keyword: {channels: 1, labels: ['keyword']},
|
||||||
|
ansi16: {channels: 1, labels: ['ansi16']},
|
||||||
|
ansi256: {channels: 1, labels: ['ansi256']},
|
||||||
|
hcg: {channels: 3, labels: ['h', 'c', 'g']},
|
||||||
|
apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
|
||||||
|
gray: {channels: 1, labels: ['gray']}
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = convert;
|
||||||
|
|
||||||
|
// Hide .channels and .labels properties
|
||||||
|
for (const model of Object.keys(convert)) {
|
||||||
|
if (!('channels' in convert[model])) {
|
||||||
|
throw new Error('missing channels property: ' + model);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!('labels' in convert[model])) {
|
||||||
|
throw new Error('missing channel labels property: ' + model);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (convert[model].labels.length !== convert[model].channels) {
|
||||||
|
throw new Error('channel and label counts mismatch: ' + model);
|
||||||
|
}
|
||||||
|
|
||||||
|
const {channels, labels} = convert[model];
|
||||||
|
delete convert[model].channels;
|
||||||
|
delete convert[model].labels;
|
||||||
|
Object.defineProperty(convert[model], 'channels', {value: channels});
|
||||||
|
Object.defineProperty(convert[model], 'labels', {value: labels});
|
||||||
|
}
|
||||||
|
|
||||||
|
convert.rgb.hsl = function (rgb) {
|
||||||
|
const r = rgb[0] / 255;
|
||||||
|
const g = rgb[1] / 255;
|
||||||
|
const b = rgb[2] / 255;
|
||||||
|
const min = Math.min(r, g, b);
|
||||||
|
const max = Math.max(r, g, b);
|
||||||
|
const delta = max - min;
|
||||||
|
let h;
|
||||||
|
let s;
|
||||||
|
|
||||||
|
if (max === min) {
|
||||||
|
h = 0;
|
||||||
|
} else if (r === max) {
|
||||||
|
h = (g - b) / delta;
|
||||||
|
} else if (g === max) {
|
||||||
|
h = 2 + (b - r) / delta;
|
||||||
|
} else if (b === max) {
|
||||||
|
h = 4 + (r - g) / delta;
|
||||||
|
}
|
||||||
|
|
||||||
|
h = Math.min(h * 60, 360);
|
||||||
|
|
||||||
|
if (h < 0) {
|
||||||
|
h += 360;
|
||||||
|
}
|
||||||
|
|
||||||
|
const l = (min + max) / 2;
|
||||||
|
|
||||||
|
if (max === min) {
|
||||||
|
s = 0;
|
||||||
|
} else if (l <= 0.5) {
|
||||||
|
s = delta / (max + min);
|
||||||
|
} else {
|
||||||
|
s = delta / (2 - max - min);
|
||||||
|
}
|
||||||
|
|
||||||
|
return [h, s * 100, l * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.rgb.hsv = function (rgb) {
|
||||||
|
let rdif;
|
||||||
|
let gdif;
|
||||||
|
let bdif;
|
||||||
|
let h;
|
||||||
|
let s;
|
||||||
|
|
||||||
|
const r = rgb[0] / 255;
|
||||||
|
const g = rgb[1] / 255;
|
||||||
|
const b = rgb[2] / 255;
|
||||||
|
const v = Math.max(r, g, b);
|
||||||
|
const diff = v - Math.min(r, g, b);
|
||||||
|
const diffc = function (c) {
|
||||||
|
return (v - c) / 6 / diff + 1 / 2;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (diff === 0) {
|
||||||
|
h = 0;
|
||||||
|
s = 0;
|
||||||
|
} else {
|
||||||
|
s = diff / v;
|
||||||
|
rdif = diffc(r);
|
||||||
|
gdif = diffc(g);
|
||||||
|
bdif = diffc(b);
|
||||||
|
|
||||||
|
if (r === v) {
|
||||||
|
h = bdif - gdif;
|
||||||
|
} else if (g === v) {
|
||||||
|
h = (1 / 3) + rdif - bdif;
|
||||||
|
} else if (b === v) {
|
||||||
|
h = (2 / 3) + gdif - rdif;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (h < 0) {
|
||||||
|
h += 1;
|
||||||
|
} else if (h > 1) {
|
||||||
|
h -= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
h * 360,
|
||||||
|
s * 100,
|
||||||
|
v * 100
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.rgb.hwb = function (rgb) {
|
||||||
|
const r = rgb[0];
|
||||||
|
const g = rgb[1];
|
||||||
|
let b = rgb[2];
|
||||||
|
const h = convert.rgb.hsl(rgb)[0];
|
||||||
|
const w = 1 / 255 * Math.min(r, Math.min(g, b));
|
||||||
|
|
||||||
|
b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
|
||||||
|
|
||||||
|
return [h, w * 100, b * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.rgb.cmyk = function (rgb) {
|
||||||
|
const r = rgb[0] / 255;
|
||||||
|
const g = rgb[1] / 255;
|
||||||
|
const b = rgb[2] / 255;
|
||||||
|
|
||||||
|
const k = Math.min(1 - r, 1 - g, 1 - b);
|
||||||
|
const c = (1 - r - k) / (1 - k) || 0;
|
||||||
|
const m = (1 - g - k) / (1 - k) || 0;
|
||||||
|
const y = (1 - b - k) / (1 - k) || 0;
|
||||||
|
|
||||||
|
return [c * 100, m * 100, y * 100, k * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
function comparativeDistance(x, y) {
|
||||||
|
/*
|
||||||
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
||||||
|
*/
|
||||||
|
return (
|
||||||
|
((x[0] - y[0]) ** 2) +
|
||||||
|
((x[1] - y[1]) ** 2) +
|
||||||
|
((x[2] - y[2]) ** 2)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
convert.rgb.keyword = function (rgb) {
|
||||||
|
const reversed = reverseKeywords[rgb];
|
||||||
|
if (reversed) {
|
||||||
|
return reversed;
|
||||||
|
}
|
||||||
|
|
||||||
|
let currentClosestDistance = Infinity;
|
||||||
|
let currentClosestKeyword;
|
||||||
|
|
||||||
|
for (const keyword of Object.keys(cssKeywords)) {
|
||||||
|
const value = cssKeywords[keyword];
|
||||||
|
|
||||||
|
// Compute comparative distance
|
||||||
|
const distance = comparativeDistance(rgb, value);
|
||||||
|
|
||||||
|
// Check if its less, if so set as closest
|
||||||
|
if (distance < currentClosestDistance) {
|
||||||
|
currentClosestDistance = distance;
|
||||||
|
currentClosestKeyword = keyword;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return currentClosestKeyword;
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.keyword.rgb = function (keyword) {
|
||||||
|
return cssKeywords[keyword];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.rgb.xyz = function (rgb) {
|
||||||
|
let r = rgb[0] / 255;
|
||||||
|
let g = rgb[1] / 255;
|
||||||
|
let b = rgb[2] / 255;
|
||||||
|
|
||||||
|
// Assume sRGB
|
||||||
|
r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92);
|
||||||
|
g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92);
|
||||||
|
b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92);
|
||||||
|
|
||||||
|
const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
|
||||||
|
const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
|
||||||
|
const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
|
||||||
|
|
||||||
|
return [x * 100, y * 100, z * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.rgb.lab = function (rgb) {
|
||||||
|
const xyz = convert.rgb.xyz(rgb);
|
||||||
|
let x = xyz[0];
|
||||||
|
let y = xyz[1];
|
||||||
|
let z = xyz[2];
|
||||||
|
|
||||||
|
x /= 95.047;
|
||||||
|
y /= 100;
|
||||||
|
z /= 108.883;
|
||||||
|
|
||||||
|
x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
|
||||||
|
y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
|
||||||
|
z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
|
||||||
|
|
||||||
|
const l = (116 * y) - 16;
|
||||||
|
const a = 500 * (x - y);
|
||||||
|
const b = 200 * (y - z);
|
||||||
|
|
||||||
|
return [l, a, b];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hsl.rgb = function (hsl) {
|
||||||
|
const h = hsl[0] / 360;
|
||||||
|
const s = hsl[1] / 100;
|
||||||
|
const l = hsl[2] / 100;
|
||||||
|
let t2;
|
||||||
|
let t3;
|
||||||
|
let val;
|
||||||
|
|
||||||
|
if (s === 0) {
|
||||||
|
val = l * 255;
|
||||||
|
return [val, val, val];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (l < 0.5) {
|
||||||
|
t2 = l * (1 + s);
|
||||||
|
} else {
|
||||||
|
t2 = l + s - l * s;
|
||||||
|
}
|
||||||
|
|
||||||
|
const t1 = 2 * l - t2;
|
||||||
|
|
||||||
|
const rgb = [0, 0, 0];
|
||||||
|
for (let i = 0; i < 3; i++) {
|
||||||
|
t3 = h + 1 / 3 * -(i - 1);
|
||||||
|
if (t3 < 0) {
|
||||||
|
t3++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (t3 > 1) {
|
||||||
|
t3--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (6 * t3 < 1) {
|
||||||
|
val = t1 + (t2 - t1) * 6 * t3;
|
||||||
|
} else if (2 * t3 < 1) {
|
||||||
|
val = t2;
|
||||||
|
} else if (3 * t3 < 2) {
|
||||||
|
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
|
||||||
|
} else {
|
||||||
|
val = t1;
|
||||||
|
}
|
||||||
|
|
||||||
|
rgb[i] = val * 255;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rgb;
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hsl.hsv = function (hsl) {
|
||||||
|
const h = hsl[0];
|
||||||
|
let s = hsl[1] / 100;
|
||||||
|
let l = hsl[2] / 100;
|
||||||
|
let smin = s;
|
||||||
|
const lmin = Math.max(l, 0.01);
|
||||||
|
|
||||||
|
l *= 2;
|
||||||
|
s *= (l <= 1) ? l : 2 - l;
|
||||||
|
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
||||||
|
const v = (l + s) / 2;
|
||||||
|
const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
|
||||||
|
|
||||||
|
return [h, sv * 100, v * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hsv.rgb = function (hsv) {
|
||||||
|
const h = hsv[0] / 60;
|
||||||
|
const s = hsv[1] / 100;
|
||||||
|
let v = hsv[2] / 100;
|
||||||
|
const hi = Math.floor(h) % 6;
|
||||||
|
|
||||||
|
const f = h - Math.floor(h);
|
||||||
|
const p = 255 * v * (1 - s);
|
||||||
|
const q = 255 * v * (1 - (s * f));
|
||||||
|
const t = 255 * v * (1 - (s * (1 - f)));
|
||||||
|
v *= 255;
|
||||||
|
|
||||||
|
switch (hi) {
|
||||||
|
case 0:
|
||||||
|
return [v, t, p];
|
||||||
|
case 1:
|
||||||
|
return [q, v, p];
|
||||||
|
case 2:
|
||||||
|
return [p, v, t];
|
||||||
|
case 3:
|
||||||
|
return [p, q, v];
|
||||||
|
case 4:
|
||||||
|
return [t, p, v];
|
||||||
|
case 5:
|
||||||
|
return [v, p, q];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hsv.hsl = function (hsv) {
|
||||||
|
const h = hsv[0];
|
||||||
|
const s = hsv[1] / 100;
|
||||||
|
const v = hsv[2] / 100;
|
||||||
|
const vmin = Math.max(v, 0.01);
|
||||||
|
let sl;
|
||||||
|
let l;
|
||||||
|
|
||||||
|
l = (2 - s) * v;
|
||||||
|
const lmin = (2 - s) * vmin;
|
||||||
|
sl = s * vmin;
|
||||||
|
sl /= (lmin <= 1) ? lmin : 2 - lmin;
|
||||||
|
sl = sl || 0;
|
||||||
|
l /= 2;
|
||||||
|
|
||||||
|
return [h, sl * 100, l * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
// http://dev.w3.org/csswg/css-color/#hwb-to-rgb
|
||||||
|
convert.hwb.rgb = function (hwb) {
|
||||||
|
const h = hwb[0] / 360;
|
||||||
|
let wh = hwb[1] / 100;
|
||||||
|
let bl = hwb[2] / 100;
|
||||||
|
const ratio = wh + bl;
|
||||||
|
let f;
|
||||||
|
|
||||||
|
// Wh + bl cant be > 1
|
||||||
|
if (ratio > 1) {
|
||||||
|
wh /= ratio;
|
||||||
|
bl /= ratio;
|
||||||
|
}
|
||||||
|
|
||||||
|
const i = Math.floor(6 * h);
|
||||||
|
const v = 1 - bl;
|
||||||
|
f = 6 * h - i;
|
||||||
|
|
||||||
|
if ((i & 0x01) !== 0) {
|
||||||
|
f = 1 - f;
|
||||||
|
}
|
||||||
|
|
||||||
|
const n = wh + f * (v - wh); // Linear interpolation
|
||||||
|
|
||||||
|
let r;
|
||||||
|
let g;
|
||||||
|
let b;
|
||||||
|
/* eslint-disable max-statements-per-line,no-multi-spaces */
|
||||||
|
switch (i) {
|
||||||
|
default:
|
||||||
|
case 6:
|
||||||
|
case 0: r = v; g = n; b = wh; break;
|
||||||
|
case 1: r = n; g = v; b = wh; break;
|
||||||
|
case 2: r = wh; g = v; b = n; break;
|
||||||
|
case 3: r = wh; g = n; b = v; break;
|
||||||
|
case 4: r = n; g = wh; b = v; break;
|
||||||
|
case 5: r = v; g = wh; b = n; break;
|
||||||
|
}
|
||||||
|
/* eslint-enable max-statements-per-line,no-multi-spaces */
|
||||||
|
|
||||||
|
return [r * 255, g * 255, b * 255];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.cmyk.rgb = function (cmyk) {
|
||||||
|
const c = cmyk[0] / 100;
|
||||||
|
const m = cmyk[1] / 100;
|
||||||
|
const y = cmyk[2] / 100;
|
||||||
|
const k = cmyk[3] / 100;
|
||||||
|
|
||||||
|
const r = 1 - Math.min(1, c * (1 - k) + k);
|
||||||
|
const g = 1 - Math.min(1, m * (1 - k) + k);
|
||||||
|
const b = 1 - Math.min(1, y * (1 - k) + k);
|
||||||
|
|
||||||
|
return [r * 255, g * 255, b * 255];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.xyz.rgb = function (xyz) {
|
||||||
|
const x = xyz[0] / 100;
|
||||||
|
const y = xyz[1] / 100;
|
||||||
|
const z = xyz[2] / 100;
|
||||||
|
let r;
|
||||||
|
let g;
|
||||||
|
let b;
|
||||||
|
|
||||||
|
r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
|
||||||
|
g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
|
||||||
|
b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
|
||||||
|
|
||||||
|
// Assume sRGB
|
||||||
|
r = r > 0.0031308
|
||||||
|
? ((1.055 * (r ** (1.0 / 2.4))) - 0.055)
|
||||||
|
: r * 12.92;
|
||||||
|
|
||||||
|
g = g > 0.0031308
|
||||||
|
? ((1.055 * (g ** (1.0 / 2.4))) - 0.055)
|
||||||
|
: g * 12.92;
|
||||||
|
|
||||||
|
b = b > 0.0031308
|
||||||
|
? ((1.055 * (b ** (1.0 / 2.4))) - 0.055)
|
||||||
|
: b * 12.92;
|
||||||
|
|
||||||
|
r = Math.min(Math.max(0, r), 1);
|
||||||
|
g = Math.min(Math.max(0, g), 1);
|
||||||
|
b = Math.min(Math.max(0, b), 1);
|
||||||
|
|
||||||
|
return [r * 255, g * 255, b * 255];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.xyz.lab = function (xyz) {
|
||||||
|
let x = xyz[0];
|
||||||
|
let y = xyz[1];
|
||||||
|
let z = xyz[2];
|
||||||
|
|
||||||
|
x /= 95.047;
|
||||||
|
y /= 100;
|
||||||
|
z /= 108.883;
|
||||||
|
|
||||||
|
x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
|
||||||
|
y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
|
||||||
|
z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
|
||||||
|
|
||||||
|
const l = (116 * y) - 16;
|
||||||
|
const a = 500 * (x - y);
|
||||||
|
const b = 200 * (y - z);
|
||||||
|
|
||||||
|
return [l, a, b];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.lab.xyz = function (lab) {
|
||||||
|
const l = lab[0];
|
||||||
|
const a = lab[1];
|
||||||
|
const b = lab[2];
|
||||||
|
let x;
|
||||||
|
let y;
|
||||||
|
let z;
|
||||||
|
|
||||||
|
y = (l + 16) / 116;
|
||||||
|
x = a / 500 + y;
|
||||||
|
z = y - b / 200;
|
||||||
|
|
||||||
|
const y2 = y ** 3;
|
||||||
|
const x2 = x ** 3;
|
||||||
|
const z2 = z ** 3;
|
||||||
|
y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
|
||||||
|
x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
|
||||||
|
z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
|
||||||
|
|
||||||
|
x *= 95.047;
|
||||||
|
y *= 100;
|
||||||
|
z *= 108.883;
|
||||||
|
|
||||||
|
return [x, y, z];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.lab.lch = function (lab) {
|
||||||
|
const l = lab[0];
|
||||||
|
const a = lab[1];
|
||||||
|
const b = lab[2];
|
||||||
|
let h;
|
||||||
|
|
||||||
|
const hr = Math.atan2(b, a);
|
||||||
|
h = hr * 360 / 2 / Math.PI;
|
||||||
|
|
||||||
|
if (h < 0) {
|
||||||
|
h += 360;
|
||||||
|
}
|
||||||
|
|
||||||
|
const c = Math.sqrt(a * a + b * b);
|
||||||
|
|
||||||
|
return [l, c, h];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.lch.lab = function (lch) {
|
||||||
|
const l = lch[0];
|
||||||
|
const c = lch[1];
|
||||||
|
const h = lch[2];
|
||||||
|
|
||||||
|
const hr = h / 360 * 2 * Math.PI;
|
||||||
|
const a = c * Math.cos(hr);
|
||||||
|
const b = c * Math.sin(hr);
|
||||||
|
|
||||||
|
return [l, a, b];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.rgb.ansi16 = function (args, saturation = null) {
|
||||||
|
const [r, g, b] = args;
|
||||||
|
let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization
|
||||||
|
|
||||||
|
value = Math.round(value / 50);
|
||||||
|
|
||||||
|
if (value === 0) {
|
||||||
|
return 30;
|
||||||
|
}
|
||||||
|
|
||||||
|
let ansi = 30
|
||||||
|
+ ((Math.round(b / 255) << 2)
|
||||||
|
| (Math.round(g / 255) << 1)
|
||||||
|
| Math.round(r / 255));
|
||||||
|
|
||||||
|
if (value === 2) {
|
||||||
|
ansi += 60;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ansi;
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hsv.ansi16 = function (args) {
|
||||||
|
// Optimization here; we already know the value and don't need to get
|
||||||
|
// it converted for us.
|
||||||
|
return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.rgb.ansi256 = function (args) {
|
||||||
|
const r = args[0];
|
||||||
|
const g = args[1];
|
||||||
|
const b = args[2];
|
||||||
|
|
||||||
|
// We use the extended greyscale palette here, with the exception of
|
||||||
|
// black and white. normal palette only has 4 greyscale shades.
|
||||||
|
if (r === g && g === b) {
|
||||||
|
if (r < 8) {
|
||||||
|
return 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r > 248) {
|
||||||
|
return 231;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Math.round(((r - 8) / 247) * 24) + 232;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ansi = 16
|
||||||
|
+ (36 * Math.round(r / 255 * 5))
|
||||||
|
+ (6 * Math.round(g / 255 * 5))
|
||||||
|
+ Math.round(b / 255 * 5);
|
||||||
|
|
||||||
|
return ansi;
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.ansi16.rgb = function (args) {
|
||||||
|
let color = args % 10;
|
||||||
|
|
||||||
|
// Handle greyscale
|
||||||
|
if (color === 0 || color === 7) {
|
||||||
|
if (args > 50) {
|
||||||
|
color += 3.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
color = color / 10.5 * 255;
|
||||||
|
|
||||||
|
return [color, color, color];
|
||||||
|
}
|
||||||
|
|
||||||
|
const mult = (~~(args > 50) + 1) * 0.5;
|
||||||
|
const r = ((color & 1) * mult) * 255;
|
||||||
|
const g = (((color >> 1) & 1) * mult) * 255;
|
||||||
|
const b = (((color >> 2) & 1) * mult) * 255;
|
||||||
|
|
||||||
|
return [r, g, b];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.ansi256.rgb = function (args) {
|
||||||
|
// Handle greyscale
|
||||||
|
if (args >= 232) {
|
||||||
|
const c = (args - 232) * 10 + 8;
|
||||||
|
return [c, c, c];
|
||||||
|
}
|
||||||
|
|
||||||
|
args -= 16;
|
||||||
|
|
||||||
|
let rem;
|
||||||
|
const r = Math.floor(args / 36) / 5 * 255;
|
||||||
|
const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
|
||||||
|
const b = (rem % 6) / 5 * 255;
|
||||||
|
|
||||||
|
return [r, g, b];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.rgb.hex = function (args) {
|
||||||
|
const integer = ((Math.round(args[0]) & 0xFF) << 16)
|
||||||
|
+ ((Math.round(args[1]) & 0xFF) << 8)
|
||||||
|
+ (Math.round(args[2]) & 0xFF);
|
||||||
|
|
||||||
|
const string = integer.toString(16).toUpperCase();
|
||||||
|
return '000000'.substring(string.length) + string;
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hex.rgb = function (args) {
|
||||||
|
const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
|
||||||
|
if (!match) {
|
||||||
|
return [0, 0, 0];
|
||||||
|
}
|
||||||
|
|
||||||
|
let colorString = match[0];
|
||||||
|
|
||||||
|
if (match[0].length === 3) {
|
||||||
|
colorString = colorString.split('').map(char => {
|
||||||
|
return char + char;
|
||||||
|
}).join('');
|
||||||
|
}
|
||||||
|
|
||||||
|
const integer = parseInt(colorString, 16);
|
||||||
|
const r = (integer >> 16) & 0xFF;
|
||||||
|
const g = (integer >> 8) & 0xFF;
|
||||||
|
const b = integer & 0xFF;
|
||||||
|
|
||||||
|
return [r, g, b];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.rgb.hcg = function (rgb) {
|
||||||
|
const r = rgb[0] / 255;
|
||||||
|
const g = rgb[1] / 255;
|
||||||
|
const b = rgb[2] / 255;
|
||||||
|
const max = Math.max(Math.max(r, g), b);
|
||||||
|
const min = Math.min(Math.min(r, g), b);
|
||||||
|
const chroma = (max - min);
|
||||||
|
let grayscale;
|
||||||
|
let hue;
|
||||||
|
|
||||||
|
if (chroma < 1) {
|
||||||
|
grayscale = min / (1 - chroma);
|
||||||
|
} else {
|
||||||
|
grayscale = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (chroma <= 0) {
|
||||||
|
hue = 0;
|
||||||
|
} else
|
||||||
|
if (max === r) {
|
||||||
|
hue = ((g - b) / chroma) % 6;
|
||||||
|
} else
|
||||||
|
if (max === g) {
|
||||||
|
hue = 2 + (b - r) / chroma;
|
||||||
|
} else {
|
||||||
|
hue = 4 + (r - g) / chroma;
|
||||||
|
}
|
||||||
|
|
||||||
|
hue /= 6;
|
||||||
|
hue %= 1;
|
||||||
|
|
||||||
|
return [hue * 360, chroma * 100, grayscale * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hsl.hcg = function (hsl) {
|
||||||
|
const s = hsl[1] / 100;
|
||||||
|
const l = hsl[2] / 100;
|
||||||
|
|
||||||
|
const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l));
|
||||||
|
|
||||||
|
let f = 0;
|
||||||
|
if (c < 1.0) {
|
||||||
|
f = (l - 0.5 * c) / (1.0 - c);
|
||||||
|
}
|
||||||
|
|
||||||
|
return [hsl[0], c * 100, f * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hsv.hcg = function (hsv) {
|
||||||
|
const s = hsv[1] / 100;
|
||||||
|
const v = hsv[2] / 100;
|
||||||
|
|
||||||
|
const c = s * v;
|
||||||
|
let f = 0;
|
||||||
|
|
||||||
|
if (c < 1.0) {
|
||||||
|
f = (v - c) / (1 - c);
|
||||||
|
}
|
||||||
|
|
||||||
|
return [hsv[0], c * 100, f * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hcg.rgb = function (hcg) {
|
||||||
|
const h = hcg[0] / 360;
|
||||||
|
const c = hcg[1] / 100;
|
||||||
|
const g = hcg[2] / 100;
|
||||||
|
|
||||||
|
if (c === 0.0) {
|
||||||
|
return [g * 255, g * 255, g * 255];
|
||||||
|
}
|
||||||
|
|
||||||
|
const pure = [0, 0, 0];
|
||||||
|
const hi = (h % 1) * 6;
|
||||||
|
const v = hi % 1;
|
||||||
|
const w = 1 - v;
|
||||||
|
let mg = 0;
|
||||||
|
|
||||||
|
/* eslint-disable max-statements-per-line */
|
||||||
|
switch (Math.floor(hi)) {
|
||||||
|
case 0:
|
||||||
|
pure[0] = 1; pure[1] = v; pure[2] = 0; break;
|
||||||
|
case 1:
|
||||||
|
pure[0] = w; pure[1] = 1; pure[2] = 0; break;
|
||||||
|
case 2:
|
||||||
|
pure[0] = 0; pure[1] = 1; pure[2] = v; break;
|
||||||
|
case 3:
|
||||||
|
pure[0] = 0; pure[1] = w; pure[2] = 1; break;
|
||||||
|
case 4:
|
||||||
|
pure[0] = v; pure[1] = 0; pure[2] = 1; break;
|
||||||
|
default:
|
||||||
|
pure[0] = 1; pure[1] = 0; pure[2] = w;
|
||||||
|
}
|
||||||
|
/* eslint-enable max-statements-per-line */
|
||||||
|
|
||||||
|
mg = (1.0 - c) * g;
|
||||||
|
|
||||||
|
return [
|
||||||
|
(c * pure[0] + mg) * 255,
|
||||||
|
(c * pure[1] + mg) * 255,
|
||||||
|
(c * pure[2] + mg) * 255
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hcg.hsv = function (hcg) {
|
||||||
|
const c = hcg[1] / 100;
|
||||||
|
const g = hcg[2] / 100;
|
||||||
|
|
||||||
|
const v = c + g * (1.0 - c);
|
||||||
|
let f = 0;
|
||||||
|
|
||||||
|
if (v > 0.0) {
|
||||||
|
f = c / v;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [hcg[0], f * 100, v * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hcg.hsl = function (hcg) {
|
||||||
|
const c = hcg[1] / 100;
|
||||||
|
const g = hcg[2] / 100;
|
||||||
|
|
||||||
|
const l = g * (1.0 - c) + 0.5 * c;
|
||||||
|
let s = 0;
|
||||||
|
|
||||||
|
if (l > 0.0 && l < 0.5) {
|
||||||
|
s = c / (2 * l);
|
||||||
|
} else
|
||||||
|
if (l >= 0.5 && l < 1.0) {
|
||||||
|
s = c / (2 * (1 - l));
|
||||||
|
}
|
||||||
|
|
||||||
|
return [hcg[0], s * 100, l * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hcg.hwb = function (hcg) {
|
||||||
|
const c = hcg[1] / 100;
|
||||||
|
const g = hcg[2] / 100;
|
||||||
|
const v = c + g * (1.0 - c);
|
||||||
|
return [hcg[0], (v - c) * 100, (1 - v) * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hwb.hcg = function (hwb) {
|
||||||
|
const w = hwb[1] / 100;
|
||||||
|
const b = hwb[2] / 100;
|
||||||
|
const v = 1 - b;
|
||||||
|
const c = v - w;
|
||||||
|
let g = 0;
|
||||||
|
|
||||||
|
if (c < 1) {
|
||||||
|
g = (v - c) / (1 - c);
|
||||||
|
}
|
||||||
|
|
||||||
|
return [hwb[0], c * 100, g * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.apple.rgb = function (apple) {
|
||||||
|
return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.rgb.apple = function (rgb) {
|
||||||
|
return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.gray.rgb = function (args) {
|
||||||
|
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.gray.hsl = function (args) {
|
||||||
|
return [0, 0, args[0]];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.gray.hsv = convert.gray.hsl;
|
||||||
|
|
||||||
|
convert.gray.hwb = function (gray) {
|
||||||
|
return [0, 100, gray[0]];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.gray.cmyk = function (gray) {
|
||||||
|
return [0, 0, 0, gray[0]];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.gray.lab = function (gray) {
|
||||||
|
return [gray[0], 0, 0];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.gray.hex = function (gray) {
|
||||||
|
const val = Math.round(gray[0] / 100 * 255) & 0xFF;
|
||||||
|
const integer = (val << 16) + (val << 8) + val;
|
||||||
|
|
||||||
|
const string = integer.toString(16).toUpperCase();
|
||||||
|
return '000000'.substring(string.length) + string;
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.rgb.gray = function (rgb) {
|
||||||
|
const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
|
||||||
|
return [val / 255 * 100];
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,81 @@
|
||||||
|
const conversions = require('./conversions');
|
||||||
|
const route = require('./route');
|
||||||
|
|
||||||
|
const convert = {};
|
||||||
|
|
||||||
|
const models = Object.keys(conversions);
|
||||||
|
|
||||||
|
function wrapRaw(fn) {
|
||||||
|
const wrappedFn = function (...args) {
|
||||||
|
const arg0 = args[0];
|
||||||
|
if (arg0 === undefined || arg0 === null) {
|
||||||
|
return arg0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arg0.length > 1) {
|
||||||
|
args = arg0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fn(args);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Preserve .conversion property if there is one
|
||||||
|
if ('conversion' in fn) {
|
||||||
|
wrappedFn.conversion = fn.conversion;
|
||||||
|
}
|
||||||
|
|
||||||
|
return wrappedFn;
|
||||||
|
}
|
||||||
|
|
||||||
|
function wrapRounded(fn) {
|
||||||
|
const wrappedFn = function (...args) {
|
||||||
|
const arg0 = args[0];
|
||||||
|
|
||||||
|
if (arg0 === undefined || arg0 === null) {
|
||||||
|
return arg0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arg0.length > 1) {
|
||||||
|
args = arg0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = fn(args);
|
||||||
|
|
||||||
|
// We're assuming the result is an array here.
|
||||||
|
// see notice in conversions.js; don't use box types
|
||||||
|
// in conversion functions.
|
||||||
|
if (typeof result === 'object') {
|
||||||
|
for (let len = result.length, i = 0; i < len; i++) {
|
||||||
|
result[i] = Math.round(result[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Preserve .conversion property if there is one
|
||||||
|
if ('conversion' in fn) {
|
||||||
|
wrappedFn.conversion = fn.conversion;
|
||||||
|
}
|
||||||
|
|
||||||
|
return wrappedFn;
|
||||||
|
}
|
||||||
|
|
||||||
|
models.forEach(fromModel => {
|
||||||
|
convert[fromModel] = {};
|
||||||
|
|
||||||
|
Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
|
||||||
|
Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
|
||||||
|
|
||||||
|
const routes = route(fromModel);
|
||||||
|
const routeModels = Object.keys(routes);
|
||||||
|
|
||||||
|
routeModels.forEach(toModel => {
|
||||||
|
const fn = routes[toModel];
|
||||||
|
|
||||||
|
convert[fromModel][toModel] = wrapRounded(fn);
|
||||||
|
convert[fromModel][toModel].raw = wrapRaw(fn);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = convert;
|
||||||
52
node_modules/@commitlint/format/node_modules/color-convert/package.json
generated
vendored
100644
52
node_modules/@commitlint/format/node_modules/color-convert/package.json
generated
vendored
100644
|
|
@ -0,0 +1,52 @@
|
||||||
|
{
|
||||||
|
"name": "color-convert",
|
||||||
|
"description": "Plain color conversion functions",
|
||||||
|
"version": "2.0.1",
|
||||||
|
"author": "Heather Arthur <fayearthur@gmail.com>",
|
||||||
|
"license": "MIT",
|
||||||
|
"repository": "Qix-/color-convert",
|
||||||
|
"scripts": {
|
||||||
|
"pretest": "xo",
|
||||||
|
"test": "node test/basic.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=7.0.0"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"color",
|
||||||
|
"colour",
|
||||||
|
"convert",
|
||||||
|
"converter",
|
||||||
|
"conversion",
|
||||||
|
"rgb",
|
||||||
|
"hsl",
|
||||||
|
"hsv",
|
||||||
|
"hwb",
|
||||||
|
"cmyk",
|
||||||
|
"ansi",
|
||||||
|
"ansi16"
|
||||||
|
],
|
||||||
|
"files": [
|
||||||
|
"index.js",
|
||||||
|
"conversions.js",
|
||||||
|
"route.js"
|
||||||
|
],
|
||||||
|
"xo": {
|
||||||
|
"rules": {
|
||||||
|
"default-case": 0,
|
||||||
|
"no-inline-comments": 0,
|
||||||
|
"operator-linebreak": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"chalk": "^2.4.2",
|
||||||
|
"xo": "^0.24.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"color-name": "~1.1.4"
|
||||||
|
}
|
||||||
|
|
||||||
|
,"_resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz"
|
||||||
|
,"_integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="
|
||||||
|
,"_from": "color-convert@2.0.1"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,97 @@
|
||||||
|
const conversions = require('./conversions');
|
||||||
|
|
||||||
|
/*
|
||||||
|
This function routes a model to all other models.
|
||||||
|
|
||||||
|
all functions that are routed have a property `.conversion` attached
|
||||||
|
to the returned synthetic function. This property is an array
|
||||||
|
of strings, each with the steps in between the 'from' and 'to'
|
||||||
|
color models (inclusive).
|
||||||
|
|
||||||
|
conversions that are not possible simply are not included.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function buildGraph() {
|
||||||
|
const graph = {};
|
||||||
|
// https://jsperf.com/object-keys-vs-for-in-with-closure/3
|
||||||
|
const models = Object.keys(conversions);
|
||||||
|
|
||||||
|
for (let len = models.length, i = 0; i < len; i++) {
|
||||||
|
graph[models[i]] = {
|
||||||
|
// http://jsperf.com/1-vs-infinity
|
||||||
|
// micro-opt, but this is simple.
|
||||||
|
distance: -1,
|
||||||
|
parent: null
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return graph;
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://en.wikipedia.org/wiki/Breadth-first_search
|
||||||
|
function deriveBFS(fromModel) {
|
||||||
|
const graph = buildGraph();
|
||||||
|
const queue = [fromModel]; // Unshift -> queue -> pop
|
||||||
|
|
||||||
|
graph[fromModel].distance = 0;
|
||||||
|
|
||||||
|
while (queue.length) {
|
||||||
|
const current = queue.pop();
|
||||||
|
const adjacents = Object.keys(conversions[current]);
|
||||||
|
|
||||||
|
for (let len = adjacents.length, i = 0; i < len; i++) {
|
||||||
|
const adjacent = adjacents[i];
|
||||||
|
const node = graph[adjacent];
|
||||||
|
|
||||||
|
if (node.distance === -1) {
|
||||||
|
node.distance = graph[current].distance + 1;
|
||||||
|
node.parent = current;
|
||||||
|
queue.unshift(adjacent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return graph;
|
||||||
|
}
|
||||||
|
|
||||||
|
function link(from, to) {
|
||||||
|
return function (args) {
|
||||||
|
return to(from(args));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function wrapConversion(toModel, graph) {
|
||||||
|
const path = [graph[toModel].parent, toModel];
|
||||||
|
let fn = conversions[graph[toModel].parent][toModel];
|
||||||
|
|
||||||
|
let cur = graph[toModel].parent;
|
||||||
|
while (graph[cur].parent) {
|
||||||
|
path.unshift(graph[cur].parent);
|
||||||
|
fn = link(conversions[graph[cur].parent][cur], fn);
|
||||||
|
cur = graph[cur].parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn.conversion = path;
|
||||||
|
return fn;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = function (fromModel) {
|
||||||
|
const graph = deriveBFS(fromModel);
|
||||||
|
const conversion = {};
|
||||||
|
|
||||||
|
const models = Object.keys(graph);
|
||||||
|
for (let len = models.length, i = 0; i < len; i++) {
|
||||||
|
const toModel = models[i];
|
||||||
|
const node = graph[toModel];
|
||||||
|
|
||||||
|
if (node.parent === null) {
|
||||||
|
// No possible conversion, or this node is the source model.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
conversion[toModel] = wrapConversion(toModel, graph);
|
||||||
|
}
|
||||||
|
|
||||||
|
return conversion;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
Copyright (c) 2015 Dmitry Ivanov
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
A JSON with color names and its values. Based on http://dev.w3.org/csswg/css-color/#named-colors.
|
||||||
|
|
||||||
|
[](https://nodei.co/npm/color-name/)
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
var colors = require('color-name');
|
||||||
|
colors.red //[255,0,0]
|
||||||
|
```
|
||||||
|
|
||||||
|
<a href="LICENSE"><img src="https://upload.wikimedia.org/wikipedia/commons/0/0c/MIT_logo.svg" width="120"/></a>
|
||||||
|
|
@ -0,0 +1,152 @@
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
"aliceblue": [240, 248, 255],
|
||||||
|
"antiquewhite": [250, 235, 215],
|
||||||
|
"aqua": [0, 255, 255],
|
||||||
|
"aquamarine": [127, 255, 212],
|
||||||
|
"azure": [240, 255, 255],
|
||||||
|
"beige": [245, 245, 220],
|
||||||
|
"bisque": [255, 228, 196],
|
||||||
|
"black": [0, 0, 0],
|
||||||
|
"blanchedalmond": [255, 235, 205],
|
||||||
|
"blue": [0, 0, 255],
|
||||||
|
"blueviolet": [138, 43, 226],
|
||||||
|
"brown": [165, 42, 42],
|
||||||
|
"burlywood": [222, 184, 135],
|
||||||
|
"cadetblue": [95, 158, 160],
|
||||||
|
"chartreuse": [127, 255, 0],
|
||||||
|
"chocolate": [210, 105, 30],
|
||||||
|
"coral": [255, 127, 80],
|
||||||
|
"cornflowerblue": [100, 149, 237],
|
||||||
|
"cornsilk": [255, 248, 220],
|
||||||
|
"crimson": [220, 20, 60],
|
||||||
|
"cyan": [0, 255, 255],
|
||||||
|
"darkblue": [0, 0, 139],
|
||||||
|
"darkcyan": [0, 139, 139],
|
||||||
|
"darkgoldenrod": [184, 134, 11],
|
||||||
|
"darkgray": [169, 169, 169],
|
||||||
|
"darkgreen": [0, 100, 0],
|
||||||
|
"darkgrey": [169, 169, 169],
|
||||||
|
"darkkhaki": [189, 183, 107],
|
||||||
|
"darkmagenta": [139, 0, 139],
|
||||||
|
"darkolivegreen": [85, 107, 47],
|
||||||
|
"darkorange": [255, 140, 0],
|
||||||
|
"darkorchid": [153, 50, 204],
|
||||||
|
"darkred": [139, 0, 0],
|
||||||
|
"darksalmon": [233, 150, 122],
|
||||||
|
"darkseagreen": [143, 188, 143],
|
||||||
|
"darkslateblue": [72, 61, 139],
|
||||||
|
"darkslategray": [47, 79, 79],
|
||||||
|
"darkslategrey": [47, 79, 79],
|
||||||
|
"darkturquoise": [0, 206, 209],
|
||||||
|
"darkviolet": [148, 0, 211],
|
||||||
|
"deeppink": [255, 20, 147],
|
||||||
|
"deepskyblue": [0, 191, 255],
|
||||||
|
"dimgray": [105, 105, 105],
|
||||||
|
"dimgrey": [105, 105, 105],
|
||||||
|
"dodgerblue": [30, 144, 255],
|
||||||
|
"firebrick": [178, 34, 34],
|
||||||
|
"floralwhite": [255, 250, 240],
|
||||||
|
"forestgreen": [34, 139, 34],
|
||||||
|
"fuchsia": [255, 0, 255],
|
||||||
|
"gainsboro": [220, 220, 220],
|
||||||
|
"ghostwhite": [248, 248, 255],
|
||||||
|
"gold": [255, 215, 0],
|
||||||
|
"goldenrod": [218, 165, 32],
|
||||||
|
"gray": [128, 128, 128],
|
||||||
|
"green": [0, 128, 0],
|
||||||
|
"greenyellow": [173, 255, 47],
|
||||||
|
"grey": [128, 128, 128],
|
||||||
|
"honeydew": [240, 255, 240],
|
||||||
|
"hotpink": [255, 105, 180],
|
||||||
|
"indianred": [205, 92, 92],
|
||||||
|
"indigo": [75, 0, 130],
|
||||||
|
"ivory": [255, 255, 240],
|
||||||
|
"khaki": [240, 230, 140],
|
||||||
|
"lavender": [230, 230, 250],
|
||||||
|
"lavenderblush": [255, 240, 245],
|
||||||
|
"lawngreen": [124, 252, 0],
|
||||||
|
"lemonchiffon": [255, 250, 205],
|
||||||
|
"lightblue": [173, 216, 230],
|
||||||
|
"lightcoral": [240, 128, 128],
|
||||||
|
"lightcyan": [224, 255, 255],
|
||||||
|
"lightgoldenrodyellow": [250, 250, 210],
|
||||||
|
"lightgray": [211, 211, 211],
|
||||||
|
"lightgreen": [144, 238, 144],
|
||||||
|
"lightgrey": [211, 211, 211],
|
||||||
|
"lightpink": [255, 182, 193],
|
||||||
|
"lightsalmon": [255, 160, 122],
|
||||||
|
"lightseagreen": [32, 178, 170],
|
||||||
|
"lightskyblue": [135, 206, 250],
|
||||||
|
"lightslategray": [119, 136, 153],
|
||||||
|
"lightslategrey": [119, 136, 153],
|
||||||
|
"lightsteelblue": [176, 196, 222],
|
||||||
|
"lightyellow": [255, 255, 224],
|
||||||
|
"lime": [0, 255, 0],
|
||||||
|
"limegreen": [50, 205, 50],
|
||||||
|
"linen": [250, 240, 230],
|
||||||
|
"magenta": [255, 0, 255],
|
||||||
|
"maroon": [128, 0, 0],
|
||||||
|
"mediumaquamarine": [102, 205, 170],
|
||||||
|
"mediumblue": [0, 0, 205],
|
||||||
|
"mediumorchid": [186, 85, 211],
|
||||||
|
"mediumpurple": [147, 112, 219],
|
||||||
|
"mediumseagreen": [60, 179, 113],
|
||||||
|
"mediumslateblue": [123, 104, 238],
|
||||||
|
"mediumspringgreen": [0, 250, 154],
|
||||||
|
"mediumturquoise": [72, 209, 204],
|
||||||
|
"mediumvioletred": [199, 21, 133],
|
||||||
|
"midnightblue": [25, 25, 112],
|
||||||
|
"mintcream": [245, 255, 250],
|
||||||
|
"mistyrose": [255, 228, 225],
|
||||||
|
"moccasin": [255, 228, 181],
|
||||||
|
"navajowhite": [255, 222, 173],
|
||||||
|
"navy": [0, 0, 128],
|
||||||
|
"oldlace": [253, 245, 230],
|
||||||
|
"olive": [128, 128, 0],
|
||||||
|
"olivedrab": [107, 142, 35],
|
||||||
|
"orange": [255, 165, 0],
|
||||||
|
"orangered": [255, 69, 0],
|
||||||
|
"orchid": [218, 112, 214],
|
||||||
|
"palegoldenrod": [238, 232, 170],
|
||||||
|
"palegreen": [152, 251, 152],
|
||||||
|
"paleturquoise": [175, 238, 238],
|
||||||
|
"palevioletred": [219, 112, 147],
|
||||||
|
"papayawhip": [255, 239, 213],
|
||||||
|
"peachpuff": [255, 218, 185],
|
||||||
|
"peru": [205, 133, 63],
|
||||||
|
"pink": [255, 192, 203],
|
||||||
|
"plum": [221, 160, 221],
|
||||||
|
"powderblue": [176, 224, 230],
|
||||||
|
"purple": [128, 0, 128],
|
||||||
|
"rebeccapurple": [102, 51, 153],
|
||||||
|
"red": [255, 0, 0],
|
||||||
|
"rosybrown": [188, 143, 143],
|
||||||
|
"royalblue": [65, 105, 225],
|
||||||
|
"saddlebrown": [139, 69, 19],
|
||||||
|
"salmon": [250, 128, 114],
|
||||||
|
"sandybrown": [244, 164, 96],
|
||||||
|
"seagreen": [46, 139, 87],
|
||||||
|
"seashell": [255, 245, 238],
|
||||||
|
"sienna": [160, 82, 45],
|
||||||
|
"silver": [192, 192, 192],
|
||||||
|
"skyblue": [135, 206, 235],
|
||||||
|
"slateblue": [106, 90, 205],
|
||||||
|
"slategray": [112, 128, 144],
|
||||||
|
"slategrey": [112, 128, 144],
|
||||||
|
"snow": [255, 250, 250],
|
||||||
|
"springgreen": [0, 255, 127],
|
||||||
|
"steelblue": [70, 130, 180],
|
||||||
|
"tan": [210, 180, 140],
|
||||||
|
"teal": [0, 128, 128],
|
||||||
|
"thistle": [216, 191, 216],
|
||||||
|
"tomato": [255, 99, 71],
|
||||||
|
"turquoise": [64, 224, 208],
|
||||||
|
"violet": [238, 130, 238],
|
||||||
|
"wheat": [245, 222, 179],
|
||||||
|
"white": [255, 255, 255],
|
||||||
|
"whitesmoke": [245, 245, 245],
|
||||||
|
"yellow": [255, 255, 0],
|
||||||
|
"yellowgreen": [154, 205, 50]
|
||||||
|
};
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue