From d8f2fe214fe127868d753ad0205db2b26f4bb548 Mon Sep 17 00:00:00 2001 From: Dmitry Verkhoturov Date: Sat, 2 Nov 2024 17:38:18 +0100 Subject: [PATCH] Multiple improvements to the frontend code - Add explicit installation of buffer for webpack update - Also, ignore .hugo_build.lock file which should not be committed. - Also, get rid of `openssl-legacy-provider` flag as it --- .github/workflows/ci-frontend-check.yml | 1 - Dockerfile | 2 - hugo/.gitignore | 1 + hugo/package-lock.json | 55 ++++++++++++++++++++----- hugo/package.json | 1 + hugo/webpack.mix.js | 46 +++------------------ 6 files changed, 52 insertions(+), 54 deletions(-) diff --git a/.github/workflows/ci-frontend-check.yml b/.github/workflows/ci-frontend-check.yml index 6d09909b..484be8a7 100644 --- a/.github/workflows/ci-frontend-check.yml +++ b/.github/workflows/ci-frontend-check.yml @@ -15,7 +15,6 @@ jobs: runs-on: ubuntu-latest env: CI_JOB_NUMBER: 1 - NODE_OPTIONS: --openssl-legacy-provider steps: - name: Checkout repository uses: actions/checkout@v4 diff --git a/Dockerfile b/Dockerfile index 364355bd..30077811 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,8 +7,6 @@ RUN npm ci --omit=dev --omit optional ARG DO_NOT_MINIFY ENV NODE_ENV=production -# needed only for old webpack version -ENV NODE_OPTIONS=--openssl-legacy-provider COPY ./hugo/webpack.mix.js ./hugo/tsconfig.json ./hugo/.babelrc.js /app/ COPY ./hugo/src/ /app/src/ diff --git a/hugo/.gitignore b/hugo/.gitignore index 924a7b1d..3d793397 100644 --- a/hugo/.gitignore +++ b/hugo/.gitignore @@ -4,3 +4,4 @@ dev/ golayouts/ .netlify .direnv/ +.hugo_build.lock \ No newline at end of file diff --git a/hugo/package-lock.json b/hugo/package-lock.json index e805de52..e8dcf6a2 100644 --- a/hugo/package-lock.json +++ b/hugo/package-lock.json @@ -11,6 +11,7 @@ "axios": "^0.28.1", "axios-extensions": "^3.1.3", "bootstrap": "^4.6.2", + "buffer": "^6.0.3", "core-js": "^3.1.4", "cross-env": "^5.2.0", "custom-event-polyfill": "^1.0.7", @@ -3509,6 +3510,30 @@ "readable-stream": "^3.4.0" } }, + "node_modules/bl/node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, "node_modules/bluebird": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", @@ -3872,10 +3897,9 @@ "dev": true }, "node_modules/buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "dev": true, + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", "funding": [ { "type": "github", @@ -3892,7 +3916,7 @@ ], "dependencies": { "base64-js": "^1.3.1", - "ieee754": "^1.1.13" + "ieee754": "^1.2.1" } }, "node_modules/buffer-from": { @@ -21586,6 +21610,18 @@ "buffer": "^5.5.0", "inherits": "^2.0.4", "readable-stream": "^3.4.0" + }, + "dependencies": { + "buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dev": true, + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + } } }, "bluebird": { @@ -21893,13 +21929,12 @@ "dev": true }, "buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "dev": true, + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", "requires": { "base64-js": "^1.3.1", - "ieee754": "^1.1.13" + "ieee754": "^1.2.1" } }, "buffer-from": { diff --git a/hugo/package.json b/hugo/package.json index 85ef0ca4..e3c5b924 100644 --- a/hugo/package.json +++ b/hugo/package.json @@ -21,6 +21,7 @@ "axios": "^0.28.1", "axios-extensions": "^3.1.3", "bootstrap": "^4.6.2", + "buffer": "^6.0.3", "core-js": "^3.1.4", "cross-env": "^5.2.0", "custom-event-polyfill": "^1.0.7", diff --git a/hugo/webpack.mix.js b/hugo/webpack.mix.js index 88e6bb61..478b8f0b 100644 --- a/hugo/webpack.mix.js +++ b/hugo/webpack.mix.js @@ -17,6 +17,9 @@ mix 'react': 'preact/compat', 'react-dom': 'preact/compat', }, + fallback: { + "buffer": require.resolve("buffer/") + } }, }) .ts('src/js/app.js', '.') @@ -83,6 +86,7 @@ if (process.env.ANALYZE) { mix.webpackConfig({ plugins: [new BundleAnalyzerPlugin()] }); } +// Production and Development Paths if (mix.inProduction()) { Mix.manifest.name = '../../data/manifest.json'; // eslint-disable-line no-undef mix.setPublicPath('static/build'); @@ -120,8 +124,6 @@ if (mix.inProduction()) { target: `localhost:${process.env.HUGO_PORT || 1313}`, ws: true, // support websockets for hugo live-reload }, - // watch: true, - // watch specific files files: ['dev/*.css', 'dev/app.js'], ghostMode: false, // disable Clicks, Scrolls & Form inputs on any device will be mirrored to all others open: false, // don't open in browser @@ -136,42 +138,4 @@ if (mix.inProduction()) { }, }, }); -} - -// mix.version(); - -// Full API -// mix.js(src, output); -// mix.react(src, output); <-- Identical to mix.js(), but registers React Babel compilation. -// mix.preact(src, output); <-- Identical to mix.js(), but registers Preact compilation. -// mix.coffee(src, output); <-- Identical to mix.js(), but registers CoffeeScript compilation. -// mix.ts(src, output); <-- TypeScript support. Requires tsconfig.json to exist in the same folder as webpack.mix.js -// mix.extract(vendorLibs); -// mix.sass(src, output); -// mix.less(src, output); -// mix.stylus(src, output); -// mix.postCss(src, output, [require('postcss-some-plugin')()]); -// mix.browserSync('my-site.test'); -// mix.combine(files, destination); -// mix.babel(files, destination); <-- Identical to mix.combine(), but also includes Babel compilation. -// mix.copy(from, to); -// mix.copyDirectory(fromDir, toDir); -// mix.minify(file); -// mix.sourceMaps(); // Enable sourcemaps -// mix.version(); // Enable versioning. -// mix.disableNotifications(); -// mix.setPublicPath('path/to/public'); -// mix.setResourceRoot('prefix/for/resource/locators'); -// mix.autoload({}); <-- Will be passed to Webpack's ProvidePlugin. -// mix.webpackConfig({}); <-- Override webpack.config.js, without editing the file directly. -// mix.babelConfig({}); <-- Merge extra Babel configuration (plugins, etc.) with Mix's default. -// mix.then(function () {}) <-- Will be triggered each time Webpack finishes building. -// mix.extend(name, handler) <-- Extend Mix's API with your own components. -// mix.options({ -// extractVueStyles: false, // Extract .vue component styling to file, rather than inline. -// globalVueStyles: file, // Variables file to be imported in every component. -// processCssUrls: true, // Process/optimize relative stylesheet url()'s. Set to false, if you don't want them touched. -// purifyCss: false, // Remove unused CSS selectors. -// terser: {}, // Terser-specific options. https://github.com/webpack-contrib/terser-webpack-plugin#options -// postCss: [] // Post-CSS options: https://github.com/postcss/postcss/blob/master/docs/plugins.md -// }); +} \ No newline at end of file