Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency svgicons2svgfont to v14 #39893

Merged
merged 3 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading