Skip to content

Commit b5e087e

Browse files
committed
feat: modernize, require node >= 14, bump deps (closes #8)
1 parent 3c9e29c commit b5e087e

27 files changed

+242
-9211
lines changed

.babelrc

Lines changed: 0 additions & 10 deletions
This file was deleted.

.commitlintrc.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
extends: ['@commitlint/config-conventional']
3+
};

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
!.*.js

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* text=auto
1+
* text=auto eol=lf

.github/workflows/ci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: CI
2+
on:
3+
- push
4+
- pull_request
5+
jobs:
6+
build:
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
matrix:
10+
os:
11+
- ubuntu-latest
12+
node_version:
13+
- 14
14+
- 16
15+
- 18
16+
name: Node ${{ matrix.node_version }} on ${{ matrix.os }}
17+
steps:
18+
- name: Install fonts
19+
run: |
20+
sudo apt-get update -qq
21+
echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections
22+
sudo apt-get install ttf-mscorefonts-installer
23+
sudo fc-cache
24+
- uses: actions/checkout@v3
25+
- name: Setup node
26+
uses: actions/setup-node@v3
27+
with:
28+
node-version: ${{ matrix.node_version }}
29+
- name: Install dependencies
30+
run: npm install
31+
- name: Run tests
32+
run: npm run test

.gitignore

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,12 @@
44
node_modules
55
coverage
66
.nyc_output
7-
lib
7+
locales/
8+
package-lock.json
9+
yarn.lock
10+
11+
Thumbs.db
12+
tmp/
13+
temp/
14+
*.lcov
15+
.env

.husky/commit-msg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx --no-install commitlint --edit $1

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx --no-install lint-staged && npm test

.lintstagedrc.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
"*.md": filenames => filenames.map(filename => `remark ${filename} -qfo`),
3+
'package.json': 'fixpack',
4+
'*.js': 'xo --fix'
5+
};

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

.prettierrc.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
singleQuote: true,
3+
bracketSpacing: true,
4+
trailingComma: 'none'
5+
};

.remarkrc.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
plugins: ['preset-github']
3+
};

.travis.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

.xo-config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
prettier: true,
3+
space: true,
4+
extends: ['xo-lass']
5+
};

README.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# custom-fonts-in-emails
22

