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

Upgrade dependencies, change support to >= node 16 #538

Merged
merged 5 commits into from
Mar 31, 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
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ on:

env:
FORCE_COLOR: 2
NODE: 14.x
NODE: 20.x

jobs:
release:
if: "!contains(github.event.head_commit.message, 'skip ci') && github.repository == 'tancredi/fantasticon'"
name: Release

runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
env:
NODE: 16.x

runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -43,7 +43,7 @@ jobs:
fail-fast: false
matrix:
os: [macOS-11, ubuntu-20.04, windows-2019]
node: [14.x, 16.x, 18.x, 19.x]
node: [16.x, 18.x, 19.x, 20.x]

steps:
- uses: actions/checkout@v3
Expand Down
12,532 changes: 6,936 additions & 5,596 deletions package-lock.json

Large diffs are not rendered by default.

49 changes: 25 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"build": "rimraf lib && tsc --project ./tsconfig.json",
"watch": "npm run build -- --watch",
"typecheck": "tsc --noEmit --project tsconfig.test.json --noEmit",
"lint": "prettier --check ."
"lint": "prettier --check .",
"fix": "prettier --write ."
},
"files": [
"bin/fantasticon",
Expand All @@ -38,34 +39,34 @@
],
"prepublish": "build",
"dependencies": {
"change-case": "^4.1.2",
"cli-color": "^2.0.2",
"commander": "^9.4.1",
"glob": "^8.0.3",
"handlebars": "^4.7.7",
"slugify": "^1.6.5",
"case": "^1.6.3",
"cli-color": "^2.0.4",
"commander": "^12.0.0",
"glob": "^10.3.12",
"handlebars": "^4.7.8",
"slugify": "^1.6.6",
"svg2ttf": "^6.0.3",
"svgicons2svgfont": "^12.0.0",
"ttf2eot": "^3.1.0",
"ttf2woff": "^3.0.0",
"ttf2woff2": "^4.0.5"
"ttf2woff2": "^5.0.0"
},
"devDependencies": {
"@types/cli-color": "^2.0.0",
"@types/glob": "^8.0.0",
"@types/jest": "^29.2.3",
"@types/node": "^18.11.9",
"@types/svg2ttf": "^5.0.1",
"@types/svgicons2svgfont": "^10.0.1",
"@types/ttf2eot": "^2.0.0",
"@types/ttf2woff": "^2.0.2",
"@types/ttf2woff2": "^2.0.0",
"jest": "^29.3.1",
"prettier": "^2.7.1",
"rimraf": "^3.0.2",
"semantic-release": "^19.0.5",
"ts-jest": "^29.0.3",
"typescript": "^4.9.3"
"@types/cli-color": "^2.0.6",
"@types/glob": "^8.1.0",
"@types/jest": "^29.5.12",
"@types/node": "^20.12.2",
"@types/svg2ttf": "^5.0.3",
"@types/svgicons2svgfont": "^10.0.5",
"@types/ttf2eot": "^2.0.2",
"@types/ttf2woff": "^2.0.4",
"@types/ttf2woff2": "^2.0.2",
"jest": "^29.7.0",
"prettier": "^3.2.5",
"rimraf": "^5.0.5",
"semantic-release": "^23.0.6",
"ts-jest": "^29.1.2",
"typescript": "^5.4.3"
},
"jest": {
"preset": "ts-jest",
Expand All @@ -81,6 +82,6 @@
}
},
"engines": {
"node": ">= 12.0.0"
"node": ">= 16.0.0"
}
}
18 changes: 7 additions & 11 deletions src/__mocks__/glob.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const mockGlobs = {
const MOCK_GLOBS = {
'./valid/**/*.svg': [
'/project/valid/foo.svg',
'/project/valid/bar.svg',
Expand All @@ -8,18 +8,14 @@ const mockGlobs = {
'./empty/**/*.svg': []
};

module.exports = (
glob: string,
_: {},
callback: (err: Error | null, paths: string[] | null) => void
) => {
setTimeout(() => {
const paths = mockGlobs[glob];
module.exports = {
glob: async (glob: string, _: {}) => {
const paths = MOCK_GLOBS[glob];

if (!paths) {
return callback(new Error(`Invalid glob: ${glob}`), null);
throw new Error(`Invalid glob: ${glob}`);
}

return callback(null, paths);
});
return paths;
}
};
2 changes: 1 addition & 1 deletion src/generators/asset-types/__tests__/eot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jest.mock('ttf2eot', () =>
);

const mockOptions = (eotOptions = { __mock: 'options__' } as any) =>
({} as unknown as FontGeneratorOptions);
({}) as unknown as FontGeneratorOptions;

const ttf = '::ttf::' as unknown as Buffer;

Expand Down
2 changes: 1 addition & 1 deletion src/generators/asset-types/__tests__/json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const mockOptions = (jsonOptions: any = {}) =>
({
codepoints: mockCodepoints,
formatOptions: { [OtherAssetType.JSON]: jsonOptions }
} as any);
}) as any;

const renderAndParse = async (jsonOptions?: any) =>
JSON.parse(
Expand Down
2 changes: 1 addition & 1 deletion src/generators/asset-types/__tests__/svg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const mockOptions = (svgOptions = { __mock: 'options__' } as any) =>
foo: { id: 'foo', absolutePath: '/root/foo.svg' },
bar: { id: 'bar', absolutePath: '/root/bar.svg' }
}
} as unknown as FontGeneratorOptions);
}) as unknown as FontGeneratorOptions;

