You've already forked dynamic-badges-action
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:
22
node_modules/anafanafo/index.js
generated
vendored
Normal file
22
node_modules/anafanafo/index.js
generated
vendored
Normal 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 })
|
||||
}
|
||||
Reference in New Issue
Block a user