NCIOCPL / drug-dictionary-app

NCI Drug Dictionary Application
2 stars 0 forks source link

(#147) Upgrade to Node 18, Webpack 5, npm audit fixes #151

Closed adriancofie closed 1 month ago

adriancofie commented 7 months ago

(#147) Upgrade to Node 18, Webpack 5, npm audit fixes

Description

Updates node, webpack, and other packages to enable security changes. Upgrades dependencies to webpack 5 compatible versions.

Notable package upgrades

Package Old Version New Version
webpack ^4.42.1 ^5.90.3
axios ^0.21.4 ^1.6.7
cypress ^10.9.0 ^13.6.6
eslint ^7.20.0 ^8.0.1"
start-server-and-test ^1.11.7 2.0.0
webpack-manifest-plugin 2.2.0 3.0.0

Replaces deprecated (Since March 2020) babel-eslint with @babel/eslint-parser

        "@babel/eslint-parser": "^7.23.10"

Replace deprecated eslint-loader with eslint-webpack-plugin

        "eslint-webpack-plugin": "^4.0.1",

In addition, adds the following dev dependencies

        "@babel/plugin-proposal-private-property-in-object": "^7.21.11",
        "buffer": "^6.0.3",
        "https-browserify": "^1.0.0",
        "process": "^0.11.10",
        "url": "^0.11.3"

Updates node to 18

    nvm install 18
    nvm use 18

File(s): .nvmrc


Extracts jest config to separate file

File(s): .package.json jest.config.js


Updates Webpack to 5

Installl latest webpack,

    npm install webpack@latest --save-dev
    npm install —save-dev eslint-webpack-plugin  @babel/eslint-parser  @babel/plugin-proposal-private-property-in-object
    html-webpack-plugin  buffer stream-http process https-browserify url

Updates webpack config to address CRA CommonJS import bug affecting axios/nock/jest combo

File(s): /config/paths.js webpack.config.js jest.config.js

    const axiosInstance = axios.create({
        timeout: 10000,
        adapter: 'http',
    });

Updates webpack config for breaking changes from v4 -> v5

Misc webpack config changes following migration guide: https://webpack.js.org/migrate/5/

File(s): webpack.config.js babel.config.js .eslintrc.js

        fallback: {
            "http": require.resolve("stream-http"),
            "https": require.resolve('https-browserify'),
            "buffer": require.resolve('buffer'),
            "url": require.resolve("url"),
        },
new webpack.ProvidePlugin({
            Buffer: ['buffer', 'Buffer'],
        })

Security Fixes

    npm audit fix --force

Linter fixes

    npm run lint:fix
github-actions[bot] commented 7 months ago

Viewing Information

adriancofie commented 1 month ago

Closing in favor of PR #155