Skip to content

feat: Modernize Node.js environment, dependencies, and Docker setup - #3

Open
romainPrignon wants to merge 1 commit into
masterfrom
feat/foundational-updates
Open

feat: Modernize Node.js environment, dependencies, and Docker setup#3
romainPrignon wants to merge 1 commit into
masterfrom
feat/foundational-updates

Conversation

@romainPrignon

Copy link
Copy Markdown
Owner

This commit brings several foundational improvements to the project:

  1. Node.js Modernization:

    • Updated Node.js engine to ^18.17.0 in package.json.
    • Updated npm engine to ^9.6.7 in package.json.
    • Updated @types/node to ^18.17.0.
  2. Core Dependency Updates:

    • Upgraded TypeScript to ^5.2.2.
    • Upgraded ESLint to ^8.50.0 and its TypeScript plugins (@typescript-eslint/eslint-plugin, @typescript-eslint/parser) to ^6.7.3.
    • Added plugin:@typescript-eslint/recommended to ESLint configuration.
    • Upgraded Jest to ^29.7.0, ts-jest to ^29.1.1, and @types/jest to ^29.5.5.
    • Pinned Husky to ^8.0.0.
  3. Dockerfile Enhancements:

    • Base images updated to node:18-alpine.
    • Corrected npm install commands to npm install --legacy-peer-deps (for build stage) and npm ci --only=production --legacy-peer-deps (for final stage).
    • Ensured package-lock.json is copied and used for installations.
    • Set the CMD to ["node", "dist/index.js"] to correctly run the application.
  4. Build Process Improvements:

    • Added a .dockerignore file to optimize Docker build context.
    • Updated tsconfig.json for es2022 target and lib.
    • Updated .eslintrc.js for ecmaVersion: 2022.

These changes provide a more secure, stable, and modern foundation for future development.

This commit brings several foundational improvements to the project:

1.  **Node.js Modernization:**
    *   Updated Node.js engine to `^18.17.0` in `package.json`.
    *   Updated npm engine to `^9.6.7` in `package.json`.
    *   Updated `@types/node` to `^18.17.0`.

2.  **Core Dependency Updates:**
    *   Upgraded TypeScript to `^5.2.2`.
    *   Upgraded ESLint to `^8.50.0` and its TypeScript plugins (`@typescript-eslint/eslint-plugin`, `@typescript-eslint/parser`) to `^6.7.3`.
    *   Added `plugin:@typescript-eslint/recommended` to ESLint configuration.
    *   Upgraded Jest to `^29.7.0`, `ts-jest` to `^29.1.1`, and `@types/jest` to `^29.5.5`.
    *   Pinned Husky to `^8.0.0`.

3.  **Dockerfile Enhancements:**
    *   Base images updated to `node:18-alpine`.
    *   Corrected npm install commands to `npm install --legacy-peer-deps` (for build stage) and `npm ci --only=production --legacy-peer-deps` (for final stage).
    *   Ensured `package-lock.json` is copied and used for installations.
    *   Set the `CMD` to `["node", "dist/index.js"]` to correctly run the application.

4.  **Build Process Improvements:**
    *   Added a `.dockerignore` file to optimize Docker build context.
    *   Updated `tsconfig.json` for `es2022` target and lib.
    *   Updated `.eslintrc.js` for `ecmaVersion: 2022`.

These changes provide a more secure, stable, and modern foundation for future development.
@romainPrignon
romainPrignon requested a review from Copilot May 22, 2025 18:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Modernize the project’s Node.js environment, dependencies, and Docker setup for a more stable and current foundation.

  • Bump Node.js, npm, and core dev dependencies (TypeScript, ESLint, Jest, etc.) to latest compatible versions
  • Refactor Dockerfile to use Alpine images, legacy-peer-deps install, and correct runtime command
  • Add .dockerignore and update ESLint/TS config to target modern ECMAScript and TypeScript rules

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

File Description
package.json Updated engines and core dev dependencies to current versions
Dockerfile Switched to node:18-alpine, adjusted install commands and CMD
.eslintrc.js Bumped ecmaVersion to 2022 and added TypeScript ESLint plugin
.dockerignore Added ignore rules to optimize Docker build context
Comments suppressed due to low confidence (2)

package.json:51

  • The jest-config version remains at 23.6.0 while Jest itself is updated to ^29.7.0, which may cause version mismatches or unexpected behavior. Consider updating jest-config to a compatible version or removing it if it’s no longer needed.
"jest-config": "23.6.0",

.dockerignore:6

  • [nitpick] Ignoring the Dockerfile in .dockerignore can prevent it from being sent to the build context. It's generally recommended to keep the Dockerfile outside of ignore rules so builds remain reproducible.
Dockerfile

Comment thread package.json
Comment on lines +54 to 56
"typescript": "^5.2.2"
},
"optionalDependencies": {

Copilot AI May 22, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Husky is configured under optionalDependencies, but it’s a development tool and should typically be in devDependencies to avoid shipping unnecessary packages to production.

Suggested change
"typescript": "^5.2.2"
},
"optionalDependencies": {
"typescript": "^5.2.2",

Copilot uses AI. Check for mistakes.
Comment thread Dockerfile
WORKDIR /opt

COPY --from=build /opt/package.json package.json
COPY package-lock.json .

Copilot AI May 22, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the final stage you copy package-lock.json from the build context instead of the build stage. You may want to COPY --from=build /opt/package-lock.json . to ensure the exact lockfile used during build is applied in the runtime image.

Suggested change
COPY package-lock.json .
COPY --from=build /opt/package-lock.json .

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants