Skip to content

Commit

Permalink
Update dependency svgicons2svgfont to v14 (#39893)
Browse files Browse the repository at this point in the history
* Update dependency svgicons2svgfont to v14
* Update svg-to-font for new svgicons2svgfont version

---------

Co-authored-by: Renovate Bot <[email protected]>
Co-authored-by: Brad Jorsch <[email protected]>
  • Loading branch information
3 people authored Oct 24, 2024
1 parent 7b79cd0 commit e8c70af
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 40 deletions.
117 changes: 91 additions & 26 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Updated package dependencies.
2 changes: 1 addition & 1 deletion projects/js-packages/social-logos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@types/react-dom": "18.3.0",
"glob": "10.4.1",
"svg2ttf": "^6.0.3",
"svgicons2svgfont": "^12.0.0",
"svgicons2svgfont": "^14.0.0",
"svgo": "^3.3.2",
"svgstore": "^3.0.1",
"typescript": "5.0.4",
Expand Down
2 changes: 1 addition & 1 deletion projects/js-packages/social-logos/tools/build
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if ./tools/clean &&
# Disabling this for now until we figure out the proper place for it.
# ./tools/svg-to-php &&
./tools/svg-to-sprite.js &&
./tools/svg-to-font.js &&
./tools/svg-to-font.mjs &&
./tools/svg-to-react-data.js &&
./tools/build-react; then
echo 'Build complete.'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
#!/usr/bin/env node

import { spawnSync } from 'child_process';
import fs from 'fs';
import path from 'path';
import process from 'process';
import { fileURLToPath } from 'url';
import { glob } from 'glob';
import svg2ttf from 'svg2ttf';
import { SVGIcons2SVGFontStream } from 'svgicons2svgfont';
import wawoff2 from 'wawoff2';

/* eslint-disable no-console */
const svgDir = 'build/svg-clean';
const srcSvgDir = 'src/svg';
Expand All @@ -7,17 +18,8 @@ const destFontDir = 'build/font';
const cssFile = destFontDir + '/social-logos.css';
const woff2FontFile = destFontDir + '/social-logos.woff2';

const { spawnSync } = require( 'child_process' );
const fs = require( 'fs' );
const path = require( 'path' );
const process = require( 'process' );
const { glob } = require( 'glob' );
const svg2ttf = require( 'svg2ttf' );
const SVGIcons2SVGFontStream = require( 'svgicons2svgfont' );
const wawoff2 = require( 'wawoff2' );

// Start in the right folder.
const rootDir = __dirname + '/..';
const rootDir = fileURLToPath( new URL( '..', import.meta.url ) );
process.chdir( rootDir );

const getCodepoint = name => {
Expand Down Expand Up @@ -93,7 +95,7 @@ ${ cssCodepoints }*/`;
// Make destination dir as needed.
fs.mkdirSync( destFontDir, { recursive: true } );

const codepoints = require( path.resolve( codepointsFile ) );
const codepoints = JSON.parse( fs.readFileSync( path.resolve( codepointsFile ) ) );
let maxCodepoint = Math.max( ...Object.values( codepoints ) );

let fontBuffer = Buffer.alloc( 0 );
Expand All @@ -109,7 +111,7 @@ const fontStream = new SVGIcons2SVGFontStream( {
fontStream
.on( 'data', data => {
// This concats to the font buffer each time a glyph is written.
fontBuffer = Buffer.concat( [ fontBuffer, data ] );
fontBuffer = Buffer.concat( [ fontBuffer, Buffer.from( data ) ] );
} )
.on( 'finish', async function () {
const woff2Buffer = await svg2woff2( fontBuffer );
Expand Down

0 comments on commit e8c70af

Please sign in to comment.