Skip to content

Commit

Permalink
Multiple improvements to the frontend code
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
paskal committed Nov 2, 2024
1 parent d610927 commit d8f2fe2
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 54 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci-frontend-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
1 change: 1 addition & 0 deletions hugo/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ dev/
golayouts/
.netlify
.direnv/
.hugo_build.lock
55 changes: 45 additions & 10 deletions hugo/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions hugo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
46 changes: 5 additions & 41 deletions hugo/webpack.mix.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ mix
'react': 'preact/compat',
'react-dom': 'preact/compat',
},
fallback: {
"buffer": require.resolve("buffer/")
}
},
})
.ts('src/js/app.js', '.')
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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
Expand All @@ -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
// });
}

0 comments on commit d8f2fe2

Please sign in to comment.