Skip to content

Commit

Permalink
Add prettier and editorconfig files. Reformat JavaScript code.
Browse files Browse the repository at this point in the history
  • Loading branch information
pnikolov committed Dec 22, 2023
1 parent 5424ac9 commit ac1148e
Show file tree
Hide file tree
Showing 8 changed files with 136 additions and 116 deletions.
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[*]
charset = utf-8
insert_final_newline = true
end_of_line = lf
indent_style = space
indent_size = 2
max_line_length = 120
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

.env

# Mac OS X
.DS_Store
._.*
Expand Down
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"trailingComma": "es5",
"tabWidth": 2,
"semi": true,
"singleQuote": true
}
204 changes: 103 additions & 101 deletions README.md

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module.exports = {
plugins: [
require('autoprefixer'),
],
plugins: [require('autoprefixer')],
};
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ <h1>Webpack 5 Template Boilerplate</h1>
<div class="badges">
<a href="https://github.com/WeAreAthlon/frontend-webpack-boilerplate/" target="_blank" rel="noopener"><img src="https://img.shields.io/maintenance/yes/2023?logo=github" alt="Maintenance"></a>
<a href="https://github.com/WeAreAthlon/frontend-webpack-boilerplate/actions" target="_blank" rel="noopener"><img src="https://github.com/WeAreAthlon/frontend-webpack-boilerplate/actions/workflows/deploy.yml/badge.svg" alt="Build Status"></a>
<a href="https://webpack.js.org" target="_blank" rel="noopener"><img src="https://img.shields.io/badge/webpack-v5.88.2-green?logo=webpack" alt="Current Webpack Version"></a>
<a href="https://webpack.js.org" target="_blank" rel="noopener"><img src="https://img.shields.io/badge/webpack-v5.89.0-green?logo=webpack" alt="Current Webpack Version"></a>
<a href="https://snyk.io/advisor/npm-package/@weareathlon/frontend-webpack-boilerplate" target="_blank" rel="noopener"><img src="https://snyk.io/advisor/npm-package/@weareathlon/frontend-webpack-boilerplate/badge.svg" alt="Snyk.io package health badge"></a>
<br>
<a href="https://github.com/WeAreAthlon/frontend-webpack-boilerplate/issues" target="_blank" rel="noopener"><img src="https://img.shields.io/github/issues-raw/WeAreAthlon/frontend-webpack-boilerplate" alt="GitHub Issues"></a>
Expand Down
3 changes: 2 additions & 1 deletion src/js/demo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const demo = () => 'Webpack Boilerplate v5.17.1 - SASS/PostCSS, ES6/7, browser sync, source code listing and more.';
const demo = () =>
'Webpack Boilerplate v5.17.1 - SASS/PostCSS, ES6/7, browser sync, source code listing and more.';

Check failure on line 2 in src/js/demo.js

View workflow job for this annotation

GitHub Actions / build-and-deploy

Expected no linebreak before this expression

// eslint-disable-next-line no-console
console.log(demo());
24 changes: 14 additions & 10 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* Webpack main configuration file
*/

const path = require('path');
const fs = require('fs');
const CopyWebpackPlugin = require('copy-webpack-plugin');
Expand All @@ -12,19 +11,24 @@ const { CleanWebpackPlugin } = require('clean-webpack-plugin');

const environment = require('./configuration/environment');

const templateFiles = fs.readdirSync(environment.paths.source)
.filter((file) => ['.html', '.ejs'].includes(path.extname(file).toLowerCase())).map((filename) => ({
const templateFiles = fs
.readdirSync(environment.paths.source)
.filter((file) => ['.html', '.ejs'].includes(path.extname(file).toLowerCase()))
.map((filename) => ({
input: filename,
output: filename.replace(/\.ejs$/, '.html'),
}));

const htmlPluginEntries = templateFiles.map((template) => new HTMLWebpackPlugin({
inject: true,
hash: false,
filename: template.output,
template: path.resolve(environment.paths.source, template.input),
favicon: path.resolve(environment.paths.source, 'images', 'favicon.ico'),
}));
const htmlPluginEntries = templateFiles.map(
(template) =>
new HTMLWebpackPlugin({
inject: true,
hash: false,
filename: template.output,
template: path.resolve(environment.paths.source, template.input),
favicon: path.resolve(environment.paths.source, 'images', 'favicon.ico'),
})
);

module.exports = {
entry: {
Expand Down

0 comments on commit ac1148e

Please sign in to comment.