Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
81d28ca
feat(utils): upgrade to webpack 5
Jul 15, 2022
03117cd
Merge branch 'main' into feature/#31-upgrade-to-webpack-5
Jul 21, 2022
ddec6b5
fix: update stylelint
easingthemes May 17, 2023
01443c3
BREAKING CHANGE: Upgrate dependencies and tools to lastest versions
FelipeSimoes Oct 13, 2023
4bc85d2
BREAKING CHANGE Merge branch 'main' into feature/#31-upgrade-to-webpa…
FelipeSimoes Oct 13, 2023
70337f0
BREAKING CHANGE: Upgrate dependencies and tools
FelipeSimoes Oct 13, 2023
27667ad
BREAKING CHANGE: Upgrate dependencies and tools to lastest versions
FelipeSimoes Oct 13, 2023
79e7300
BREAKING CHANGE: Upgrate dependencies and tools to lastest versions
FelipeSimoes Oct 13, 2023
9b4ea84
Removing incompatible tests
FelipeSimoes Oct 17, 2023
b9d190a
BREAKING CHANGE: Upgrate dependencies and tools to lastest versions
FelipeSimoes Oct 17, 2023
2c36962
BREAKING CHANGE: Upgrate dependencies and tools to lastest versions
FelipeSimoes Oct 18, 2023
f079d6d
BREAKING CHANGE: Upgrate dependencies and tools to lastest versions
FelipeSimoes Oct 18, 2023
df86d93
BREAKING CHANGE: Upgrate dependencies and tools to lastest versions
FelipeSimoes Oct 18, 2023
8003c3a
BREAKING CHANGE: Upgrate dependencies and tools to lastest versions
FelipeSimoes Oct 18, 2023
9d96df0
BREAKING CHANGE: Upgrate dependencies and tools to lastest versions
FelipeSimoes Oct 18, 2023
4924075
BREAKING CHANGE: Upgrate dependencies and tools to lastest versions
FelipeSimoes Oct 18, 2023
3dfb7d4
BREAKING CHANGE: Upgrate dependencies and tools to lastest versions
FelipeSimoes Oct 18, 2023
895b7a3
BREAKING CHANGE: Update tests
FelipeSimoes Oct 18, 2023
81a7237
BREAKING CHANGE: Update snapshot
FelipeSimoes Oct 18, 2023
8e1581a
BREAKING CHANGE: Update node version
FelipeSimoes Oct 18, 2023
804d55b
BREAKING CHANGE: Update node version
FelipeSimoes Oct 18, 2023
0ea4db5
BREAKING CHANGE: Update node version
FelipeSimoes Oct 18, 2023
2b6703e
BREAKING CHANGE: Update node version
FelipeSimoes Oct 18, 2023
8dc48c7
BREAKING CHANGE: Update node version
FelipeSimoes Oct 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node-version: [16.x]
node-version: [18.x]

steps:
- name: Checkout
Expand All @@ -34,7 +34,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
node-version: [16.x]
node-version: [18.x]

steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/manual-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ env:
GIT_COMMITTER_NAME: github-actions
GIT_COMMITTER_EMAIL: github-actions@github.com
CI: true
CONFIG_NODE_VERSION: '["16.x"]'
CONFIG_NODE_VERSION: '["18.x"]'
CONFIG_OS: '["ubuntu-latest"]'
# Main Job
jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest ]
node-version: [ 16.x ]
node-version: [ 18.x ]

steps:
- name: Checkout
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ target/
.DS_Store
*.swp

# git
*.orig

# Node related files
node_modules/
node/
Expand All @@ -50,5 +53,8 @@ dist/
tmp/
coverage/

# coverage folder
coverage/

# Bundle Analyser
frontend/stats.json
2 changes: 2 additions & 0 deletions config/cache.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// webpack cache
module.exports = true
3 changes: 3 additions & 0 deletions config/devserver.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {

}
17 changes: 4 additions & 13 deletions config/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
// Webpack configuration
// eslint plugin configuration
module.exports = {
enforce: 'pre',
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'eslint-loader',
options: {
cache: true,
failOnError: true,
fix: true
}
}
};
failOnError: true,
fix: true
};
4 changes: 2 additions & 2 deletions config/general.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ const analyzerPort = getArgumentValue('--port=') || 8888;
const disableStyleLint = getArgumentValue('--disable-styelint');

// general webpack
const devtool = isProduction ? 'none' : 'inline-source-map';
const devtool = isProduction ? false : 'inline-source-map';

// general optimization
const excludedFromVendors = ['babel', 'core-js'];

// modules to run on webpack rules (each config module.config.js)
const modules = ['eslint', 'babel'];
const modules = ['babel'];

// split all entries
const multiple = true;
Expand Down
10 changes: 9 additions & 1 deletion config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ const resolve = require('./resolve.config');
const sass = require('./sass.config');
const stylelint = require('./stylelint.config');
const templates = require('./templates.config');
const stats = require('./stats.config');
const cache = require('./cache.config');
const devServer = require('./devserver.config');
const performance = require('./performance.config');

const modules = general.modules;

Expand All @@ -26,5 +30,9 @@ module.exports = {
stylelint,
resolve,
postcss,
templates
templates,
stats,
cache,
devServer,
performance
};
32 changes: 19 additions & 13 deletions config/optimization.config.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,35 @@
const path = require('path')
const { isProduction, excludedFromVendors } = require('./general.config');
const moduleIsVendor = require('../utils/moduleIsVendor');
const checkChunk = require('../utils/checkChunk');
const nodeModules = `node_modules`;

// curry to pass the module to check
const test = ( excludes, includes) => (mod) => checkChunk(mod.context, excludes, includes);

