Skip to content

Commit a1dcda6

Browse files
authored
refactor!: migrate to ESM (#23)
1 parent a19640a commit a1dcda6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+260
-247
lines changed

.github/workflows/typedoc.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: TypeDoc
2+
3+
on:
4+
workflow_dispatch:
5+
release:
6+
types: [published]
7+
8+
jobs:
9+
typedoc:
10+
# Documentation: https://github.com/zakodium/workflows#typedoc
11+
uses: zakodium/workflows/.github/workflows/typedoc.yml@typedoc-v1
12+
secrets:
13+
github-token: ${{ secrets.BOT_TOKEN }}

.prettierignore

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

.prettierrc

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

.prettierrc.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"arrowParens": "always",
3+
"semi": true,
4+
"singleQuote": true,
5+
"tabWidth": 2,
6+
"trailingComma": "all"
7+
}

README.md

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
1-
# fast-bmp
2-
31
<h3 align="center">
4-
52
<a href="https://www.zakodium.com">
63
<img src="https://www.zakodium.com/brand/zakodium-logo-white.svg" width="50" alt="Zakodium logo" />
74
</a>
8-
95
<p>
106
Maintained by <a href="https://www.zakodium.com">Zakodium</a>
117
</p>
8+
</h3>
129

13-
[![NPM version][npm-image]][npm-url]
14-
[![Test coverage][codecov-image]][codecov-url]
15-
[![npm download][download-image]][download-url]
10+
# fast-bmp
1611

