Skip to content

Commit 6f45c21

Browse files
authored
chore(mojaloop/#3458): nodejs upgrade (#244)
chore(mojaloop/#3458): NodeJS version upgrade - mojaloop/project#3458 - Upgraded nodejs from v16 to v18 LTS - Applied CI changes as previously implemented in [sdk-scheme-adapter](mojaloop/sdk-scheme-adapter#453) - Updated NPM dependencies - Resolved all audit issues - Migrated `master` branch to `main` branch
1 parent e9bcfa6 commit 6f45c21

File tree

14 files changed

+3276
-4989
lines changed

14 files changed

+3276
-4989
lines changed

.circleci/config.yml

+212-141
Large diffs are not rendered by default.

.ncurc.yaml

+1-14
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,4 @@
11
## Add a TODO comment indicating the reason for each rejected dependency upgrade added to this list, and what should be done to resolve it (i.e. handle it through a story, etc).
22
reject: [
3-
# TODO: Upgrading ws is causing some incompatibility issues connecting to sdk-scheme-adapter ws server and causing some test failures
4-
"ws",
5-
# TODO: Upgrading axios is breaking lot of unit tests. It might be because of breaking changes in axios.
6-
"axios",
7-
# TODO: Upgrading jest is causing test failures
8-
"jest",
9-
# Upgrading `npm-check-updates` introduces rimraf>glob as a dependency that is under the BlueOak-1.0.0 licensing
10-
# which is still being investigated if it aligns with Mojaloop's policies.
11-
# An override is also in place for npm-check-updates>rimraf in package.json.
12-
# If you have trouble with package-lock.json not containing the override
13-
# delete BOTH node_modules/ and package-lock.json. Might be due to
14-
# https://github.com/npm/cli/issues/4232
15-
# This is a temporary fix until Mojaloop decides on Blue Oak licensing.
16-
"npm-check-updates",
173
]
4+

.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
16.15.0
1+
18.17.1

.versionrc.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module.exports = {
2+
header: '# Changelog: [mojaloop/thirdparty-api-svc](https://github.com/mojaloop/thirdparty-api-svc)',
3+
types: [
4+
{"type": "feat", "section": "Features"},
5+
{"type": "fix", "section": "Bug Fixes"},
6+
{"type": "docs", "section": "Documentation"},
7+
{"type": "style", "section": "Styling"},
8+
{"type": "refactor", "section": "Refactors"},
9+
{"type": "perf", "section": "Performance"},
10+
{"type": "test", "section": "Tests"},
11+
{"type": "build", "section": "Build System"},
12+
{"type": "ci", "section": "CI"},
13+
{"type": "chore", "section": "Chore"},
14+
{"type": "revert", "section": "Reverts"}
15+
]
16+
}

Dockerfile

+17-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
1-
FROM node:16.15.0-alpine as builder
1+
# Arguments
2+
ARG NODE_VERSION=lts-alpine
3+
4+
# NOTE: Ensure you set NODE_VERSION Build Argument as follows...
5+
#
6+
# export NODE_VERSION="$(cat .nvmrc)-alpine" \
7+
# docker build \
8+
# --build-arg NODE_VERSION=$NODE_VERSION \
9+
# -t mojaloop/sdk-scheme-adapter:local \
10+
# . \
11+
#
12+
13+
# Build Image
14+
FROM node:${NODE_VERSION} as builder
215

316
WORKDIR /opt/app
417

5-
RUN apk add --no-cache -t build-dependencies make gcc g++ python3 libtool libressl-dev openssl-dev autoconf automake \
6-
&& cd $(npm root -g)/npm \
7-
&& npm config set unsafe-perm true \
8-
&& npm install -g node-gyp
18+
RUN apk add --no-cache -t build-dependencies make gcc g++ python3 libtool openssl-dev autoconf automake \
19+
&& cd $(npm root -g)/npm
920

1021
COPY package.json package-lock.json* /opt/app/
1122
RUN npm ci
@@ -15,7 +26,7 @@ COPY spec_files /opt/app/spec_files
1526
COPY examples /opt/app/examples
1627
RUN mkdir /opt/app/uploads
1728

18-
FROM node:16.15.0-alpine
29+
FROM node:${NODE_VERSION}
1930
WORKDIR /opt/app
2031

2132
# Create a non-root user: ml-user

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ For Command line tool follow this [CLI User Guide](/documents/User-Guide-CLI.md)
8080

8181
## Auditing Dependencies
8282

83-
We use `npm-audit-resolver` along with `npm audit` to check dependencies for node vulnerabilities, and keep track of resolved dependencies with an `audit-resolve.json` file.
83+
We use `audit-ci` along with `npm audit` to check dependencies for node vulnerabilities, and keep track of resolved dependencies with an `audit-ci.jsonc` file.
8484

8585
To start a new resolution process, run:
8686

8787
```bash
88-
npm run audit:resolve
88+
npm run audit:fix
8989
```
9090

9191
You can then check to see if the CI will pass based on the current dependencies with:
@@ -94,7 +94,7 @@ You can then check to see if the CI will pass based on the current dependencies
9494
npm run audit:check
9595
```
9696

97-
And commit the changed `audit-resolve.json` to ensure that CircleCI will build correctly.
97+
The [audit-ci.jsonc](./audit-ci.jsonc) contains any audit-exceptions that cannot be fixed to ensure that CircleCI will build correctly.
9898

9999
## Container Scans
100100

@@ -112,8 +112,8 @@ As part of our CI/CD process, we use a combination of CircleCI, standard-version
112112
npm package and github-release CircleCI orb to automatically trigger our releases
113113
and image builds. This process essentially mimics a manual tag and release.
114114

115-
On a merge to master, CircleCI is configured to use the mojaloopci github account
115+
On a merge to main, CircleCI is configured to use the mojaloopci github account
116116
to push the latest generated CHANGELOG and package version number.
117117

118-
Once those changes are pushed, CircleCI will pull the updated master, tag and
118+
Once those changes are pushed, CircleCI will pull the updated main, tag and
119119
push a release triggering another subsequent build that also publishes a docker image.

audit-ci.jsonc

+6-11
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,13 @@
55
"moderate": true,
66
"allowlist": [
77
// TODO: multer lib is using some vulnerable dependency
8-
"GHSA-wm7h-9275-46v2",
9-
// postman-collection: no fix available
10-
"GHSA-mhxj-85r3-2x55",
11-
// multer: no fix available
12-
"GHSA-8qr4-xgw6-wmr3",
8+
"GHSA-wm7h-9275-46v2", // https://github.com/advisories/GHSA-wm7h-9275-46v2
139
// json web token, no fix available
14-
"GHSA-8cf7-32gw-wr33",
15-
"GHSA-8cf7-32gw-wr33",
16-
"GHSA-27h2-hvpr-p74q",
17-
"GHSA-qwph-4952-7xr6",
18-
"GHSA-hjrf-2m68-5959",
10+
"GHSA-8cf7-32gw-wr33", // https://github.com/advisories/GHSA-8cf7-32gw-wr33
11+
"GHSA-hjrf-2m68-5959", // https://github.com/advisories/GHSA-hjrf-2m68-5959
12+
"GHSA-qwph-4952-7xr6", // https://github.com/advisories/GHSA-qwph-4952-7xr6
1913
// request-provise-native, no fix available
20-
"GHSA-p8p7-x288-28g6"
14+
"GHSA-p8p7-x288-28g6", // https://github.com/advisories/GHSA-p8p7-x288-28g6
15+
"GHSA-72xf-g2v4-qvf3" // https://github.com/advisories/GHSA-72xf-g2v4-qvf3
2116
]
2217
}

0 commit comments

Comments
 (0)