- Refactoring: Move out coverage badge generation to own repo
- npm: Update devDep
This commit is contained in:
@@ -1,54 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
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 {BadgeFactory} = require('gh-badges');
|
||||
|
||||
const coverageSummary = require('../../coverage/coverage-summary.json');
|
||||
|
||||
const writeFile = promisify(writeFileOriginal);
|
||||
// const unlink = promisify(unlinkOriginal);
|
||||
const {pct} = coverageSummary.total.statements;
|
||||
|
||||
/*
|
||||
const format = 'png';
|
||||
const out = openSync('coverage-badge.' + format, 'a');
|
||||
spawn('./node_modules/.bin/badge', [
|
||||
`Coverage ${pct}%`,
|
||||
':orange',
|
||||
'.' + format
|
||||
], {
|
||||
stdio: [process.stdin, out, process.stderr]
|
||||
});
|
||||
*/
|
||||
|
||||
// Only CLI handles image conversion
|
||||
const bf = new BadgeFactory();
|
||||
const format = {
|
||||
text: ['Coverage', `${pct}%`],
|
||||
color: 'orange',
|
||||
format: 'svg', // svg|json|png|jpg|gif
|
||||
// labelColor: 'black',
|
||||
template: 'flat' // 'flat'|'flat-square'|'for-the-badge'|'plastic'|'social'
|
||||
};
|
||||
const badge = bf.create(format);
|
||||
|
||||
(async () => {
|
||||
const svgFilePath = 'coverage-badge.svg';
|
||||
await writeFile(svgFilePath, badge);
|
||||
console.log('Finished writing temporary SVG file...');
|
||||
|
||||
// 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');
|
||||
console.log('Done!');
|
||||
})();
|
||||
917
package-lock.json
generated
917
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -36,7 +36,7 @@
|
||||
"instrument:copy-excluded": "node cypress/support/copy.js",
|
||||
"copy-instrumented": "copyfiles -e \"**/*.js\" -u 1 \"editor/**/*\" instrumented && npm run instrument:replace-html && npm run instrument:replace-js && npm run instrument:copy-excluded",
|
||||
"instrument": "rm -Rf instrumented && npx nyc instrument editor instrumented && npm run copy-instrumented && npm run coverage-badge",
|
||||
"coverage-badge": "node cypress/support/build-coverage-badge.js",
|
||||
"coverage-badge": "coveradge",
|
||||
"open-cov": "npm-run-all instrument --parallel --race start cypress:open",
|
||||
"open": "run-p start cypress:open",
|
||||
"report": "npx nyc report",
|
||||
@@ -122,10 +122,11 @@
|
||||
"coffeescript": "^2.4.1",
|
||||
"copyfiles": "^2.1.1",
|
||||
"core-js-bundle": "^3.6.0",
|
||||
"coveradge": "^0.1.0",
|
||||
"cypress": "^3.8.0",
|
||||
"cypress-axe": "^0.5.3",
|
||||
"eslint": "^6.7.2",
|
||||
"eslint-config-ash-nazg": "^14.0.1",
|
||||
"eslint-config-ash-nazg": "^14.0.3",
|
||||
"eslint-config-standard": "^14.1.0",
|
||||
"eslint-plugin-array-func": "^3.1.3",
|
||||
"eslint-plugin-compat": "^3.3.0",
|
||||
|
||||
Reference in New Issue
Block a user