Skip to content

Commit e2ce88f

Browse files
committed
chore: add husky, commitlint, auto publish
1 parent 898ed20 commit e2ce88f

File tree

11 files changed

+701
-138
lines changed

11 files changed

+701
-138
lines changed

.github/workflows/publish.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,28 @@
1-
name: Publish
1+
name: Release & Publish
22

33
on:
4-
release:
5-
types: [created]
4+
push:
5+
tags:
6+
- 'v*'
67

78
jobs:
9+
release:
10+
name: Release
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v2
15+
- name: Create Release
16+
id: create_release
17+
uses: actions/create-release@v1
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
with:
21+
tag_name: ${{ github.ref }}
22+
release_name: ${{ github.ref }}
23+
draft: false
24+
prerelease: false
25+
826
publish:
927
runs-on: ubuntu-latest
1028
steps:

.github/workflows/test.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,20 @@ name: Test
22

33
on:
44
push:
5+
paths-ignore:
6+
- 'docs/**'
7+
- 'README.md'
8+
- 'LICENSE'
9+
- '.editorconfig'
510
branches:
611
- main
712
- master
813
pull_request:
14+
paths-ignore:
15+
- 'docs/**'
16+
- 'README.md'
17+
- 'LICENSE'
18+
- '.editorconfig'
919
branches:
1020
- main
1121
- master
@@ -14,13 +24,11 @@ jobs:
1424
node-test:
1525
runs-on: ${{ matrix.os }}
1626
strategy:
17-
fail-fast: false
18-
max-parallel: 4
1927
matrix:
2028
os:
2129
- ubuntu-latest
2230
- windows-latest
23-
node: [12.x, 14.x]
31+
node: [12.x, 14.x, 15.x]
2432

2533
steps:
2634
- uses: actions/checkout@v2
@@ -36,13 +44,11 @@ jobs:
3644
deno-test:
3745
runs-on: ${{ matrix.os }}
3846
strategy:
39-
fail-fast: false
40-
max-parallel: 4
4147
matrix:
4248
os:
4349
- ubuntu-latest
4450
- windows-latest
45-
deno: ["v1.3", "v1.5", "v1.x", "nightly"]
51+
deno: ['v1.3', 'v1.5', 'v1.x', 'nightly']
4652

4753
steps:
4854
- uses: actions/checkout@v2

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
dist
21
temp
32

43

.husky/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/commit-msg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
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+
npm run test

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 Tom Chen (tomchen.org)
3+
Copyright (c) 2017-2021 Tom Chen (tomchen.org)
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# BDF Parser TypeScript (JavaScript) library
22

