Add save svg-badge directly to gist

This adds the posibility of saving an SVG badge generated by the same
shields.io dirictly to the gist. Instead of prepering a JSON file to
be sent to their service, we use their library directly, which outputs
an SVG file that we can save to the user’s gist.

Filenames ending in `.svg` will use this library automatically.

Additionally there is a major refactoring where the older `node:http`
library has been swapped out for `fetch`.

Also swap from node 16 to node 20

fixes #24
This commit is contained in:
Rúnar Berg
2023-09-26 17:37:34 -07:00
parent b7809ee0af
commit a2d3829b14
63 changed files with 4632 additions and 137 deletions

43
node_modules/anafanafo/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,43 @@
# Changelog
## 2.0.0 Oct 15, 2020
Same as 2.0.0-beta.1.
### BREAKING CHANGES
- Support the font variants used by Shields:
- 10px Verdana
- bold 10px Verdana
- 11px Verdana
- bold 11px Helvetica
## 2.0.0-beta.1 Oct 11, 2020
### BREAKING CHANGES
- Support the font variants used by Shields:
- 10px Verdana
- bold 10px Verdana
- 11px Verdana
- bold 11px Helvetica
## 2.0.0-beta.0 Oct 11, 2020
### BREAKING CHANGES
- Support 10px and 11px Verdana, in normal and bold.
## 1.0.0 Apr 12, 2018
- Update dependencies.
- Stable API.
## 0.1.1 Nov 15, 2018
- Require the JSON file (instead of `loadSync`-ing it) to play well with
module bundlers.
## 0.1.0 Nov 13, 2018
Initial release.

21
node_modules/anafanafo/LICENSE generated vendored Normal file
View File

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

40
node_modules/anafanafo/README.md generated vendored Normal file
View File

@@ -0,0 +1,40 @@
# anafanafo
[![version](https://img.shields.io/npm/v/anafanafo?style=flat-square)][npm]
[![license](https://img.shields.io/npm/l/anafanafo?style=flat-square)][npm]
[![build](https://img.shields.io/circleci/project/github/metabolize/anafanafo/main?style=flat-square)][build]
[![bundle size](https://img.shields.io/bundlephobia/minzip/anafanafo?style=flat-square)][bundlephobia]
[![code style](https://img.shields.io/badge/code_style-prettier-ff69b4?style=flat-square)][prettier]
[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff?style=flat-square)][lerna]
[npm]: https://npmjs.com/anafanafo
[build]: https://circleci.com/gh/metabolize/anafanafo/tree/main
[bundlephobia]: https://bundlephobia.com/result?p=anafanafo
[prettier]: https://prettier.io/
[lerna]: https://lernajs.io/
Efficiently compute text width in Verdana and Helvetica using
[char-width-table-consumer][] and lookup tables.
Built with [Shields][] in mind.
(And because Verdana always makes me think of [this][the name game].)
[char-width-table-consumer]: https://www.npmjs.com/package/char-width-table-consumer
[shields]: https://github.com/badges/shields/
[the name game]: https://www.youtube.com/watch?v=5MJLi5_dyn0
## Usage
```js
const anafanafo = require('anafanafo')
// Supports '11px Verdana', '10px Verdana', 'bold 10px Verdana', and 'bold 11px Helvetica'.
const width = anafanafo('Shirley Shirley', { font: '11px Verdana' })
```
## License
All rights to Verdana are owned by Microsoft Corp.
The remainder of this project is licensed under the MIT license.

1
node_modules/anafanafo/data/helvetica-11px-bold.json generated vendored Normal file

File diff suppressed because one or more lines are too long

1
node_modules/anafanafo/data/verdana-10px-bold.json generated vendored Normal file

File diff suppressed because one or more lines are too long

1
node_modules/anafanafo/data/verdana-10px-normal.json generated vendored Normal file

File diff suppressed because one or more lines are too long

1
node_modules/anafanafo/data/verdana-11px-normal.json generated vendored Normal file

File diff suppressed because one or more lines are too long

22
node_modules/anafanafo/index.js generated vendored Normal file
View File

@@ -0,0 +1,22 @@
'use strict'
const { createConsumer } = require('char-width-table-consumer')
const consumers = {
'10px Verdana': createConsumer(require('./data/verdana-10px-normal.json')),
'bold 10px Verdana': createConsumer(require('./data/verdana-10px-bold.json')),
'11px Verdana': createConsumer(require('./data/verdana-11px-normal.json')),
'bold 11px Helvetica': createConsumer(
require('./data/helvetica-11px-bold.json')
),
}
module.exports = function measure(text, { font, ...rest }) {
const consumer = consumers[font]
if (!consumer) {
throw Error(
`Unknown font "${font}", expected ${Object.keys(consumers).join(', ')}`
)
}
return consumer.widthOf(text, { ...rest })
}

18
node_modules/anafanafo/package.json generated vendored Normal file
View File

@@ -0,0 +1,18 @@
{
"name": "anafanafo",
"version": "2.0.0",
"repository": "metabolize/anafanafo",
"description": "Compute text width in Verdana",
"scripts": {
"test": "../../node_modules/.bin/mocha test.js"
},
"author": "Metabolize",
"license": "MIT",
"dependencies": {
"char-width-table-consumer": "^1.0.0"
},
"files": [
"index.js",
"data/*.json"
]
}