17-
</h3>
12+
[![NPM version](https://img.shields.io/npm/v/fast-bmp.svg)](https://www.npmjs.com/package/fast-bmp)
13+
[![npm download](https://img.shields.io/npm/dm/fast-bmp.svg)](https://www.npmjs.com/package/fast-bmp)
14+
[![test coverage](https://img.shields.io/codecov/c/github/image-js/fast-bmp.svg)](https://codecov.io/gh/image-js/fast-bmp)
15+
[![license](https://img.shields.io/npm/l/fast-bmp.svg)](https://github.com/image-js/fast-bmp/blob/main/LICENSE)
1816

19-
A library for encoding and decoding bmp image file format.
20-
References:
17+
A BMP image decoder and encoder.
2118

22-
- [Wikipedia BMP format page](https://en.wikipedia.org/wiki/BMP_file_format)
23-
- [Microsoft BMPV5 format page](https://learn.microsoft.com/en-us/windows/win32/api/wingdi/ns-wingdi-bitmapv5header)
19+
## Installation
2420

25-
# Supported features
21+
```console
22+
npm install fast-bmp
23+
```
24+
25+
## API
26+
27+
### [Complete API documentation](https://image-js.github.io/fast-bmp/)
28+
29+
### Supported features
2630

2731
This library only supports V5 headers.
2832

@@ -31,9 +35,7 @@ This library only supports V5 headers.
3135
- RGB (24-bits per pixel)
3236
- RGBA (32-bits per pixel)
3337

34-
# Usage
35-
36-
## Encoding
38+
### Encoding
3739

3840
```js
3941
import { encode } from 'fast-bmp';
@@ -59,7 +61,7 @@ const encoded = encode(imageData);
5961
fs.writeFileSync('image.bmp', encoded);
6062
```
6163

62-
## Decoding
64+
### Decoding
6365

6466
```ts
6567
import { decode } from 'fast-bmp';
@@ -93,9 +95,11 @@ yPixelsPerMeter: 2835,
9395
*/
9496
```
9597

96-
[npm-image]: https://img.shields.io/npm/v/fast-bmp.svg?style=flat-square
97-
[npm-url]: https://www.npmjs.com/package/fast-bmp
98-
[codecov-image]: https://img.shields.io/codecov/c/github/image-js/fast-bmp.svg?style=flat-square
99-
[codecov-url]: https://codecov.io/gh/image-js/fast-bmp
100-
[download-image]: https://img.shields.io/npm/dm/fast-bmp.svg?style=flat-square
101-
[download-url]: https://www.npmjs.com/package/fast-bmp
98+
## References
99+
100+
- [Wikipedia BMP format page](https://en.wikipedia.org/wiki/BMP_file_format)
101+
- [Microsoft BMPV5 format page](https://learn.microsoft.com/en-us/windows/win32/api/wingdi/ns-wingdi-bitmapv5header)
102+
103+
## License
104+
105+
[MIT](./LICENSE)

babel.config.js

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

eslint.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { defineConfig, globalIgnores } from 'eslint/config';
2+
import cheminfo from 'eslint-config-cheminfo-typescript';
3+
4+
export default defineConfig(globalIgnores(['coverage', 'lib']), cheminfo);

eslint.config.mjs

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

package.json

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,49 @@
11
{
22
"name": "fast-bmp",
33
"version": "3.0.0",
4-
"description": "A bmp image encoder",
5-
"main": "./lib/index.js",
6-
"module": "./lib-esm/index.js",
7-
"types": "./lib/index.d.ts",
8-
"repository": "[email protected]:image-js/fast-bmp.git",
9-
"author": "Daniel Kostro <[email protected]>",
104
"license": "MIT",
5+
"description": "A BMP image decoder and encoder",
6+
"author": "Daniel Kostro",
7+
"type": "module",
8+
"exports": "./lib/index.js",
119
"files": [
12-
"src",
1310
"lib",
14-
"lib-esm"
11+
"src"
1512
],
13+
"scripts": {
14+
"check-types": "tsc --noEmit",
15+
"clean": "rimraf coverage lib",
16+
"eslint": "eslint .",
17+
"eslint-fix": "eslint --fix .",
18+
"prepack": "npm run tsc",
19+
"prettier": "prettier --check .",
20+
"prettier-write": "prettier --write .",
21+
"test": "npm run test-only && npm run check-types && npm run eslint && npm run prettier",
22+
"test-only": "vitest run --coverage",
23+
"test-write": "FAST_BMP_WRITE_DATA_FILES=1 npm run test-only",
24+
"tsc": "npm run clean && npm run tsc-build",
25+
"tsc-build": "tsc --project tsconfig.build.json"
26+
},
1627
"dependencies": {
17-
"iobuffer": "^5.4.0"
28+
"iobuffer": "^6.0.0"
1829
},
1930
"devDependencies": {
20-
"@babel/plugin-transform-modules-commonjs": "^7.26.3",
21-
"@babel/preset-typescript": "^7.26.0",
22-
"@types/jest": "^29.5.14",
23-
"eslint": "^9.21.0",
24-
"eslint-config-cheminfo-typescript": "^17.0.0",
25-
"jest": "^29.1.1",
26-
"prettier": "^2.7.1",
31+
"@types/node": "^24.0.1",
32+
"@vitest/coverage-v8": "^3.2.3",
33+
"@zakodium/tsconfig": "^1.0.1",
34+
"eslint": "^9.29.0",
35+
"eslint-config-cheminfo-typescript": "^18.0.1",
36+
"prettier": "^3.5.3",
2737
"rimraf": "^6.0.1",
28-
"typescript": "^5.8.2"
38+
"typescript": "^5.8.3",
39+
"vitest": "^3.2.3"
2940
},
30-
"scripts": {
31-
"eslint": "eslint src",
32-
"eslint-fix": "eslint --fix src",
33-
"prettier": "prettier --check src",
34-
"prettier-write": "prettier --write src",
35-
"test": "npm run test-only && npm run eslint && npm run prettier && npm run check-types",
36-
"test-only": "jest --coverage",
37-
"test-write": "FAST_BMP_WRITE_DATA_FILES=1 npm run test-only",
38-
"check-types": "tsc --noEmit",
39-
"clean": "rimraf lib lib-esm",
40-
"prepack": "npm run tsc",
41-
"tsc": "npm run clean && npm run tsc-cjs && npm run tsc-esm",
42-
"tsc-cjs": "tsc --project tsconfig.cjs.json",
43-
"tsc-esm": "tsc --project tsconfig.esm.json"
41+
"repository": {
42+
"type": "git",
43+
"url": "git+https://github.com/image-js/fast-bmp.git"
44+
},
45+
"bugs": {
46+
"url": "https://github.com/image-js/fast-bmp/issues"
4447
},
45-
"jest": {
46-
"testEnvironment": "node"
47-
}
48+
"homepage": "https://image-js.github.io/fast-bmp/"
4849
}

src/.npmignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
__tests__
2+
.npmignore

0 commit comments

Comments
 (0)