Skip to content

Commit 9fef561

Browse files
fix: tests, remove old dependencies (#103)
* fix: tests, remove old dependencies * chore: update gh action * chore: update publish * chore: use pnpm cache
1 parent d7bb11f commit 9fef561

File tree

10 files changed

+3649
-18025
lines changed

10 files changed

+3649
-18025
lines changed

.eslintrc.js

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

.github/workflows/publish.yaml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,23 @@ on:
77

88
jobs:
99
build:
10+
env:
11+
CI: true
1012
runs-on: ubuntu-latest
1113
steps:
1214
- uses: actions/checkout@v4
15+
- uses: pnpm/action-setup@v4
16+
name: Install pnpm
17+
with:
18+
version: 9
1319
- uses: actions/setup-node@v4
1420
with:
15-
node-version: 20
21+
node-version: 22
22+
cache: 'pnpm'
1623
- name: Install dependencies
17-
env:
18-
CI: true
19-
run: npm install
24+
run: pnpm install
2025
- name: Test
21-
run: npm test
26+
run: pnpm test
2227
- name: Publish
2328
if: success()
2429
env:

.github/workflows/pull-request.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,20 @@ name: Pull Request
33

44
jobs:
55
test:
6+
env:
7+
CI: true
68
runs-on: ubuntu-latest
79
steps:
810
- uses: actions/checkout@v4
11+
- uses: pnpm/action-setup@v4
12+
name: Install pnpm
13+
with:
14+
version: 9
915
- uses: actions/setup-node@v4
1016
with:
11-
node-version: 20
17+
node-version: 22
18+
cache: 'pnpm'
1219
- name: Install dependencies
13-
env:
14-
CI: true
15-
run: npm ci
20+
run: pnpm install
1621
- name: Test
17-
run: npm test
22+
run: pnpm test

biome.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.7.3/schema.json",
3+
"organizeImports": {
4+
"enabled": true
5+
},
6+
"vcs": {
7+
"clientKind": "git",
8+
"enabled": true,
9+
"useIgnoreFile": true
10+
},
11+
"linter": {
12+
"enabled": true,
13+
"rules": {
14+
"recommended": false
15+
}
16+
},
17+
"formatter": {
18+
"enabled": true,
19+
"formatWithErrors": false,
20+
"ignore": [],
21+
"indentStyle": "space",
22+
"indentWidth": 2,
23+
"lineEnding": "lf",
24+
"lineWidth": 120
25+
},
26+
"javascript": {
27+
"formatter": {
28+
"quoteStyle": "single",
29+
"semicolons": "asNeeded"
30+
}
31+
},
32+
"json": {
33+
"formatter": {
34+
"indentStyle": "space"
35+
}
36+
}
37+
}

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const fs = require('fs')
2-
const path = require('path')
1+
const fs = require('node:fs')
2+
const path = require('node:path')
33
const { default: mi18n } = require('mi18n')
44

55
const langFiles = fs.readdirSync(__dirname).reduce((acc, lang) => {
@@ -8,7 +8,7 @@ const langFiles = fs.readdirSync(__dirname).reduce((acc, lang) => {
88
}
99
const langFile = fs.readFileSync(path.resolve(__dirname, lang)).toString()
1010
const fileName = path.basename(lang)
11-
const locale = fileName.substr(0, fileName.indexOf('.'))
11+
const locale = fileName.substring(0, fileName.indexOf('.'))
1212
acc[locale] = mi18n.processFile(langFile)
1313
return acc
1414
}, {})

index.test.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const { test } = require('node:test')
2+
const assert = require('node:assert')
3+
const { glob } = require('node:fs')
4+
5+
const langFiles = require('./index')
6+
7+
glob('*.lang', (err, matches) => {
8+
if (err) {
9+
console.error(err)
10+
return
11+
}
12+
const localeCount = matches.length
13+
14+
test(`should contain ${localeCount} languages`, () => {
15+
assert.equal(Object.keys(langFiles).length, localeCount)
16+
})
17+
18+
test('should contain specific languages', () => {
19+
const expectedLocales = matches.map((lang) => lang.substring(0, lang.indexOf('.')))
20+
21+
for (const lang of expectedLocales) {
22+
assert.equal(Object.hasOwn(langFiles, lang), true)
23+
}
24+
})
25+
})

0 commit comments

Comments
 (0)