Skip to content

Commit 2a99694

Browse files
Setup bun and biome + bump dmv version (#227)
* Use bun * CR Updates * Bump version to 0.48.18 * Add biome and format code * Fix build script * Add lint and format * Use bun latest * Fix typo
1 parent d24cc0a commit 2a99694

54 files changed

Lines changed: 4324 additions & 10056 deletions

Some content is hidden

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

.github/workflows/publish.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- uses: actions/checkout@v4
11-
- uses: actions/setup-node@v4
11+
- uses: oven-sh/setup-bun@v2
1212
with:
13-
node-version: "22.x"
14-
registry-url: "https://registry.npmjs.org"
15-
- run: yarn install --frozen-lockfile
13+
bun-version: latest
14+
- run: bun install --frozen-lockfile
1615
- run: npm publish --access public
1716
env:
1817
NODE_AUTH_TOKEN: ${{ secrets.NPM_DMV_GRANULAR }}

.github/workflows/unit-tests.yml

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,18 @@ jobs:
1010
build:
1111
name: Build and run tests
1212
runs-on: ubuntu-latest
13-
14-
strategy:
15-
matrix:
16-
node-version: ["18.x", "24.x"]
1713

1814
steps:
19-
- uses: actions/checkout@v2
20-
- name: Set up Node ${{ matrix.node-version }}
21-
uses: actions/setup-node@v4
15+
- uses: actions/checkout@v4
16+
- name: Set up Bun (latest stable)
17+
uses: oven-sh/setup-bun@v2
2218
with:
23-
node-version: ${{ matrix.node-version }}
24-
cache: "yarn"
19+
bun-version: latest
2520
- name: Install dependencies
26-
run: yarn
21+
run: bun install --frozen-lockfile
2722
- name: Build package in production mode
28-
run: yarn build
23+
run: bun run build
2924
- name: Lint with standard
30-
run: yarn lint
25+
run: bun run lint
3126
- name: Test with jest
32-
run: yarn test
27+
run: bun run test

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,4 @@ dist/
7272
.env.production.local
7373
*~
7474
*.swp
75-
bun.lock
7675
*workspace

.husky/pre-commit

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env sh
2+
# Block commit if lint or format fails (biome check runs both)
3+
bun run lint

.travis.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ node_js:
44

55
sudo: false
66

7+
before_install:
8+
- curl -fsSL https://bun.sh/install | bash
9+
- export BUN_INSTALL="$HOME/.bun" && export PATH="$BUN_INSTALL/bin:$PATH"
10+
711
script:
8-
- npm install
9-
- npm run build
10-
- npm test
12+
- bun install --frozen-lockfile
13+
- bun run build
14+
- bun run test

CONTRIBUTING.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ Private functions shall be named with a leading underscore (e.g., `_myPrivateFun
1414
## Coding style
1515

1616
The library is implemented in JavaScript using the [6th Edition of the ECMAScript Language Specification (ES6)](https://262.ecma-international.org/6.0/) or later.
17-
Source code is linted using [standard](https://github.com/standard/standard) (based on [eslint](https://eslint.org/)).
17+
Source code is linted and formatted using [Biome](https://biomejs.dev/). Semicolons are not used at the end of statements (Biome uses `asNeeded`).
1818

19-
Use the following command to identify potential coding style and type annotation violations:
19+
Use the following commands to check and fix style:
2020

21-
$ npm run lint
21+
$ bun run lint # check for issues
22+
$ bun run lint:fix # auto-fix issues
23+
$ bun run fmt # format code
2224

2325
Docstrings are written in [JSDoc](https://jsdoc.app/) format:
2426

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ Please cite the following article when using the viewer for scientific studies:
113113

114114
## Installation
115115

116-
Install the [dicom-microscopy-viewer](https://www.npmjs.com/package/dicom-microscopy-viewer) package using the `npm` package manager:
116+
Install the [dicom-microscopy-viewer](https://www.npmjs.com/package/dicom-microscopy-viewer) package using the `bun` package manager:
117117

118118
```None
119-
npm install dicom-microscopy-viewer
119+
bun add dicom-microscopy-viewer
120120
```
121121

122122
## Development & Testing
@@ -133,20 +133,20 @@ cd dicom-microscopy-viewer
133133
Install dependencies and build the package:
134134

135135
```None
136-
npm install
137-
npm run build
136+
bun install
137+
bun run build
138138
```
139139

140140
Run tests:
141141

142142
```None
143-
npm run test
143+
bun run test
144144
```
145145

146146
Build the API documentation:
147147

148148
```None
149-
npm run generateDocs
149+
bun run generateDocs
150150
```
151151

152152
## Support

biome.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/2.3.13/schema.json",
3+
"vcs": {
4+
"enabled": true,
5+
"clientKind": "git",
6+
"useIgnoreFile": true
7+
},
8+
"files": {
9+
"includes": [
10+
"src/**/*.js",
11+
"config/**/*.js",
12+
"!src/__mocks__",
13+
"!src/annotations/_AnnotationManager.test.js",
14+
"!src/annotations/markups/_MarkupManager.test.js",
15+
"!src/dictionary.js",
16+
"!src/**/*.test.js",
17+
"!!dist",
18+
"!!docs",
19+
"!!build",
20+
"!!test"
21+
]
22+
},
23+
"formatter": {
24+
"enabled": true,
25+
"indentStyle": "space",
26+
"indentWidth": 2
27+
},
28+
"javascript": {
29+
"formatter": {
30+
"semicolons": "asNeeded",
31+
"quoteStyle": "single"
32+
}
33+
},
34+
"linter": {
35+
"enabled": true,
36+
"rules": {
37+
"recommended": true
38+
}
39+
}
40+
}

bun.lock

Lines changed: 1888 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/webpack/merge.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@ const _ = require('lodash')
33
// Merge two objects
44
// Instead of merging array objects index by index (n-th source
55
// item with n-th object item) it concatenates both arrays
6-
module.exports = function (object, source) {
6+
module.exports = (object, source) => {
77
const clone = _.cloneDeep(object)
8-
const merged = _.mergeWith(clone, source, function (objValue, srcValue, key, object, source, stack) {
9-
if (objValue && srcValue && _.isArray(objValue) && _.isArray(srcValue)) {
10-
return _.concat(objValue, srcValue)
11-
}
12-
})
8+
const merged = _.mergeWith(
9+
clone,
10+
source,
11+
(objValue, srcValue, _key, _object, _source, _stack) => {
12+
if (objValue && srcValue && _.isArray(objValue) && _.isArray(srcValue)) {
13+
return _.concat(objValue, srcValue)
14+
}
15+
},
16+
)
1317

1418
return merged
1519
}

0 commit comments

Comments
 (0)