describe('`SVG` font generator', () => {
beforeEach(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/generators/asset-types/__tests__/ttf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jest.mock('svg2ttf', () =>
const mockOptions = (ttfOptions = { __mock: 'options__' } as any) =>
({
formatOptions: { [FontAssetType.TTF]: ttfOptions }
} as unknown as FontGeneratorOptions);
}) as unknown as FontGeneratorOptions;

const svg = '::svg::';

Expand Down
2 changes: 1 addition & 1 deletion src/generators/asset-types/__tests__/woff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jest.mock('ttf2woff', () =>
const mockOptions = (woffOptions = { __mock: 'options__' } as any) =>
({
formatOptions: { [FontAssetType.WOFF]: woffOptions }
} as unknown as FontGeneratorOptions);
}) as unknown as FontGeneratorOptions;

const ttf = '::ttf::' as unknown as Buffer;

Expand Down
2 changes: 1 addition & 1 deletion src/generators/asset-types/__tests__/woff2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jest.mock('ttf2woff2', () =>
);

const mockOptions = (woffOptions = { __mock: 'options__' } as any) =>
({} as unknown as FontGeneratorOptions);
({}) as unknown as FontGeneratorOptions;

const ttf = '::ttf::' as unknown as Buffer;

Expand Down
2 changes: 1 addition & 1 deletion src/generators/asset-types/ts.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { pascalCase, constantCase } from 'change-case';
import { pascal as pascalCase, constant as constantCase } from 'case';
import { FontGenerator } from '../../types/generator';

const generateEnumKeys = (assetKeys: string[]): Record<string, string> =>
Expand Down
6 changes: 2 additions & 4 deletions src/utils/assets.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import glob from 'glob';
import { promisify } from 'util';
import { glob } from 'glob';
import { resolve, relative, join } from 'path';
import { removeExtension, splitSegments } from '../utils/path';
import { writeFile } from './fs-async';
Expand All @@ -24,8 +23,7 @@ export const ASSETS_EXTENSION = 'svg';

export const loadPaths = async (dir: string): Promise<string[]> => {
const globPath = join(dir, `**/*.${ASSETS_EXTENSION}`);

const files = await promisify(glob)(globPath, {});
const files = await glob(globPath, {});

if (!files.length) {
throw new Error(`No SVGs found in ${dir}`);
Expand Down
Loading