- Docs: Use SVG-based coverage badge on README in place of PNG
parent
5b91e6879e
commit
a6f65cec0b
|
@ -7,7 +7,7 @@
|
|||
<!-- [![Actions Status](https://github.com/SVG-Edit/svgedit/workflows/Node%20CI/badge.svg)](https://github.com/SVG-Edit/svgedit/actions)
|
||||
[![Actions Status](https://github.com/SVG-Edit/svgedit/workflows/Coverage/badge.svg)](https://github.com/SVG-Edit/svgedit/actions)
|
||||
-->
|
||||
[![coverage badge](coverage-badge.png)](coverage-badge.png)
|
||||
[![coverage badge](coverage-badge.svg)](coverage-badge.svg)
|
||||
|
||||
[![Known Vulnerabilities](https://snyk.io/test/github/SVG-Edit/svgedit/badge.svg)](https://snyk.io/test/github/SVG-Edit/svgedit)
|
||||
[![Total Alerts](https://img.shields.io/lgtm/alerts/g/SVG-Edit/svgedit.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/SVG-Edit/svgedit/alerts)
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="116" height="20">
|
||||
<linearGradient id="smooth" x2="0" y2="100%">
|
||||
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
|
||||
<stop offset="1" stop-opacity=".1"/>
|
||||
</linearGradient>
|
||||
|
||||
<clipPath id="round">
|
||||
<rect width="116" height="20" rx="3" fill="#fff"/>
|
||||
</clipPath>
|
||||
|
||||
<g clip-path="url(#round)">
|
||||
<rect width="63" height="20" fill="#555"/>
|
||||
<rect x="63" width="53" height="20" fill="#fe7d37"/>
|
||||
<rect width="116" height="20" fill="url(#smooth)"/>
|
||||
</g>
|
||||
|
||||
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110">
|
||||
|
||||
|
||||
<text x="325" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="530" lengthAdjust="spacing">Coverage</text>
|
||||
<text x="325" y="140" transform="scale(0.1)" textLength="530" lengthAdjust="spacing">Coverage</text>
|
||||
|
||||
<text x="885" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="430" lengthAdjust="spacing">40.89%</text>
|
||||
<text x="885" y="140" transform="scale(0.1)" textLength="430" lengthAdjust="spacing">40.89%</text>
|
||||
</g>
|
||||
|
||||
|
||||
|
||||
</svg>
|
After Width: | Height: | Size: 1.2 KiB |
|
@ -1,17 +1,19 @@
|
|||
'use strict';
|
||||
|
||||
const {writeFile: writeFileOriginal, unlink: unlinkOriginal /* openSync */} = require('fs');
|
||||
const {join} = require('path');
|
||||
const {
|
||||
writeFile: writeFileOriginal /* unlink: unlinkOriginal, openSync */
|
||||
} = require('fs');
|
||||
// const {join} = require('path');
|
||||
// const {spawn} = require('child_process');
|
||||
const {promisify} = require('util');
|
||||
|
||||
const {convertFile} = require('convert-svg-to-png');
|
||||
// const {convertFile} = require('convert-svg-to-png');
|
||||
const {BadgeFactory} = require('gh-badges');
|
||||
|
||||
const coverageSummary = require('../../coverage/coverage-summary.json');
|
||||
|
||||
const writeFile = promisify(writeFileOriginal);
|
||||
const unlink = promisify(unlinkOriginal);
|
||||
// const unlink = promisify(unlinkOriginal);
|
||||
const {pct} = coverageSummary.total.statements;
|
||||
|
||||
/*
|
||||
|
@ -31,7 +33,7 @@ const bf = new BadgeFactory();
|
|||
const format = {
|
||||
text: ['Coverage', `${pct}%`],
|
||||
color: 'orange',
|
||||
format: 'png', // svg|json|png|jpg|gif
|
||||
format: 'svg', // svg|json|png|jpg|gif
|
||||
// labelColor: 'black',
|
||||
template: 'flat' // 'flat'|'flat-square'|'for-the-badge'|'plastic'|'social'
|
||||
};
|
||||
|
@ -42,10 +44,11 @@ const svgFilePath = 'coverage-badge.svg';
|
|||
await writeFile(svgFilePath, badge);
|
||||
console.log('Finished writing temporary SVG file...');
|
||||
|
||||
const outputFile = await convertFile(join(process.cwd(), svgFilePath));
|
||||
console.log('Wrote file', outputFile);
|
||||
// Works too
|
||||
// const outputFile = await convertFile(join(process.cwd(), svgFilePath));
|
||||
// console.log('Wrote file', outputFile);
|
||||
|
||||
await unlink(svgFilePath);
|
||||
console.log('Cleaned up temporary SVG file');
|
||||
// await unlink(svgFilePath);
|
||||
// console.log('Cleaned up temporary SVG file');
|
||||
console.log('Done!');
|
||||
})();
|
||||
|
|
|
@ -2080,15 +2080,6 @@
|
|||
"strip-filename-increment": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"agent-base": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz",
|
||||
"integrity": "sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"es6-promisify": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"ajv": {
|
||||
"version": "6.10.2",
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz",
|
||||
|
@ -4166,41 +4157,6 @@
|
|||
"safe-buffer": "~5.1.1"
|
||||
}
|
||||
},
|
||||
"convert-svg-core": {
|
||||
"version": "0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/convert-svg-core/-/convert-svg-core-0.5.0.tgz",
|
||||
"integrity": "sha512-V30vm5h4sHjmjyAr7o/gYAEmdEIsi0sLKKbDigSxplovCzMHTERXSikIOgA8xSllHh0c4gHYP55Pxwgtu9O+3w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"chalk": "^2.4.1",
|
||||
"commander": "^2.19.0",
|
||||
"file-url": "^2.0.2",
|
||||
"get-stdin": "^6.0.0",
|
||||
"glob": "^7.1.3",
|
||||
"lodash.omit": "^4.5.0",
|
||||
"lodash.pick": "^4.4.0",
|
||||
"pollock": "^0.2.0",
|
||||
"puppeteer": "^1.10.0",
|
||||
"tmp": "0.0.33"
|
||||
},
|
||||
"dependencies": {
|
||||
"get-stdin": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-6.0.0.tgz",
|
||||
"integrity": "sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"convert-svg-to-png": {
|
||||
"version": "0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/convert-svg-to-png/-/convert-svg-to-png-0.5.0.tgz",
|
||||
"integrity": "sha512-Pzg2IEirPdN/VXovG9NY8H5Ww3PUEohMcyu9a11E0G0/oVcbPLWQYE3/S6mxpjidqzYr1i5iKLTKCiU9hctKFQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"convert-svg-core": "^0.5.0"
|
||||
}
|
||||
},
|
||||
"copy-descriptor": {
|
||||
"version": "0.1.1",
|
||||
"resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz",
|
||||
|
@ -5001,21 +4957,6 @@
|
|||
"integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==",
|
||||
"dev": true
|
||||
},
|
||||
"es6-promise": {
|
||||
"version": "4.2.8",
|
||||
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz",
|
||||
"integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==",
|
||||
"dev": true
|
||||
},
|
||||
"es6-promisify": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz",
|
||||
"integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"es6-promise": "^4.0.3"
|
||||
}
|
||||
},
|
||||
"escape-string-regexp": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
|
||||
|
@ -6166,12 +6107,6 @@
|
|||
"integrity": "sha512-rM0UO7Qm9K7TWTtA6AShI/t7H5BPjDeGVDaNyg9BjHAj3PysKy7+8C8D137R88jnR3rFJZQB/tFgydl5sN5m7g==",
|
||||
"dev": true
|
||||
},
|
||||
"file-url": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/file-url/-/file-url-2.0.2.tgz",
|
||||
"integrity": "sha1-6VF4TXkJUSfTcTApqwY/QIGMoq4=",
|
||||
"dev": true
|
||||
},
|
||||
"fill-range": {
|
||||
"version": "7.0.1",
|
||||
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
|
||||
|
@ -6812,27 +6747,6 @@
|
|||
"integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=",
|
||||
"dev": true
|
||||
},
|
||||
"https-proxy-agent": {
|
||||
"version": "2.2.4",
|
||||
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz",
|
||||
"integrity": "sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"agent-base": "^4.3.0",
|
||||
"debug": "^3.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
"version": "3.2.6",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
|
||||
"integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ms": "^2.1.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"human-signals": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz",
|
||||
|
@ -8161,24 +8075,12 @@
|
|||
"integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=",
|
||||
"dev": true
|
||||
},
|
||||
"lodash.omit": {
|
||||
"version": "4.5.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.omit/-/lodash.omit-4.5.0.tgz",
|
||||
"integrity": "sha1-brGa5aHuHdnfC5aeZs4Lf6MLXmA=",
|
||||
"dev": true
|
||||
},
|
||||
"lodash.once": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz",
|
||||
"integrity": "sha1-DdOXEhPHxW34gJd9UEyI+0cal6w=",
|
||||
"dev": true
|
||||
},
|
||||
"lodash.pick": {
|
||||
"version": "4.4.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.pick/-/lodash.pick-4.4.0.tgz",
|
||||
"integrity": "sha1-UvBWEP/53tQiYRRB7R/BI6AwAbM=",
|
||||
"dev": true
|
||||
},
|
||||
"lodash.snakecase": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz",
|
||||
|
@ -9587,12 +9489,6 @@
|
|||
"integrity": "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==",
|
||||
"dev": true
|
||||
},
|
||||
"pollock": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/pollock/-/pollock-0.2.1.tgz",
|
||||
"integrity": "sha512-2Xy6LImSXm0ANKv9BKSVuCa6Z4ACbK7oUrl9gtUgqLkekL7n9C0mlWsOGYYuGbCG8xT0x3Q4F31C3ZMyVQjwsg==",
|
||||
"dev": true
|
||||
},
|
||||
"posix-character-classes": {
|
||||
"version": "0.1.1",
|
||||
"resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz",
|
||||
|
@ -9665,12 +9561,6 @@
|
|||
"integrity": "sha512-2yma2tog9VaRZY2mn3Wq51uiSW4NcPYT1cQdBagwyrznrilKSZwIZ0UG3ZPL/mx+axEns0hE35T5ufOYZXEnBQ==",
|
||||
"dev": true
|
||||
},
|
||||
"proxy-from-env": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.0.0.tgz",
|
||||
"integrity": "sha1-M8UDmPcOp+uW0h97gXYwpVeRx+4=",
|
||||
"dev": true
|
||||
},
|
||||
"pseudomap": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz",
|
||||
|
@ -9713,39 +9603,6 @@
|
|||
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
|
||||
"dev": true
|
||||
},
|
||||
"puppeteer": {
|
||||
"version": "1.20.0",
|
||||
"resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-1.20.0.tgz",
|
||||
"integrity": "sha512-bt48RDBy2eIwZPrkgbcwHtb51mj2nKvHOPMaSH2IsWiv7lOG9k9zhaRzpDZafrk05ajMc3cu+lSQYYOfH2DkVQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"debug": "^4.1.0",
|
||||
"extract-zip": "^1.6.6",
|
||||
"https-proxy-agent": "^2.2.1",
|
||||
"mime": "^2.0.3",
|
||||
"progress": "^2.0.1",
|
||||
"proxy-from-env": "^1.0.0",
|
||||
"rimraf": "^2.6.1",
|
||||
"ws": "^6.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"mime": {
|
||||
"version": "2.4.4",
|
||||
"resolved": "https://registry.npmjs.org/mime/-/mime-2.4.4.tgz",
|
||||
"integrity": "sha512-LRxmNwziLPT828z+4YkNzloCFC2YM4wrB99k+AV5ZbEyfGNWfG8SO1FUXLmLDBSo89NrJZ4DIWeLjy1CHGhMGA==",
|
||||
"dev": true
|
||||
},
|
||||
"ws": {
|
||||
"version": "6.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz",
|
||||
"integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"async-limiter": "~1.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"q": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz",
|
||||
|
|
|
@ -120,7 +120,6 @@
|
|||
"axe-core": "^3.4.0",
|
||||
"babel-plugin-transform-object-rest-spread": "^7.0.0-beta.3",
|
||||
"coffeescript": "^2.4.1",
|
||||
"convert-svg-to-png": "^0.5.0",
|
||||
"copyfiles": "^2.1.1",
|
||||
"core-js-bundle": "^3.5.0",
|
||||
"cypress": "^3.8.0",
|
||||
|
|
Loading…
Reference in New Issue