3-
BDF (Glyph Bitmap Distribution; [Wikipedia](https://en.wikipedia.org/wiki/Glyph_Bitmap_Distribution_Format); [Spec](https://font.tomchen.org/bdf_spec/)) format bitmap font file parser library in TypeScript (JavaScript). It has [`Font`](https://font.tomchen.org/bdfparser_js/font), [`Glyph`](https://font.tomchen.org/bdfparser_js/glyph) and [`Bitmap`](https://font.tomchen.org/bdfparser_js/bitmap) classes providing more than 30 chainable API methods of parsing BDF fonts, getting their meta information, rendering text in any writing direction, adding special effects and manipulating bitmap images. 0 dependency and tested in Node.js <img src="https://raw.githubusercontent.com/tomchen/fetchline/main/images/node.svg" title="Node.js" alt="Node.js" width="26px" height="26px">, browsers <img src="https://raw.githubusercontent.com/tomchen/fetchline/main/images/chrome.svg" title="Google Chrome" alt="Google Chrome" width="21px" height="21px"><img src="https://raw.githubusercontent.com/tomchen/fetchline/main/images/firefox.svg" title="Firefox" alt="Firefox" width="21px" height="21px"><img src="https://raw.githubusercontent.com/tomchen/fetchline/main/images/safari.svg" title="Safari" alt="Safari" width="21px" height="21px"><img src="https://raw.githubusercontent.com/tomchen/fetchline/main/images/edge.svg" title="Microsoft Edge" alt="Microsoft Edge" width="21px" height="21px"><img src="https://raw.githubusercontent.com/tomchen/fetchline/main/images/opera.svg" title="Opera" alt="Opera" width="21px" height="21px"><img src="https://raw.githubusercontent.com/tomchen/fetchline/main/images/samsung_internet.svg" title="Samsung Internet" alt="Samsung Internet" width="21px" height="21px"> (so you can use HTML Canvas) and Deno <img src="https://raw.githubusercontent.com/tomchen/fetchline/main/images/deno.svg" title="Deno" alt="Deno" width="26px" height="26px">, it has detailed documentation / tutorials / API reference.
3+
BDF (Glyph Bitmap Distribution; [Wikipedia](https://en.wikipedia.org/wiki/Glyph_Bitmap_Distribution_Format); [Spec](https://font.tomchen.org/bdf_spec/)) format bitmap font file parser library in TypeScript (JavaScript). It has [`Font`](https://font.tomchen.org/bdfparser_js/font), [`Glyph`](https://font.tomchen.org/bdfparser_js/glyph) and [`Bitmap`](https://font.tomchen.org/bdfparser_js/bitmap) classes providing more than 30 chainable API methods of parsing BDF fonts, getting their meta information, rendering text in any writing direction, adding special effects and manipulating bitmap images. 0 dependencies and tested in Node.js <img src="https://raw.githubusercontent.com/tomchen/fetchline/main/images/node.svg" title="Node.js" alt="Node.js" width="26px" height="26px">, browsers <img src="https://raw.githubusercontent.com/tomchen/fetchline/main/images/chrome.svg" title="Google Chrome" alt="Google Chrome" width="21px" height="21px"><img src="https://raw.githubusercontent.com/tomchen/fetchline/main/images/firefox.svg" title="Firefox" alt="Firefox" width="21px" height="21px"><img src="https://raw.githubusercontent.com/tomchen/fetchline/main/images/safari.svg" title="Safari" alt="Safari" width="21px" height="21px"><img src="https://raw.githubusercontent.com/tomchen/fetchline/main/images/edge.svg" title="Microsoft Edge" alt="Microsoft Edge" width="21px" height="21px"><img src="https://raw.githubusercontent.com/tomchen/fetchline/main/images/opera.svg" title="Opera" alt="Opera" width="21px" height="21px"><img src="https://raw.githubusercontent.com/tomchen/fetchline/main/images/samsung_internet.svg" title="Samsung Internet" alt="Samsung Internet" width="21px" height="21px"> (so you can use HTML Canvas) and Deno <img src="https://raw.githubusercontent.com/tomchen/fetchline/main/images/deno.svg" title="Deno" alt="Deno" width="26px" height="26px">, it has detailed documentation / tutorials / API reference.
44

5-
[![npm package](https://img.shields.io/badge/npm%20i-bdfparser-brightgreen)](https://www.npmjs.com/package/bdfparser) [![version number](https://img.shields.io/npm/v/bdfparser?color=green&label=version)](https://github.com/tomchen/bdfparser/releases) [![Actions Status](https://github.com/tomchen/bdfparser/workflows/Test/badge.svg)](https://github.com/tomchen/bdfparser/actions) [![License](https://img.shields.io/github/license/tomchen/bdfparser)](https://github.com/tomchen/bdfparser/blob/main/LICENSE)
5+
[![npm package](https://img.shields.io/badge/npm%20i-bdfparser-brightgreen)](https://www.npmjs.com/package/bdfparser) [![version number](https://img.shields.io/npm/v/bdfparser?color=green&label=version)](https://github.com/tomchen/bdfparser/releases) [![Actions Status](https://github.com/tomchen/bdfparser/workflows/Test/badge.svg)](https://github.com/tomchen/bdfparser/actions) [![Node.js](https://img.shields.io/badge/node-%3E=12.0-brightgreen.svg?logo=node.js)](https://nodejs.org/) [![Deno](https://img.shields.io/badge/deno-%3E=1.3.0-white.svg?logo=deno)](https://deno.land/x/bdfparser) [![License](https://img.shields.io/github/license/tomchen/bdfparser)](https://github.com/tomchen/bdfparser/blob/main/LICENSE)
66

77
**BDF Parser TypeScript (JavaScript) library** ([documentation](https://font.tomchen.org/bdfparser_js/); [GitHub page](https://github.com/tomchen/bdfparser-js); [npm page](https://www.npmjs.com/package/bdfparser); `npm i bdfparser`) is a port of **BDF Parser Python library** ([documentation](https://font.tomchen.org/bdfparser_py/); [GitHub page](https://github.com/tomchen/bdfparser); [PyPI page](https://pypi.org/project/bdfparser/); `pip install bdfparser`). Both are written by [Tom Chen](https://github.com/tomchen/) and under the MIT License.
88

commitlint.config.js

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

package.json

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,18 @@
88
"umd:main": "dist/umd/index.js",
99
"types": "dist/types/index.d.js",
1010
"scripts": {
11+
"postinstall": "husky install",
1112
"build": "npm run build:cjs && npm run build:esm && npm run build:umd && npm run build:types",
1213
"build:cjs": "node tools/cleanup cjs && tsc -p config/tsconfig.cjs.json",
1314
"build:esm": "node tools/cleanup esm && tsc -p config/tsconfig.esm.json",
1415
"build:umd": "node tools/cleanup umd && webpack --config config/webpack.config.js",
1516
"build:types": "node tools/cleanup types && tsc -p config/tsconfig.types.json",
1617
"clean": "node tools/cleanup",
1718
"package": "npm run build && npm pack",
18-
"test": "jest --no-cache",
19+
"test": "jest --no-cache --runInBand",
1920
"test:deno": "cd deno && npm run test",
2021
"test:deno:cov": "cd deno && npm run test:cov",
21-
"test:cov": "jest --no-cache --coverage",
22+
"test:cov": "jest --no-cache --coverage --runInBand",
2223
"addscope": "node tools/packagejson name @tomchen/bdfparser"
2324
},
2425
"publishConfig": {
@@ -48,20 +49,26 @@
4849
},
4950
"dependencies": {},
5051
"devDependencies": {
52+
"@commitlint/cli": "^11.0.0",
53+
"@commitlint/config-conventional": "^11.0.0",
5154
"@types/jest": "^26.0.20",
52-
"@typescript-eslint/eslint-plugin": "^4.14.2",
53-
"@typescript-eslint/parser": "^4.14.2",
55+
"@typescript-eslint/eslint-plugin": "^4.15.0",
56+
"@typescript-eslint/parser": "^4.15.0",
5457
"eslint": "^7.19.0",
5558
"eslint-config-prettier": "^7.2.0",
5659
"eslint-plugin-prettier": "^3.3.1",
60+
"husky": "^5.0.9",
5761
"jest": "^26.6.3",
5862
"prettier": "^2.2.1",
59-
"readlineiter": "^1.0.0",
60-
"ts-jest": "^26.5.0",
61-
"ts-loader": "^8.0.14",
63+
"readlineiter": "^1.0.1",
64+
"ts-jest": "^26.5.1",
65+
"ts-loader": "^8.0.16",
6266
"ts-node": "^9.1.1",
63-
"typescript": "^4.1.3",
64-
"webpack": "^5.19.0",
65-
"webpack-cli": "^4.4.0"
67+
"typescript": "^4.1.4",
68+
"webpack": "^5.21.2",
69+
"webpack-cli": "^4.5.0"
70+
},
71+
"engines": {
72+
"node": ">= 12.0"
6673
}
6774
}

0 commit comments

Comments
 (0)