3-
[![build status](https://img.shields.io/travis/ladjs/custom-fonts-in-emails.svg)](https://travis-ci.org/ladjs/custom-fonts-in-emails)
4-
[![code coverage](https://img.shields.io/codecov/c/github/ladjs/custom-fonts-in-emails.svg)](https://codecov.io/gh/ladjs/custom-fonts-in-emails)
3+
[![build status](https://github.com/ladjs/custom-fonts-in-emails/actions/workflows/ci.yml/badge.svg)](https://github.com/ladjs/custom-fonts-in-emails/actions/workflows/ci.yml)
54
[![code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)
65
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
76
[![made with lass](https://img.shields.io/badge/made_with-lass-95CC28.svg)](https://lass.js.org)
@@ -11,11 +10,11 @@
1110

1211
* :art: Outputs optimized SVG, PNG, and Base64 inlined images with optional support for [**@2x**](https://github.com/2x) and [**@3x**](https://github.com/3x) Retina versions (uses the incredibly fast and performant [sharp][sharp]).
1312
* :bulb: Automatic smart-detection of font names spelled incorrectly (or with the wrong extension) with 50% accuracy (uses [fast-levenshtein][fast-levenshtein] and checks for at least 50% distance match).
14-
* :crystal_ball: Detects user, local, network, system fonts, and `node_modules` folder fonts using [os-fonts][os-fonts] and [pkg-up][pkg-up] (e.g. you don't need to write `Arial.ttf`, you can just write `Arial`).
13+
* :crystal\_ball: Detects user, local, network, system fonts, and `node_modules` folder fonts using [os-fonts][os-fonts] and [pkg-up][pkg-up] (e.g. you don't need to write `Arial.ttf`, you can just write `Arial`).
1514
* :tada: Supports all WOFF, OTF, and TTF fonts (both with TrueType `glyf` and PostScript `cff` outlines).
1615
* :sparkles: Use with recommended packages [nodemailer][nodemailer] and [nodemailer-base64-to-s3][nodemailer-base64-to-s3], or simply use [Lad][lad-url] (has this built-in).
1716
* :pear: Pairs great with [font-awesome-assets][font-awesome-assets] and [juice][juice] (see [Lad's][lad-url] usage as an example).
18-
* :white_check_mark: Supports offline and missing image support by automatically adding `alt`, `title`, and `style` attributes of `color` and `font-size` based upon the options passed.
17+
* :white\_check\_mark: Supports offline and missing image support by automatically adding `alt`, `title`, and `style` attributes of `color` and `font-size` based upon the options passed.
1918

2019

2120
## Index
@@ -219,13 +218,13 @@ This is an object of all of the custom fonts cached.
219218

220219
## Wishlist
221220

222-
* [ ] [svg/svgo#620](https://github.com/svg/svgo/issues/620)
223-
* [ ] [svg/svgo#619](https://github.com/svg/svgo/issues/619)
224-
* [ ] [nodebox/opentype.js#238](https://github.com/nodebox/opentype.js/issues/238)
225-
* [ ] [jergason/recursive-readdir#35](https://github.com/jergason/recursive-readdir/pull/35)
226-
* [ ] [shrhdk/text-to-svg#20](https://github.com/shrhdk/text-to-svg/issues/20)
227-
* [ ] [shrhdk/text-to-svg#19](https://github.com/shrhdk/text-to-svg/issues/19)
228-
* [ ] [shrhdk/text-to-svg#18](https://github.com/shrhdk/text-to-svg/issues/18)
221+
* \[ ] [svg/svgo#620](https://github.com/svg/svgo/issues/620)
222+
* \[ ] [svg/svgo#619](https://github.com/svg/svgo/issues/619)
223+
* \[ ] [nodebox/opentype.js#238](https://github.com/nodebox/opentype.js/issues/238)
224+
* \[ ] [jergason/recursive-readdir#35](https://github.com/jergason/recursive-readdir/pull/35)
225+
* \[ ] [shrhdk/text-to-svg#20](https://github.com/shrhdk/text-to-svg/issues/20)
226+
* \[ ] [shrhdk/text-to-svg#19](https://github.com/shrhdk/text-to-svg/issues/19)
227+
* \[ ] [shrhdk/text-to-svg#18](https://github.com/shrhdk/text-to-svg/issues/18)
229228

230229

231230
## Credits
@@ -238,7 +237,7 @@ Thanks to the public domain font [GoudyBookletter1911][goudybookletter1911] for
238237
[MIT](LICENSE) © Nick Baugh
239238

240239

241-
##
240+
##
242241

243242
[lad-url]: https://lad.js.org
244243

art/readme.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const path = require('path');
22
const _ = require('lodash');
33

4-
// eslint-disable-next-line unicorn/import-index
54
const customFonts = require('../');
65

76
const options = {
@@ -18,9 +17,9 @@ const options = {
1817
fontSize: 40
1918
};
2019

21-
const data = _.map(['svg', 'img', 'png', 'png2x', 'png3x'], (method) => {
22-
return customFonts[method](options);
23-
});
20+
const data = _.map(['svg', 'img', 'png', 'png2x', 'png3x'], (method) =>
21+
customFonts[method](options)
22+
);
2423
_.each(data, (string) => {
2524
console.log(`<br />\n${string}\n<br />`);
2625
});

ava.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const { familySync, GLIBC } = require('detect-libc');
2+
3+
module.exports = {
4+
verbose: true,
5+
failFast: true,
6+
serial: true,
7+
// <https://github.com/lovell/sharp/issues/3164#issuecomment-1168328811>
8+
workerThreads: familySync() !== GLIBC
9+
};

0 commit comments

Comments
 (0)