Skip to content

Commit bc8f635

Browse files
Feature node 22 (#158)
* Use node 22 natives * remove babel, chai, nyc, mocha and nodemon * add module type to package * update package * update actions Co-authored-by: Minttu Hurme <[email protected]>
1 parent 50d44de commit bc8f635

File tree

14 files changed

+1319
-8104
lines changed

14 files changed

+1319
-8104
lines changed

.github/workflows/melinda-node-tests.yml renamed to .github/workflows/melinda-node-tests-and-publish.yml

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,25 @@ name: Melinda node tests
44

55
on: push
66

7+
permissions:
8+
id-token: write # Required for OIDC
9+
contents: read
10+
711
jobs:
812
build-node-versions:
913
name: Node version matrix
1014
runs-on: ubuntu-latest
1115

1216
strategy:
1317
matrix:
14-
node-version: [18.x, 20.x, 22.x, 23.x]
18+
node-version: [22.x, 24.x]
1519
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
1620

1721
steps:
1822
- name: Checkout the code
19-
uses: actions/checkout@v4
23+
uses: actions/checkout@v5
2024
- name: Use Node.js ${{ matrix.node-version }}
21-
uses: actions/setup-node@v4
25+
uses: actions/setup-node@v6
2226
with:
2327
node-version: ${{ matrix.node-version }}
2428
cache: 'npm'
@@ -32,20 +36,22 @@ jobs:
3236
license-scan:
3337
name: License compliance check
3438
runs-on: ubuntu-latest
39+
container: node:22
3540

3641
steps:
37-
- uses: actions/checkout@v4
38-
- uses: mikaelvesavuori/license-compliance-action@v1.0.2
42+
- uses: actions/checkout@v5
43+
- uses: mikaelvesavuori/license-compliance-action@v1
3944
with:
4045
exclude_pattern: /^@natlibfi/
4146

4247
njsscan:
4348
name: Njsscan check
4449
runs-on: ubuntu-latest
50+
container: node:22
4551

4652
steps:
4753
- name: Checkout the code
48-
uses: actions/checkout@v4
54+
uses: actions/checkout@v5
4955
- name: nodejsscan scan
5056
id: njsscan
5157
uses: ajinabraham/njsscan-action@master
@@ -54,17 +60,27 @@ jobs:
5460

5561
publish:
5662
runs-on: ubuntu-latest
63+
container: node:22
5764
needs: [build-node-versions, njsscan]
5865
if: contains(github.ref, 'refs/tags/')
5966

6067
steps:
61-
- uses: actions/checkout@v4
68+
- uses: actions/checkout@v5
6269
# Setup .npmrc file to publish to npm
63-
- uses: actions/setup-node@v4
70+
- name: Prepare node for publish
71+
uses: actions/setup-node@v6
6472
with:
6573
node-version: '22.x'
6674
registry-url: 'https://registry.npmjs.org'
67-
- run: npm ci
68-
- run: npm publish
69-
env:
70-
NODE_AUTH_TOKEN: ${{ secrets.MARC_RECORD_JS_NPM_TOKEN }}
75+
- name: Update npm
76+
run: npm install -g npm@latest
77+
- name: Clean install
78+
run: npm ci
79+
# Publish stable release with --tag latest
80+
- name: Publish stable release
81+
if: ${{!contains(github.ref, '-alpha')}}
82+
run: npm publish --tag=latest
83+
# Publish pre-release without --tag latest
84+
- name: Publish pre-release
85+
if: contains(github.ref, '-alpha')
86+
run: npm publish --tag=next

eslint.config.mjs

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Eslint configuration object for src
2+
const configSrc = {
3+
files: [
4+
"src/*"
5+
],
6+
linterOptions: {
7+
reportUnusedDisableDirectives: true,
8+
},
9+
rules: {
10+
"no-console": "warn",
11+
"eqeqeq": ["error", "always"],
12+
"no-const-assign": "error",
13+
"max-depth": ["warn", 4],
14+
"max-lines": ["warn", 500],
15+
"max-lines-per-function": ["warn", {"max": 100}],
16+
"no-else-return": ["error", {allowElseIf: false}],
17+
"no-plusplus": [
18+
"error",
19+
{
20+
"allowForLoopAfterthoughts": true
21+
}
22+
],
23+
"array-callback-return": [
24+
"error",
25+
{
26+
"checkForEach": true
27+
}
28+
],
29+
"no-unused-vars": [
30+
"error",
31+
{
32+
"argsIgnorePattern": "next"
33+
}
34+
],
35+
"no-warning-comments": "off"
36+
}
37+
};
38+
39+
// Eslint configuration object for globally ignoring .js files
40+
// - ignore all files that start with a dot
41+
// - ignore all files inside directories named 'dist'
42+
const configIgnores = {
43+
ignores: [
44+
"**/.*",
45+
"**/dist/"
46+
]
47+
};
48+
49+
export default [
50+
configSrc,
51+
configIgnores
52+
];

0 commit comments

Comments
 (0)