diff --git a/badges.svg b/badges.svg index a9b92c6d..bdd84a45 100644 --- a/badges.svg +++ b/badges.svg @@ -1,5 +1,5 @@ - - coverage: 87.71% + + coverage: 86.91% @@ -13,8 +13,8 @@ \ No newline at end of file diff --git a/coverage-summary.json b/coverage-summary.json index 6ceb48ce..025a2812 100644 --- a/coverage-summary.json +++ b/coverage-summary.json @@ -1,6 +1,7 @@ -{"total": {"lines":{"total":269,"covered":239,"skipped":0,"pct":88.84},"statements":{"total":285,"covered":250,"skipped":0,"pct":87.71},"functions":{"total":60,"covered":56,"skipped":0,"pct":93.33},"branches":{"total":173,"covered":116,"skipped":0,"pct":67.05},"branchesTrue":{"total":0,"covered":0,"skipped":0,"pct":"Unknown"}} +{"total": {"lines":{"total":280,"covered":248,"skipped":0,"pct":88.57},"statements":{"total":298,"covered":259,"skipped":0,"pct":86.91},"functions":{"total":67,"covered":60,"skipped":0,"pct":89.55},"branches":{"total":181,"covered":121,"skipped":0,"pct":66.85},"branchesTrue":{"total":0,"covered":0,"skipped":0,"pct":"Unknown"}} ,"/home/runner/work/svgtofont/svgtofont/src/cli.ts": {"lines":{"total":11,"covered":0,"skipped":0,"pct":0},"functions":{"total":2,"covered":0,"skipped":0,"pct":0},"statements":{"total":11,"covered":0,"skipped":0,"pct":0},"branches":{"total":6,"covered":0,"skipped":0,"pct":0}} ,"/home/runner/work/svgtofont/svgtofont/src/generate.ts": {"lines":{"total":36,"covered":35,"skipped":0,"pct":97.22},"functions":{"total":11,"covered":11,"skipped":0,"pct":100},"statements":{"total":41,"covered":40,"skipped":0,"pct":97.56},"branches":{"total":27,"covered":17,"skipped":0,"pct":62.96}} -,"/home/runner/work/svgtofont/svgtofont/src/index.ts": {"lines":{"total":97,"covered":93,"skipped":0,"pct":95.87},"functions":{"total":4,"covered":4,"skipped":0,"pct":100},"statements":{"total":102,"covered":97,"skipped":0,"pct":95.09},"branches":{"total":85,"covered":69,"skipped":0,"pct":81.17}} +,"/home/runner/work/svgtofont/svgtofont/src/index.ts": {"lines":{"total":98,"covered":94,"skipped":0,"pct":95.91},"functions":{"total":4,"covered":4,"skipped":0,"pct":100},"statements":{"total":103,"covered":98,"skipped":0,"pct":95.14},"branches":{"total":87,"covered":71,"skipped":0,"pct":81.6}} +,"/home/runner/work/svgtofont/svgtofont/src/log.ts": {"lines":{"total":10,"covered":8,"skipped":0,"pct":80},"functions":{"total":7,"covered":4,"skipped":0,"pct":57.14},"statements":{"total":12,"covered":8,"skipped":0,"pct":66.66},"branches":{"total":6,"covered":3,"skipped":0,"pct":50}} ,"/home/runner/work/svgtofont/svgtofont/src/utils.ts": {"lines":{"total":125,"covered":111,"skipped":0,"pct":88.8},"functions":{"total":43,"covered":41,"skipped":0,"pct":95.34},"statements":{"total":131,"covered":113,"skipped":0,"pct":86.25},"branches":{"total":55,"covered":30,"skipped":0,"pct":54.54}} } diff --git a/example/index.html b/example/index.html index eb01cbc9..30a69ee0 100644 --- a/example/index.html +++ b/example/index.html @@ -74,12 +74,12 @@ /* IE9*/ src: url("svgtofont.eot#iefix") format("embedded-opentype"), /* IE6-IE8 */ - url("svgtofont.woff2?1666603520093") format("woff2"), - url("svgtofont.woff?1666603520093") format("woff"), + url("svgtofont.woff2?1666605679954") format("woff2"), + url("svgtofont.woff?1666605679954") format("woff"), /* chrome, firefox */ - url("svgtofont.ttf?1666603520093") format("truetype"), + url("svgtofont.ttf?1666605679954") format("truetype"), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/ - url("svgtofont.svg#svgtofont?1666603520093") format("svg"); + url("svgtofont.svg#svgtofont?1666605679954") format("svg"); /* iOS 4.1- */ } .iconfont { diff --git a/example/svgtofont.css b/example/svgtofont.css index 2aea2ecf..53bba3b4 100644 --- a/example/svgtofont.css +++ b/example/svgtofont.css @@ -1,11 +1,11 @@ @font-face { font-family: "svgtofont"; - src: url('svgtofont.eot?t=1666603520074'); /* IE9*/ - src: url('svgtofont.eot?t=1666603520074#iefix') format('embedded-opentype'), /* IE6-IE8 */ - url("svgtofont.woff2?t=1666603520074") format("woff2"), - url("svgtofont.woff?t=1666603520074") format("woff"), - url('svgtofont.ttf?t=1666603520074') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/ - url('svgtofont.svg?t=1666603520074#svgtofont') format('svg'); /* iOS 4.1- */ + src: url('svgtofont.eot?t=1666605679936'); /* IE9*/ + src: url('svgtofont.eot?t=1666605679936#iefix') format('embedded-opentype'), /* IE6-IE8 */ + url("svgtofont.woff2?t=1666605679936") format("woff2"), + url("svgtofont.woff?t=1666605679936") format("woff"), + url('svgtofont.ttf?t=1666605679936') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/ + url('svgtofont.svg?t=1666605679936#svgtofont') format('svg'); /* iOS 4.1- */ } [class^="svgtofont-"], [class*=" svgtofont-"] { diff --git a/example/svgtofont.eot b/example/svgtofont.eot index c549f94a..79565f89 100644 Binary files a/example/svgtofont.eot and b/example/svgtofont.eot differ diff --git a/example/svgtofont.less b/example/svgtofont.less index 89a20930..8f74baed 100644 --- a/example/svgtofont.less +++ b/example/svgtofont.less @@ -1,10 +1,10 @@ @font-face {font-family: "svgtofont"; - src: url('svgtofont.eot?t=1666603520074'); /* IE9*/ - src: url('svgtofont.eot?t=1666603520074#iefix') format('embedded-opentype'), /* IE6-IE8 */ - url("svgtofont.woff2?t=1666603520074") format("woff2"), - url("svgtofont.woff?t=1666603520074") format("woff"), - url('svgtofont.ttf?t=1666603520074') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/ - url('svgtofont.svg?t=1666603520074#svgtofont') format('svg'); /* iOS 4.1- */ + src: url('svgtofont.eot?t=1666605679936'); /* IE9*/ + src: url('svgtofont.eot?t=1666605679936#iefix') format('embedded-opentype'), /* IE6-IE8 */ + url("svgtofont.woff2?t=1666605679936") format("woff2"), + url("svgtofont.woff?t=1666605679936") format("woff"), + url('svgtofont.ttf?t=1666605679936') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/ + url('svgtofont.svg?t=1666605679936#svgtofont') format('svg'); /* iOS 4.1- */ } [class^="svgtofont-"], [class*=" svgtofont-"] { diff --git a/example/svgtofont.module.less b/example/svgtofont.module.less index 6902c626..2d8a072c 100644 --- a/example/svgtofont.module.less +++ b/example/svgtofont.module.less @@ -1,10 +1,10 @@ @font-face {font-family: "svgtofont"; - src: url('svgtofont.eot?t=1666603520074'); /* IE9*/ - src: url('svgtofont.eot?t=1666603520074#iefix') format('embedded-opentype'), /* IE6-IE8 */ - url("svgtofont.woff2?t=1666603520074") format("woff2"), - url("svgtofont.woff?t=1666603520074") format("woff"), - url('svgtofont.ttf?t=1666603520074') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/ - url('svgtofont.svg?t=1666603520074#svgtofont') format('svg'); /* iOS 4.1- */ + src: url('svgtofont.eot?t=1666605679936'); /* IE9*/ + src: url('svgtofont.eot?t=1666605679936#iefix') format('embedded-opentype'), /* IE6-IE8 */ + url("svgtofont.woff2?t=1666605679936") format("woff2"), + url("svgtofont.woff?t=1666605679936") format("woff"), + url('svgtofont.ttf?t=1666605679936') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/ + url('svgtofont.svg?t=1666605679936#svgtofont') format('svg'); /* iOS 4.1- */ } [class^="svgtofont-"], [class*=" svgtofont-"] { diff --git a/example/svgtofont.scss b/example/svgtofont.scss index 09af225e..ce261ebc 100644 --- a/example/svgtofont.scss +++ b/example/svgtofont.scss @@ -1,10 +1,10 @@ @font-face {font-family: "svgtofont"; - src: url('svgtofont.eot?t=1666603520074'); /* IE9*/ - src: url('svgtofont.eot?t=1666603520074#iefix') format('embedded-opentype'), /* IE6-IE8 */ - url("svgtofont.woff2?t=1666603520074") format("woff2"), - url("svgtofont.woff?t=1666603520074") format("woff"), - url('svgtofont.ttf?t=1666603520074') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/ - url('svgtofont.svg?t=1666603520074#svgtofont') format('svg'); /* iOS 4.1- */ + src: url('svgtofont.eot?t=1666605679936'); /* IE9*/ + src: url('svgtofont.eot?t=1666605679936#iefix') format('embedded-opentype'), /* IE6-IE8 */ + url("svgtofont.woff2?t=1666605679936") format("woff2"), + url("svgtofont.woff?t=1666605679936") format("woff"), + url('svgtofont.ttf?t=1666605679936') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/ + url('svgtofont.svg?t=1666605679936#svgtofont') format('svg'); /* iOS 4.1- */ } [class^="svgtofont-"], [class*=" svgtofont-"] { diff --git a/example/svgtofont.styl b/example/svgtofont.styl index 89a20930..8f74baed 100644 --- a/example/svgtofont.styl +++ b/example/svgtofont.styl @@ -1,10 +1,10 @@ @font-face {font-family: "svgtofont"; - src: url('svgtofont.eot?t=1666603520074'); /* IE9*/ - src: url('svgtofont.eot?t=1666603520074#iefix') format('embedded-opentype'), /* IE6-IE8 */ - url("svgtofont.woff2?t=1666603520074") format("woff2"), - url("svgtofont.woff?t=1666603520074") format("woff"), - url('svgtofont.ttf?t=1666603520074') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/ - url('svgtofont.svg?t=1666603520074#svgtofont') format('svg'); /* iOS 4.1- */ + src: url('svgtofont.eot?t=1666605679936'); /* IE9*/ + src: url('svgtofont.eot?t=1666605679936#iefix') format('embedded-opentype'), /* IE6-IE8 */ + url("svgtofont.woff2?t=1666605679936") format("woff2"), + url("svgtofont.woff?t=1666605679936") format("woff"), + url('svgtofont.ttf?t=1666605679936') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/ + url('svgtofont.svg?t=1666605679936#svgtofont') format('svg'); /* iOS 4.1- */ } [class^="svgtofont-"], [class*=" svgtofont-"] { diff --git a/example/svgtofont.ttf b/example/svgtofont.ttf index 4ca28434..ebe0b086 100644 Binary files a/example/svgtofont.ttf and b/example/svgtofont.ttf differ diff --git a/example/svgtofont.woff b/example/svgtofont.woff index 4373d2da..fcaa468e 100644 Binary files a/example/svgtofont.woff and b/example/svgtofont.woff differ diff --git a/example/svgtofont.woff2 b/example/svgtofont.woff2 index c243f023..3181dc1f 100644 Binary files a/example/svgtofont.woff2 and b/example/svgtofont.woff2 differ diff --git a/index.html b/index.html index ea6bf951..2510283b 100644 --- a/index.html +++ b/index.html @@ -413,6 +413,14 @@

log

+
+

Type: Boolean

+
+

A value of false disables logging

dist

Type: String
Default value: dist => fonts

diff --git a/lcov-report/cli.ts.html b/lcov-report/cli.ts.html index 3cf02f2e..195945fd 100644 --- a/lcov-report/cli.ts.html +++ b/lcov-report/cli.ts.html @@ -119,7 +119,9 @@

All files cli.ts

54 55 56 -57  +57 +58  +        @@ -181,6 +183,7 @@

All files cli.ts

import yargs, { Arguments } from 'yargs'; import path from 'path'; import svgtofont from './'; +import { log } from './log';   type ArgvResult = Arguments<{ sources: string; @@ -205,7 +208,7 @@

All files cli.ts

const outputPath = path.join(process.cwd(), argv.output);   if (!FS.pathExistsSync(sourcesPath)) { - console.error('The directory does not exist!', sourcesPath); + log.error('The directory does not exist!', sourcesPath); process.exit(); }   @@ -227,9 +230,9 @@

All files cli.ts

}, }) .then(() => { - console.log('done!'); + log.log('done!'); }).catch((err) => { - console.log('SvgToFont:ERR:', err); + log.log('SvgToFont:ERR:', err); });   @@ -238,7 +241,7 @@

All files cli.ts

+ + + + + + \ No newline at end of file diff --git a/lcov-report/utils.ts.html b/lcov-report/utils.ts.html index a6ca94c0..dca2dd8c 100644 --- a/lcov-report/utils.ts.html +++ b/lcov-report/utils.ts.html @@ -394,7 +394,9 @@

All files utils.ts

329 330 331 -332  +332 +333  +        @@ -739,6 +741,7 @@

All files utils.ts

import del from 'del'; import moveFile from 'move-file'; import { SvgToFontOptions } from './'; +import { log } from './log';   let UnicodeObj: Record<string, string> = {}; /** @@ -771,7 +774,7 @@

All files utils.ts

// Setting the font destination fontStream.pipe(fs.createWriteStream(DIST_PATH)) .on("finish", () => { - console.log(`${color.green('SUCCESS')} ${color.blue('SVG')} font successfully created!\n ╰┈▶ ${DIST_PATH}`); + log.log(`${color.green('SUCCESS')} ${color.blue('SVG')} font successfully created!\n ╰┈▶ ${DIST_PATH}`); resolve(UnicodeObj); }) .on("error", (err) => { @@ -857,7 +860,7 @@

All files utils.ts

`export type ${enumName}Icon = ${fileNames.map(name => `"${name}"`).join(' | ')}\n` + `export const ${enumName}Prefix = "${options.classNamePrefix}-"` ); - console.log(`${color.green('SUCCESS')} Created ${DIST_PATH}`); + log.log(`${color.green('SUCCESS')} Created ${DIST_PATH}`); }   /* @@ -884,7 +887,7 @@

All files utils.ts

Iif (err) { return reject(err); } - console.log(`${color.green('SUCCESS')} ${color.blue('TTF')} font successfully created!\n ╰┈▶ ${DIST_PATH}`); + log.log(`${color.green('SUCCESS')} ${color.blue('TTF')} font successfully created!\n ╰┈▶ ${DIST_PATH}`); resolve(ttfBuf); }); }); @@ -902,7 +905,7 @@

All files utils.ts

Iif (err) { return reject(err); } - console.log(`${color.green('SUCCESS')} ${color.blue('EOT')} font successfully created!\n ╰┈▶ ${DIST_PATH}`); + log.log(`${color.green('SUCCESS')} ${color.blue('EOT')} font successfully created!\n ╰┈▶ ${DIST_PATH}`); resolve(eot); }); }); @@ -919,7 +922,7 @@

All files utils.ts

Iif (err) { return reject(err); } - console.log(`${color.green('SUCCESS')} ${color.blue('WOFF')} font successfully created!\n ╰┈▶ ${DIST_PATH}`); + log.log(`${color.green('SUCCESS')} ${color.blue('WOFF')} font successfully created!\n ╰┈▶ ${DIST_PATH}`); resolve(woff); }); }); @@ -936,7 +939,7 @@

All files utils.ts

Iif (err) { return reject(err); } - console.log(`${color.green('SUCCESS')} ${color.blue('WOFF2')} font successfully created!\n ╰┈▶ ${DIST_PATH}`); + log.log(`${color.green('SUCCESS')} ${color.blue('WOFF2')} font successfully created!\n ╰┈▶ ${DIST_PATH}`); resolve({ path: DIST_PATH }); @@ -966,7 +969,7 @@

All files utils.ts

Iif (err) { return reject(err); } - console.log(`${color.green('SUCCESS')} ${color.blue('Svg Symbol')} font successfully created!\n ╰┈▶ ${DIST_PATH}`); + log.log(`${color.green('SUCCESS')} ${color.blue('Svg Symbol')} font successfully created!\n ╰┈▶ ${DIST_PATH}`); resolve({ path: DIST_PATH, svg: $.html("svg") @@ -1038,7 +1041,7 @@

All files utils.ts

return null; })); } - createdFiles.forEach(filePath => console.log(`${color.green('SUCCESS')} Created ${filePath} `)); + createdFiles.forEach(filePath => log.log(`${color.green('SUCCESS')} Created ${filePath} `)); resolve(createdFiles); }) }); @@ -1063,7 +1066,7 @@

All files utils.ts