Skip to content

Commit 95a0e25

Browse files
Merge pull request #1810 from Gauravjeetsingh/upgrade-node
Update dependencies to work with node 18
2 parents 08014f8 + dc143a2 commit 95a0e25

28 files changed

+15374
-20244
lines changed

.babelrc.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ const alias = require('./webpack.config').resolve.alias;
22

33
const plugins = [
44
'@babel/plugin-syntax-dynamic-import',
5-
'@babel/plugin-proposal-object-rest-spread',
6-
'@babel/plugin-proposal-class-properties',
7-
'@babel/transform-runtime'
5+
'@babel/plugin-transform-object-rest-spread',
6+
'@babel/plugin-transform-class-properties',
7+
'@babel/transform-runtime',
88
];
99

1010
const presets = [
@@ -25,18 +25,18 @@ const presets = [
2525
module.exports = {
2626
env: {
2727
production: {
28-
presets: presets.map(preset =>
28+
presets: presets.map((preset) =>
2929
preset[0] !== '@babel/preset-env'
3030
? preset
3131
: [
32-
'@babel/preset-env',
33-
{
34-
targets: {
35-
browsers: ['ie 11', 'safari 9'],
32+
'@babel/preset-env',
33+
{
34+
targets: {
35+
browsers: ['ie 11', 'safari 9'],
36+
},
37+
modules: false,
3638
},
37-
modules: false,
38-
},
39-
]
39+
]
4040
),
4141
plugins: plugins.concat([
4242
[

.eslintrc

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,47 @@
11
{
2-
"parser": "babel-eslint",
2+
"parser": "@babel/eslint-parser",
3+
"parserOptions": {
4+
"requireConfigFile": false,
5+
"babelOptions": {
6+
"presets": ["@babel/preset-react", "@babel/preset-typescript"]
7+
}
8+
},
39
"extends": [
410
"eslint:recommended",
5-
"plugin:react/recommended"
11+
"plugin:react/recommended",
12+
"plugin:@typescript-eslint/recommended"
13+
],
14+
"plugins": [
15+
"react",
16+
"@typescript-eslint"
617
],
718
"env": {
819
"es6": true,
920
"browser": true,
1021
"node": true,
1122
"jest": true
12-
}
23+
},
24+
"settings": {
25+
"react": {
26+
"version": "detect"
27+
}
28+
},
29+
"rules": {
30+
"@typescript-eslint/no-unused-vars": "error",
31+
"@typescript-eslint/no-explicit-any": "warn",
32+
"react/prop-types": "off"
33+
},
34+
"overrides": [
35+
{
36+
"files": ["*.ts", "*.tsx"],
37+
"parser": "@typescript-eslint/parser",
38+
"parserOptions": {
39+
"ecmaVersion": 2020,
40+
"sourceType": "module",
41+
"ecmaFeatures": {
42+
"jsx": true
43+
}
44+
}
45+
}
46+
]
1347
}

.github/workflows/dev-sttm-web-AutoDeployTrigger-20952253-f106-4264-a850-1a8fd6340281.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,21 @@ name: Trigger auto deployment for dev-sttm-web
44
on:
55
# Automatically trigger it when detected changes in repo
66
push:
7-
branches:
8-
[ dev ]
7+
branches: [dev]
98
paths:
10-
- '**'
11-
- '.github/workflows/dev-sttm-web-AutoDeployTrigger-20952253-f106-4264-a850-1a8fd6340281.yml'
9+
- '**'
10+
- '.github/workflows/dev-sttm-web-AutoDeployTrigger-20952253-f106-4264-a850-1a8fd6340281.yml'
1211

13-
# Allow manual trigger
14-
workflow_dispatch:
12+
# Allow manual trigger
13+
workflow_dispatch:
1514

1615
env:
1716
NODE_ENV: development
1817

1918
jobs:
2019
build-and-deploy:
2120
runs-on: ubuntu-latest
22-
permissions:
21+
permissions:
2322
id-token: write #This is required for requesting the OIDC JWT Token
2423
contents: read #Required when GH token is used to authenticate with private repo
2524

@@ -45,5 +44,5 @@ jobs:
4544
containerAppName: dev-sttm-web
4645
resourceGroup: devops
4746
imageToBuild: khalis.azurecr.io/dev-sttm-web:${{ github.sha }}
48-
_buildArgumentsKey_: |
47+
buildArguments: |
4948
NODE_ENV=development

.github/workflows/sttm-web-container-AutoDeployTrigger-fe063408-abd2-49aa-a2a4-d66a6e18443b.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,21 @@ name: Trigger auto deployment for sttm-web-container
44
on:
55
# Automatically trigger it when detected changes in repo
66
push:
7-
branches:
8-
[ master ]
7+
branches: [master]
98
paths:
10-
- '**'
11-
- '.github/workflows/sttm-web-container-AutoDeployTrigger-fe063408-abd2-49aa-a2a4-d66a6e18443b.yml'
9+
- '**'
10+
- '.github/workflows/sttm-web-container-AutoDeployTrigger-fe063408-abd2-49aa-a2a4-d66a6e18443b.yml'
1211

13-
# Allow manual trigger
14-
workflow_dispatch:
12+
# Allow manual trigger
13+
workflow_dispatch:
1514

1615
env:
1716
NODE_ENV: production
1817

1918
jobs:
2019
build-and-deploy:
2120
runs-on: ubuntu-latest
22-
permissions:
21+
permissions:
2322
id-token: write #This is required for requesting the OIDC JWT Token
2423
contents: read #Required when GH token is used to authenticate with private repo
2524

@@ -45,7 +44,5 @@ jobs:
4544
containerAppName: sttm-web-container
4645
resourceGroup: devops
4746
imageToBuild: khalis.azurecr.io/sttm-web-container:${{ github.sha }}
48-
_buildArgumentsKey_: |
47+
buildArguments: |
4948
NODE_ENV=production
50-
51-

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:14.21.3
1+
FROM node:18
22

33
# Set working directory
44
WORKDIR /app
@@ -16,10 +16,10 @@ RUN apt-get update && apt-get install -y default-mysql-client
1616
COPY . .
1717

1818
# Install dependencies
19-
RUN npm install --legacy-peer-deps
19+
RUN npm install
2020

2121
# Set the environment and expose your app port
22-
ARG NODE_ENV=production
22+
ARG NODE_ENV
2323
RUN echo "Build argument NODE_ENV value: $NODE_ENV"
2424
ENV NODE_ENV=$NODE_ENV
2525
RUN echo "Environment variable NODE_ENV value: $NODE_ENV"

common/api-urls-constants.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
const isProduction = process.env.NODE_ENV === 'production';
22

33
module.exports = {
4-
BANIS: isProduction ? '//api.banidb.com/v2/banis' : "//api.khajana.org/v2/banis",
4+
BANIS: isProduction
5+
? '//api.banidb.com/v2/banis'
6+
: '//api.khajana.org/v2/banis',
57
PRODUCTION: '//api.banidb.com/v2/',
68
DEVELOPMENT: '//api.khajana.org/v2/',
79
AMRIT_KEERTAN: '//api.banidb.com/v2/amritkeertan',
@@ -16,4 +18,4 @@ module.exports = {
1618
WRITERS: '//api.banidb.com/v2/writers/',
1719
GURBANIBOT: '//gurbanichatbot.sikhitothemax.org/',
1820
SP_API: '//serviceprovider.khalis.net',
19-
};
21+
};

common/constants.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
2-
const API_URLS_CONSTANTS = require('./api-urls-constants');
1+
import API_URLS_CONSTANTS from './api-urls-constants';
32
const isProduction = process.env.NODE_ENV === 'production';
43
export const DARK_MODE_COOKIE = 'darkmode';
54
export const DARK_MODE_CLASS_NAME = 'dark-mode';
@@ -11,4 +10,6 @@ export const OFFLINE_COLOR = '#333333';
1110

1211
export const BASIC_META_DESCRIPTION = `Search Sri Guru Granth Sahib Jee, Sri Dasam Granth Sahib, Bhai Gurdas Vaar, Bhai Nandlal Vaar, Bhai Gurdas Singh Vaar, Tankhanaama, Zafarnaama, Amrit Kirtan.`;
1312

14-
export const API_URL = isProduction ? API_URLS_CONSTANTS.PRODUCTION : API_URLS_CONSTANTS.DEVELOPMENT;
13+
export const API_URL = isProduction
14+
? API_URLS_CONSTANTS.PRODUCTION
15+
: API_URLS_CONSTANTS.DEVELOPMENT;

jest.config.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
module.exports = {
2-
testURL: 'http://localhost:8080',
2+
testEnvironmentOptions: {
3+
url: 'http://localhost:8080',
4+
environment: 'jest-environment-jsdom-sixteen',
5+
},
6+
verbose: true,
7+
setupFiles: ['<rootDir>/jest/setupTest.js'],
38
collectCoverage: true,
49
// since we moved config to a deeper folder, we are specifying what <rootDir> should now point to.
510
rootDir: './',
@@ -11,7 +16,5 @@ module.exports = {
1116
testPathIgnorePatterns: ['/node_modules/', '<rootDir>/cypress/*'],
1217
preset: 'ts-jest',
1318
testEnvironment: 'jsdom',
14-
setupFiles: [
15-
"<rootDir>/jest/setupTest.js"
16-
]
19+
setupFiles: ['<rootDir>/jest/setupTest.js'],
1720
};

jest/setupTest.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
// Mock data and helper methods
2-
window.HTMLMediaElement.prototype.load = () => { /* do nothing */ };
3-
window.HTMLMediaElement.prototype.play = () => { /* do nothing */ };
4-
window.HTMLMediaElement.prototype.pause = () => { /* do nothing */ };
2+
window.HTMLMediaElement.prototype.load = () => {
3+
/* do nothing */
4+
};
5+
window.HTMLMediaElement.prototype.play = () => {
6+
/* do nothing */
7+
};
8+
window.HTMLMediaElement.prototype.pause = () => {
9+
/* do nothing */
10+
};

0 commit comments

Comments
 (0)