Skip to content

Commit d89143d

Browse files
authored
Merge pull request #525 from bcgov/feat/system-upgrade
Feat/system upgrade
2 parents adcf1d0 + d6711ad commit d89143d

File tree

192 files changed

+9333
-11131
lines changed

Some content is hidden

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

192 files changed

+9333
-11131
lines changed

.eslintrc.js

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

.github/workflows/e2e.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
POSTGRES_PORT: 5432
4545
PGHOST: localhost
4646
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
47-
NODE_ENV: "development"
47+
VITE_NODE_ENV: "development"
4848
POSTGRES_URL: "postgresql://digmkt:digmkt@localhost:5432/digmkt"
4949
MAILER_GMAIL_USER: "fake@gmail.com"
5050
MAILER_GMAIL_PASS: "password"

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ repos:
1313
- id: end-of-file-fixer
1414
- id: trailing-whitespace
1515
- repo: https://github.com/pre-commit/mirrors-eslint
16-
rev: v8.48.0
16+
rev: v9.31.0
1717
hooks:
1818
- id: eslint
1919
additional_dependencies:
2020
[
21-
"eslint@8.48.0",
21+
"eslint@9.31.0",
2222
"eslint-plugin-react",
2323
"@typescript-eslint/eslint-plugin",
2424
"typescript",
@@ -45,7 +45,7 @@ repos:
4545
exclude: .*/tests/.*
4646
additional_dependencies: ["gibberish-detector"]
4747
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
48-
rev: v2.2.0
48+
rev: v9.22.0
4949
hooks:
5050
- id: commitlint
5151
stages: [commit-msg]

Dockerfile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
FROM --platform=linux/amd64 docker.io/node:16.19 AS dm_app_build
1+
FROM --platform=linux/amd64 docker.io/node:22 AS dm_app_build
22
ARG DIRPATH=/usr/app
33
WORKDIR $DIRPATH
44
COPY ./src $DIRPATH/src
5-
COPY package.json gruntfile.js yarn.lock tsconfig.json ./
5+
COPY package.json yarn.lock tsconfig.json vite.config.mts ./
66
COPY ./lib $DIRPATH/lib
7-
COPY ./grunt-configs ./grunt-configs
7+
88

99
# `yarn install` runs twice as a workaround for development and production
1010
# dependencies in package.json needing better taxonomy
1111

12-
# NODE_ENV=production is passed here to allow for specific dev env variables when NODE_ENV=development
12+
# VITE_NODE_ENV=production is passed here to allow for specific dev env variables when VITE_NODE_ENV=development
1313
# @see /src/back-end/config.ts::developmentMailerConfigOptions
1414
RUN yarn install --frozen-lockfile && \
15-
NODE_ENV=production npm run front-end:build && \
16-
npm run back-end:build && \
15+
VITE_NODE_ENV=production npm run front-end:build && \
16+
npm run back-end:build:production && \
1717
yarn install --frozen-lockfile --production && \
1818
yarn cache clean && \
1919
rm -Rf $DIRPATH/tmp && \
2020
mkdir $DIRPATH/__tmp
2121

22-
FROM --platform=linux/amd64 docker.io/node:16.19
22+
FROM --platform=linux/amd64 docker.io/node:22
2323
ARG DIRPATH=/usr/app
2424
WORKDIR $DIRPATH
2525
COPY --from=dm_app_build --chown=node $DIRPATH ./

README.md

Lines changed: 18 additions & 18 deletions
Large diffs are not rendered by default.

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ services:
1111
- "3000:3000"
1212
environment:
1313
POSTGRES_URL: postgresql://digmkt:digmkt@db:5432/digmkt
14-
NODE_ENV: ${NODE_ENV}
14+
VITE_NODE_ENV: ${VITE_NODE_ENV}
1515
depends_on:
1616
- db
1717

docs/build-deploy/openshift.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ oc -n ccc866-dev process -f openshift/templates/app/app-digmkt-deploy.yaml \
9999
-p TAG_NAME=dev \
100100
-p KEYCLOAK_CLIENT_SECRET=<secret> \
101101
-p KEYCLOAK_URL=https://dev.loginproxy.gov.bc.ca/auth \
102-
-p SHOW_TEST_INDICATOR=1 \
102+
-p VITE_SHOW_TEST_INDICATOR=1 \
103103
-p BASIC_AUTH_USERNAME=<username> \
104104
-p BASIC_AUTH_PASSWORD_HASH=<hashed_password> \
105105
-p ORIGIN=https://app-digmkt-dev.apps.silver.devops.gov.bc.ca \
@@ -113,7 +113,7 @@ oc -n ccc866-test process -f openshift/templates/app/app-digmkt-deploy.yaml \
113113
-p TAG_NAME=test \
114114
-p KEYCLOAK_CLIENT_SECRET=<secret> \
115115
-p KEYCLOAK_URL=https://test.loginproxy.gov.bc.ca/auth \
116-
-p SHOW_TEST_INDICATOR=1 \
116+
-p VITE_SHOW_TEST_INDICATOR=1 \
117117
-p ORIGIN=https://app-digmkt-test.apps.silver.devops.gov.bc.ca \
118118
-p HOST=app-digmkt-test.apps.silver.devops.gov.bc.ca \
119119
-p BASIC_AUTH_USERNAME=<username> \
@@ -127,7 +127,7 @@ oc -n ccc866-prod process -f openshift/templates/app/app-digmkt-deploy.yaml \
127127
-p TAG_NAME=prod \
128128
-p KEYCLOAK_CLIENT_SECRET=<secret> \
129129
-p KEYCLOAK_URL=https://loginproxy.gov.bc.ca/auth \
130-
-p SHOW_TEST_INDICATOR=0 \
130+
-p VITE_SHOW_TEST_INDICATOR=0 \
131131
-p ORIGIN=https://marketplace.digital.gov.bc.ca \
132132
-p HOST=marketplace.digital.gov.bc.ca \
133133
-p DATABASE_SERVICE_NAME=patroni-pg12 | oc -n ccc866-prod apply -f -

docs/local-development/debug-config.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ It is difficult to debug/step-through front-end code so the recommendation is to
77
The module aliasing (e.g. import * from "shared/...") is what throws off most debuggers and build tools. Usually `tsconfig` files are used by debuggers and you may need to create a separate tsconfig for your local environment so that the IDE knows how to run your app.
88

99
## Alternatives
10-
Another solution is to configure grunt to emit source maps alongside JS and just debug the JS.
10+
Another solution is to configure TypeScript to emit source maps alongside JS and just debug the JS.
1111

1212
## Front-end
1313
Debugging the front-end might require evaluating MSG's in the state object.
@@ -17,7 +17,7 @@ Debugging the front-end might require evaluating MSG's in the state object.
1717
- dev tools in the browser
1818

1919
1. Run the following
20-
`NODE_ENV=development npm run front-end:watch`
20+
`VITE_NODE_ENV=development npm run front-end:watch`
2121

2222
2. Open the Console of a browser's Dev Tools to view a list of state events.
2323

@@ -85,7 +85,7 @@ Debugging the front-end might require evaluating MSG's in the state object.
8585

8686
Run the following for normal development:
8787
```bash
88-
NODE_ENV=development npm run back-end:watch
88+
VITE_NODE_ENV=development npm run back-end:watch
8989
```
9090

9191
This will display server logs:

docs/onboarding.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Developer Onboarding
22

3-
The Digital Marketplace web application has been implemented as a full stack, TypeScript web application. Its codebase has been split into three parts: back-end, front-end and shared. This repository uses grunt to implement various build tasks for both local development and hosted environments. Developers can build and run these codebases by running the scripts defined in `package.json`.
3+
The Digital Marketplace web application has been implemented as a full stack, TypeScript web application. Its codebase has been split into three parts: back-end, front-end and shared. This repository uses Vite and Typescript to implement various build tasks for both local development and hosted environments. Developers can build and run these codebases by running the scripts defined in `package.json`.
44

55
## Back-End Overview
66

@@ -46,19 +46,18 @@ To better understand the front-end architecture, it is recommended that develope
4646

4747
## Build System
4848

49-
The front-end is built using tasks defined with Grunt. This includes:
49+
The front-end is built using Vite. This includes:
5050

5151
1. Compiling the TypeScript codebase to JavaScript.
52-
2. Combining the JavaScript build output to a single file using Browserify.
53-
3. Transpiling SASS styles to CSS.
54-
4. Compiling EJS templates to HTML.
55-
5. Copying static assets to the build directory.
56-
6. Minifying JavaScript, CSS and HTML assets for production builds only.
57-
7. Compressing static assets using gzip and brotli for production builds only.
52+
2. Bundling JavaScript modules with Rollup.
53+
3. Processing CSS and SASS styles.
54+
4. Handling static assets and HTML templates.
55+
5. Minifying JavaScript, CSS and HTML assets for production builds.
56+
6. Compressing static assets using gzip and brotli for production builds.
5857

5958
All commonly-used build scripts are aliased as NPM scripts in `package.json` for convenience.
6059

61-
To build the front-end, simply run `NODE_ENV=development npm run front-end:build`. To build the app for production, which includes asset minification, optimization and compression, change the value of `NODE_ENV` to `production`.
60+
To build the front-end, simply run `npm run front-end:build` which builds for production with asset minification, optimization and compression.
6261

6362
To watch for source file changes and rebuild the front-end during local development, execute the `npm run front-end:watch` command in your terminal.
6463

@@ -99,9 +98,9 @@ The `npm run migrations:*` scripts in `package.json` are how developers can crea
9998

10099
## Build/Execution System
101100

102-
The back-end is compiled from TypeScript to JavaScript, which is implemented as a Grunt task.
101+
The back-end is compiled from TypeScript to JavaScript using the TypeScript compiler directly.
103102

104-
To build the back-end, simply run `NODE_ENV=development npm run back-end:build`. To build the app for production, which involves cleaning the build directory before rebuilding, change the value of `NODE_ENV` to `production`.
103+
To build the back-end, simply run `npm run back-end:build`. To build the app for production, which involves cleaning the build directory before rebuilding, run `npm run back-end:build:production`.
105104

106105
To watch for source file changes and rebuild the back-end during local development, execute the `npm run back-end:watch` command in your terminal.
107106

@@ -112,7 +111,7 @@ To watch for source file changes and rebuild the back-end during local developme
112111
| Path | Description |
113112
| ------------------ | ---------------------------------------------------------------------------------------------------- |
114113
| `build/` | Directory containing all final build artifacts. Ignored by `git`. |
115-
| `grunt-configs/` | Directory containing `grunt` task configurations. |
114+
116115
| `tmp` | Directory containing all intermediary build artifacts. Ignored by `git`. |
117116
| `.eslintrc.js` | `eslint` configuration file for automated code linting. |
118117
| `.prettierrc.json` | `prettierrc` configuration file for automated code formatting. |

eslint.config.js

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import js from "@eslint/js";
2+
import reactPlugin from "eslint-plugin-react";
3+
import typescriptPlugin from "@typescript-eslint/eslint-plugin";
4+
import typescriptParser from "@typescript-eslint/parser";
5+
import cypressPlugin from "eslint-plugin-cypress";
6+
import globals from "globals";
7+
8+
export default [
9+
// Base ESLint recommended config
10+
js.configs.recommended,
11+
12+
// Main configuration object
13+
{
14+
files: ["**/*.{js,jsx,ts,tsx}"],
15+
languageOptions: {
16+
ecmaVersion: 2023,
17+
sourceType: "module",
18+
globals: {
19+
...globals.browser,
20+
...globals.node,
21+
...globals.es2023
22+
},
23+
parser: typescriptParser,
24+
parserOptions: {
25+
ecmaFeatures: {
26+
jsx: true
27+
}
28+
}
29+
},
30+
plugins: {
31+
react: reactPlugin,
32+
"@typescript-eslint": typescriptPlugin,
33+
cypress: cypressPlugin
34+
},
35+
rules: {
36+
// Include recommended rules from plugins
37+
...reactPlugin.configs.recommended.rules,
38+
...typescriptPlugin.configs.recommended.rules,
39+
...cypressPlugin.configs.recommended.rules,
40+
41+
// Your custom overrides
42+
"no-redeclare": "off",
43+
"@typescript-eslint/no-explicit-any": "off",
44+
"react/prop-types": "off",
45+
"@typescript-eslint/no-var-requires": "off",
46+
"@typescript-eslint/no-empty-function": "off",
47+
"react/no-children-prop": "off",
48+
"@typescript-eslint/ban-ts-comment": "warn"
49+
},
50+
settings: {
51+
react: {
52+
version: "detect"
53+
}
54+
}
55+
},
56+
57+
// TypeScript-specific overrides
58+
{
59+
files: ["**/*.{ts,tsx}"],
60+
rules: {
61+
"@typescript-eslint/no-var-requires": "error",
62+
"@typescript-eslint/no-unused-vars": [
63+
"error",
64+
{
65+
argsIgnorePattern: "^_",
66+
varsIgnorePattern: "^_",
67+
ignoreRestSiblings: true
68+
}
69+
]
70+
}
71+
}
72+
];

0 commit comments

Comments
 (0)