Move NPM package files out of /lib ; affects [resharper nuget myget dub chocolatey github] (#2300)

* move gh-badges files out of /lib

As far as possible, this is just moving files
around and updating paths however there are 2
functional changes in this commit:
- remove use of lib/register-chai-plugins.spec
  in badge-cli.spec.js
- remove use of starRating()
  in text-measurer.spec.js

* update service tests that use colorscheme.json

* split package.json in two

* clean up import

* don't hard-code path

* start a changelog

* put a license file in the package dir

* re-organise documentation 📚

* don't pack test files

* remove favicon from Makefile

* give package its own test command

* link the docs better in README
This commit is contained in:
chris48s
2018-11-15 18:48:01 +00:00
committed by GitHub
parent aed39bfde9
commit b68ac16092
51 changed files with 382 additions and 131 deletions

View File

@@ -1,78 +0,0 @@
Format
------
The format is the following:
```js
{
text: [ 'build', 'passed' ], // Textual information shown, in order
format: 'svg', // Also supports json
colorscheme: 'green',
// or ...
colorA: '#555',
colorB: '#4c1',
// See templates/ for a list of available templates.
// Each offers a different visual design.
template: 'flat',
}
```
### See also
- [colorscheme.json](../lib/colorscheme.json) for the `colorscheme` option
- [templates/](../templates) for the `template` option
Defaults
--------
If you want to add a colorscheme, head to `lib/colorscheme.json`. Each scheme
has a name and a [CSS/SVG color][] for the color used in the first box (for the
first piece of text, field `colorA`) and for the one used in the second box
(field `colorB`).
[CSS/SVG color]: http://www.w3.org/TR/SVG/types.html#DataTypeColor
```js
"green": {
"colorB": "#4c1"
}
```
Both `colorA` and `colorB` have default values. Usually, the first box uses the
same dark grey, so you can rely on that default value by not providing a
`"colorA"` field (such as above).
You can also use the `"colorA"` and `"colorB"` fields directly in the badges if
you don't want to make a color scheme for it. In that case, remove the
`"colorscheme"` field altogether.
Text Width Computation
----------------------
`BadgeFactory`'s constructor takes an optional boolean
`precomputeWidths` parameter which defaults to `false`.
Pre-computing the font width table adds some overhead to constructing the
`BadgeFactory` object (so will slow down generation of a single image),
but will speed up each badge generation if you are creating a lot of images.
As a rule of thumb:
If you are generating just one image, use:
```js
const bf = new BadgeFactory(
{ fontPath: '/path/to/Verdana.ttf' }
)
```
If you are generating many images with a single instance of `BadgeFactory`:
```js
const bf = new BadgeFactory(
{ fontPath: '/path/to/Verdana.ttf', precomputeWidths: true }
)
```