svgicons2svgfont
Advanced tools
Comparing version 10.0.6 to 11.0.0
@@ -74,2 +74,3 @@ #! /usr/bin/env node | ||
const files = program.args.flatMap((file) => glob.sync(file)); | ||
const options = program.opts(); | ||
@@ -83,16 +84,16 @@ new SVGIconsDirStream(files, { | ||
new SVGIcons2SVGFontStream({ | ||
fontName: program.fontname, | ||
fontId: program.fontId, | ||
fixedWidth: program.fixedwidth, | ||
centerHorizontally: program.centerHorizontally, | ||
centerVertically: program.centerVertically, | ||
normalize: program.normalize, | ||
fontHeight: program.height, | ||
round: program.round, | ||
descent: program.descent, | ||
ascent: program.ascent, | ||
metadata: program.metadata, | ||
log: program.v ? console.log : function () {}, // eslint-disable-line | ||
fontName: options.fontname, | ||
fontId: options.fontId, | ||
fixedWidth: options.fixedwidth, | ||
centerHorizontally: options.centerHorizontally, | ||
centerVertically: options.centerVertically, | ||
normalize: options.normalize, | ||
fontHeight: options.height, | ||
round: options.round, | ||
descent: options.descent, | ||
ascent: options.ascent, | ||
metadata: options.metadata, | ||
log: options.v ? console.log : function () {}, // eslint-disable-line | ||
}) | ||
) | ||
.pipe(program.output ? fs.createWriteStream(program.output) : process.stdout); | ||
.pipe(options.output ? fs.createWriteStream(program.output) : process.stdout); |
@@ -0,3 +1,13 @@ | ||
# [11.0.0](https://github.com/nfroidure/svgicons2svgfont/compare/v10.0.6...v11.0.0) (2022-05-28) | ||
### Bug Fixes | ||
* **core:** fix the metapak setup ([66a6274](https://github.com/nfroidure/svgicons2svgfont/commit/66a6274d2917979298a96fc7597ceb68d1689b83)) | ||
* **deps:** remove unused dependencies, move devDependencies where they belong to ([ecc3d87](https://github.com/nfroidure/svgicons2svgfont/commit/ecc3d8736df9d7dbb4116475c8bc1b062bd70565)) | ||
<a name="10.0.6"></a> | ||
# [10.0.5](https://github.com/nfroidure/svgicons2svgfont/compare/v10.0.5...v10.0.6) (2022-03-12) | ||
# [10.0.6](https://github.com/nfroidure/svgicons2svgfont/compare/v10.0.5...v10.0.6) (2022-03-12) | ||
@@ -4,0 +14,0 @@ https://github.com/nfroidure/svgicons2svgfont/releases/tag/v10.0.6 |
109
package.json
{ | ||
"name": "svgicons2svgfont", | ||
"version": "10.0.6", | ||
"version": "11.0.0", | ||
"description": "Read a set of SVG icons and ouput a SVG font", | ||
@@ -8,11 +8,13 @@ "homepage": "https://github.com/nfroidure/svgicons2svgfont", | ||
"files": [ | ||
"bin", | ||
"src" | ||
"src", | ||
"LICENSE", | ||
"README.md", | ||
"CHANGELOG.md" | ||
], | ||
"metapak": { | ||
"configs": [ | ||
"main", | ||
"readme", | ||
"mocha", | ||
"eslint", | ||
"travis", | ||
"codeclimate" | ||
@@ -22,8 +24,13 @@ ], | ||
"files": "src/*.js bin/*.js tests/*.mocha.js", | ||
"testsFiles": "tests/*.mocha.js" | ||
"testsFiles": "tests/*.mocha.js", | ||
"ignore": [ | ||
"tests/results" | ||
] | ||
} | ||
}, | ||
"scripts": { | ||
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s", | ||
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md", | ||
"cli": "env NODE_ENV=${NODE_ENV:-cli}", | ||
"cover": "nyc npm test && nyc report --reporter=html --reporter=text", | ||
"coveralls": "nyc npm test && nyc report --reporter=text-lcov | coveralls && rm -rf ./coverage", | ||
"cz": "env NODE_ENV=${NODE_ENV:-cli} git cz", | ||
@@ -33,5 +40,6 @@ "lint": "eslint src/*.js bin/*.js tests/*.mocha.js", | ||
"mocha": "mocha tests/*.mocha.js", | ||
"precz": "npm t && npm run lint && npm run metapak -- -s", | ||
"prettier": "prettier --write src/*.js bin/*.js tests/*.mocha.js", | ||
"preversion": "npm t && npm run lint && npm run metapak -s", | ||
"test": "nyc --reporter=lcov mocha tests/*.mocha.js", | ||
"preversion": "npm t && npm run lint && npm run metapak -- -s", | ||
"test": "nyc --reporter=lcov mocha tests/*.mocha.js && npm run mocha", | ||
"version": "npm run changelog && git add CHANGELOG.md" | ||
@@ -51,30 +59,41 @@ }, | ||
"engines": { | ||
"node": ">=12.0.0" | ||
"node": ">=16.15.0" | ||
}, | ||
"dependencies": { | ||
"commander": "^7.2.0", | ||
"geometry-interfaces": "^1.1.4", | ||
"glob": "^7.1.6", | ||
"neatequal": "^1.0.0", | ||
"readable-stream": "^3.4.0", | ||
"commander": "^9.3.0", | ||
"glob": "^8.0.3", | ||
"sax": "^1.2.4", | ||
"svg-pathdata": "^6.0.0" | ||
"svg-pathdata": "^6.0.3" | ||
}, | ||
"devDependencies": { | ||
"commitizen": "^4.0.3", | ||
"conventional-changelog-cli": "^2.0.31", | ||
"cz-conventional-changelog": "^3.0.2", | ||
"eslint": "^7.25.0", | ||
"eslint-plugin-prettier": "^3.1.2", | ||
"metapak": "^4.0.2", | ||
"metapak-nfroidure": "^11.0.7", | ||
"mocha": "^8.3.2", | ||
"commitizen": "^4.2.4", | ||
"conventional-changelog-cli": "^2.2.2", | ||
"coveralls": "^3.1.1", | ||
"cz-conventional-changelog": "^3.3.0", | ||
"eslint": "^8.16.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"metapak": "^4.0.4", | ||
"metapak-nfroidure": "^12.0.0", | ||
"mocha": "^10.0.0", | ||
"neatequal": "^1.0.0", | ||
"nyc": "^15.1.0", | ||
"prettier": "^2.2.1", | ||
"prettier": "^2.6.2", | ||
"streamtest": "^2.0.0" | ||
}, | ||
"author": "Nicolas Froidure", | ||
"author": { | ||
"name": "Nicolas Froidure", | ||
"email": "nicolas.froidure@insertafter.com", | ||
"url": "http://insertafter.com/en/index.html" | ||
}, | ||
"contributors": [ | ||
"Adrian Leonhard <adrianleonhard@gmail.com> (https://github.com/NaridaL)", | ||
"Vinicius Teixeira <vinicius0026@gmail.com> (https://github.com/vinicius0026" | ||
{ | ||
"name": "Adrian Leonhard", | ||
"email": "adrianleonhard@gmail.com", | ||
"url": "https://github.com/NaridaL" | ||
}, | ||
{ | ||
"name": "Vinicius Teixeira", | ||
"email": "vinicius0026@gmail.com", | ||
"url": "https://github.com/vinicius0026" | ||
} | ||
], | ||
@@ -100,3 +119,3 @@ "license": "MIT", | ||
"coveralls", | ||
"istanbul", | ||
"nyc", | ||
"eslint", | ||
@@ -106,3 +125,37 @@ "eslint-config-prettier", | ||
] | ||
}, | ||
"nyc": { | ||
"exclude": [ | ||
"tests/*.mocha.js" | ||
] | ||
}, | ||
"eslintConfig": { | ||
"extends": [ | ||
"eslint:recommended" | ||
], | ||
"parserOptions": { | ||
"ecmaVersion": 2018, | ||
"sourceType": "script", | ||
"modules": true | ||
}, | ||
"env": { | ||
"es6": true, | ||
"node": true, | ||
"jest": true, | ||
"mocha": true | ||
}, | ||
"plugins": [ | ||
"prettier" | ||
], | ||
"rules": { | ||
"prettier/prettier": "error" | ||
} | ||
}, | ||
"prettier": { | ||
"semi": true, | ||
"printWidth": 80, | ||
"singleQuote": true, | ||
"trailingComma": "es5", | ||
"proseWrap": "always" | ||
} | ||
} |
@@ -1,20 +0,17 @@ | ||
<!-- | ||
# This file is automatically generated by a `metapak` | ||
# module. Do not change it elsewhere, changes would | ||
# be overridden. | ||
--> | ||
[//]: # ( ) | ||
[//]: # (This file is automatically generated by a `metapak`) | ||
[//]: # (module. Do not change it except between the) | ||
[//]: # (`content:start/end` flags, your changes would) | ||
[//]: # (be overridden.) | ||
[//]: # ( ) | ||
# svgicons2svgfont | ||
> Read a set of SVG icons and ouput a SVG font | ||
[![NPM version](https://badge.fury.io/js/svgicons2svgfont.svg)](https://npmjs.org/package/svgicons2svgfont) | ||
[![Run tests](https://github.com/nfroidure/svgicons2svgfont/actions/workflows/test.yml/badge.svg)](https://github.com/nfroidure/svgicons2svgfont/actions/workflows/test.yml) | ||
[![Dependency Status](https://david-dm.org/nfroidure/svgicons2svgfont.svg)](https://david-dm.org/nfroidure/svgicons2svgfont) | ||
[![devDependency Status](https://david-dm.org/nfroidure/svgicons2svgfont/dev-status.svg)](https://david-dm.org/nfroidure/svgicons2svgfont#info=devDependencies) | ||
[![Coverage Status](https://coveralls.io/repos/nfroidure/svgicons2svgfont/badge.svg?branch=master)](https://coveralls.io/r/nfroidure/svgicons2svgfont?branch=master) | ||
[![Code Climate](https://codeclimate.com/github/nfroidure/svgicons2svgfont.svg)](https://codeclimate.com/github/nfroidure/svgicons2svgfont) | ||
[![Dependency Status](https://dependencyci.com/github/nfroidure/svgicons2svgfont/badge)](https://dependencyci.com/github/nfroidure/svgicons2svgfont) | ||
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/nfroidure/svgicons2svgfont/blob/master/LICENSE) | ||
[![Coverage Status](https://coveralls.io/repos/github/git://github.com/nfroidure/svgicons2svgfont/badge.svg?branch=master)](https://coveralls.io/github/git://github.com/nfroidure/svgicons2svgfont?branch=master) | ||
svgicons2svgfont is a simple tool to merge | ||
[//]: # (::contents:start) | ||
`svgicons2svgfont` is a simple tool to merge | ||
multiple icons to an SVG font. | ||
@@ -290,1 +287,12 @@ | ||
[MIT](https://github.com/nfroidure/svgicons2svgfont/blob/master/LICENSE) | ||
[//]: # (::contents:end) | ||
# Authors | ||
- [Nicolas Froidure](http://insertafter.com/en/index.html) | ||
- [Adrian Leonhard](https://github.com/NaridaL) | ||
- [Vinicius Teixeira](https://github.com/vinicius0026) | ||
# License | ||
[MIT](https://github.com/nfroidure/svgicons2svgfont/blob/master/LICENSE) |
@@ -128,2 +128,3 @@ /* eslint-disable complexity,prefer-reflect,max-len,newline-after-var */ | ||
this._options.metadata = this._options.metadata || ''; | ||
this._options.usePathBounds = this._options.usePathBounds || false; | ||
@@ -259,5 +260,5 @@ this.log = this._options.log || console.log.bind(console); // eslint-disable-line | ||
this.log( | ||
`Glyph "${glyph.name}" has no width attribute, defaulting to 150.` | ||
`Glyph "${glyph.name}" has no width attribute, using current glyph horizontal bounds.` | ||
); | ||
glyph.width = 150; | ||
glyph.defaultWidth = true; | ||
} | ||
@@ -268,5 +269,5 @@ if ('height' in tag.attributes) { | ||
this.log( | ||
`Glyph "${glyph.name}" has no height attribute, defaulting to 150.` | ||
`Glyph "${glyph.name}" has no height attribute, using current glyph vertical bounds.` | ||
); | ||
glyph.height = 150; | ||
glyph.defaultHeight = true; | ||
} | ||
@@ -351,2 +352,22 @@ } | ||
_flush(svgFontFlushCallback) { | ||
this.glyphs.forEach((glyph) => { | ||
if ( | ||
glyph.defaultHeight || | ||
glyph.defaultWidth || | ||
this._options.usePathBounds | ||
) { | ||
const glyphPath = new SVGPathData(''); | ||
glyph.paths.forEach((path) => { | ||
glyphPath.commands.push(...path.commands); | ||
}); | ||
const bounds = glyphPath.getBounds(); | ||
if (glyph.defaultHeight || this._options.usePathBounds) { | ||
glyph.height = bounds.maxY - bounds.minY; | ||
} | ||
if (glyph.defaultWidth || this._options.usePathBounds) { | ||
glyph.width = bounds.maxX - bounds.minX; | ||
} | ||
} | ||
}); | ||
const maxGlyphHeight = this.glyphs.reduce( | ||
@@ -353,0 +374,0 @@ (curMax, glyph) => Math.max(curMax, glyph.height), |
@@ -0,1 +1,2 @@ | ||
/* eslint-disable no-undef */ | ||
/*! | ||
@@ -2,0 +3,0 @@ 2D Transformation Matrix v2.7.5 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
77237
4
1926
298
13
+ Addedbrace-expansion@2.0.1(transitive)
+ Addedcommander@9.5.0(transitive)
+ Addedglob@8.1.0(transitive)
+ Addedminimatch@5.1.6(transitive)
- Removedgeometry-interfaces@^1.1.4
- Removedneatequal@^1.0.0
- Removedreadable-stream@^3.4.0
- Removedbrace-expansion@1.1.11(transitive)
- Removedcommander@7.2.0(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removedgeometry-interfaces@1.1.4(transitive)
- Removedglob@7.2.3(transitive)
- Removedisarray@0.0.1(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedneatequal@1.0.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedreadable-stream@1.1.143.6.2(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedstring_decoder@0.10.311.3.0(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removedvarstream@0.3.2(transitive)
Updatedcommander@^9.3.0
Updatedglob@^8.0.3
Updatedsvg-pathdata@^6.0.3