module.exports = {
minimize: isProduction,
usedExports: isProduction,
usedExports: 'global',
runtimeChunk: {
name: 'commons/treeshaking.bundle.js'
},
splitChunks: {
chunks: 'initial',
minChunks: 2,
cacheGroups: {
// Treeshake vendors in node_modules (but keep unique vendors at the clientlibs it belongs)
// Treeshake vendors in node_modules (but keep unique vendors at the clientlibs it belongs)
vendors: {
test: mod => moduleIsVendor(mod.context, excludedFromVendors),
name: 'commons/vendors.bundle.js',
chunks: 'all',
// used on at least 2 modules
minChunks: 2
test: test([nodeModules], excludedFromVendors),
minChunks: 2,
enforce : true,
name: 'commons/vendors.bundle.js',
// used on at least 2 modules
},
// Treeshakes common imports, if used in more than 2 clientlibs
treeshaking: {
test: mod => !moduleIsVendor(mod.context, excludedFromVendors),
name: 'commons/treeshaking.bundle.js',
chunks: 'all',
// used on at least 2 modules
minChunks: 2
test: test([nodeModules]),
minChunks: 2,
enforce : true,
name: 'commons/treeshaking.bundle.js',
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions config/performance.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
maxAssetSize: 100000,
maxEntrypointSize: 350000,
};
1 change: 0 additions & 1 deletion config/plugins.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const webpack = require('webpack');

const { mode, analyze, analyzerPort } = require('./general.config');

// pass the mode forward
Expand Down
1 change: 1 addition & 0 deletions config/stats.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = 'verbose';
2 changes: 1 addition & 1 deletion config/stylelint.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
// Stops build if a linter error is found
failOnError: true
failOnError: true,
};
30 changes: 12 additions & 18 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,24 @@ These are the configurations that can be extended:

- general
- output
- optimization
- plugins
- [optimization](https://webpack.js.org/configuration/optimization/)
- [plugins](https://webpack.js.org/configuration/plugins/)
- eslint
- babel
- sass
- clientlibs
- stylelint
- resolve
- [resolve](https://webpack.js.org/configuration/resolve/)
- postcss
- templates

Other webpack options

- [stats](https://webpack.js.org/configuration/stats/)
- [cache](https://webpack.js.org/configuration/cache/)
- [devServer](https://webpack.js.org/configuration/dev-server/)
- [performance](https://webpack.js.org/configuration/performance/)

## Overriding a Default Configuration

To override a configuration, add a new entry in the object exported in your `.febuild` with the name of the configuration you want to override, which value is an object whith entries that matches the existing options you want to override.
Expand Down Expand Up @@ -171,21 +178,8 @@ For more information about the configuration options check [eslint-loader](https

```javascript
module.exports = {
{
eslint: {
enforce: 'pre',
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'eslint-loader',
options: {
cache: true,
failOnError: true,
fix: true
}
}
}
}
failOnError: true,
fix: true // deprecated with scss only for css
}
```

Expand Down
65 changes: 65 additions & 0 deletions docs/migration.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,68 @@

# Migrating to v4.0.0

This release contains breaking changes. We know these can be disruptive, but they were needed to keep the dependencies updated.

### using [Node 17+](https://nodejs.org/download/release/v18.18.2/)
breaking changes may also affect you:
- webpack output uses [crypto.createHash that utilize MD4 of a OpenSSL 3.0 Legacy provider]()

Those You will see this error:
```bash
[webpack-cli] Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:67:19)
```

#### Workaround one:
```javascript

// uses a new hash function
// at output.config or at .febuild output property
{
hashFunction: "xxhash64"
}
```
#### Workaround two:
```bash
# At your terminal, profile or before your build function run / use
export NODE_OPTIONS=--openssl-legacy-provider;
```


### [ESlint ^8](https://eslint.org/docs/latest/use/migrate-to-8.0.0)
Build now uses [eslint-webpack-plugin](https://www.npmjs.com/package/eslint-webpack-plugin) intead of deprecated [eslint-loader](https://www.npmjs.com/package/eslint-loader)
It's setting the plugin now instead of loader then
#### breaking changes
- review your .febuild exported eslint property to use only the [eslint options schema](https://eslint.org/docs/latest/integrate/nodejs-api#-new-eslintoptions)



### [Stylelint ^15](https://stylelint.io/migration-guide/to-15/)

We recommend extending a shared configuration like [@netcentric/stylelint-config](https://github.com/Netcentric/stylelint-config) that includes the appropriate syntax to lint Scss.

Three breaking changes may also affect you:
- Upgrade [@netcentric/stylelint-config](https://github.com/Netcentric/stylelint-config) to "^2.0.0",
- removed processors configuration property
- removed support for Node.js 12
- changed overrides.extends behavior

### [Webpack ^5](https://webpack.js.org/migrate/5/) and [babel v7](https://babeljs.io/docs/v7-migration)

Please review your webpack config options accordenly
- Review package.json dependecies on your project to match current one
- review babel configs to respect [babel v7](https://babeljs.io/docs/v7-migration)
- review your .febuild exported properties to use webpack latest options
- [stats](https://webpack.js.org/configuration/stats/)
- [cache](https://webpack.js.org/configuration/cache/)
- [devServer](https://webpack.js.org/configuration/dev-server/)
- [performance](https://webpack.js.org/configuration/performance/)
- [resolve](https://webpack.js.org/configuration/resolve/)
- [optimization](https://webpack.js.org/configuration/optimization/)
- [plugins](https://webpack.js.org/configuration/plugins/)



# Migrating to v2.0.0

This release contains breaking changes. We know these can be disruptive, but they were needed to keep the dependencies updated.
Expand Down
Loading