Version 7 to 8
This migration guide contains migration instructions for:
- eightshift/boilerplate - 7+ --> 8.0.0
- eightshift/frontend-libs - 6+ --> 7.0.0
- eightshift/libs - 5+ --> 6.0.0
Required changes
Migration time: ~10min.
-
Update
composer.json
to"infinum/eightshift-libs": "^6.0"
. -
Update
package.json
to the latest versions:"@eightshift/frontend-libs": "^7.0.0",
"husky": "^8.0.1",
"webpack": "^5.73.0",
"webpack-cli": "^4.10.0" -
Check
package.json
for additional packages that might need updating, such as coding standards. -
Add
.browserslistrc
to the root of your theme/plugin and copy the details from here. -
We have removed the
normalize
package from the project as it was unmaintained. Search your project and replace:@import 'normalize-scss';
@include normalize();with this:
@import '@eightshift/frontend-libs/styles/scss/normalize';
-
We've removed
@babel/polyfill
package, so please removerequire('@babel/polyfill');
from your project or install it manually if you need to support older browsers. -
If your Webpack build outputs warnings such as:
Should not import the named export 'componentJsClass' (imported as 'componentJsClass') from default-exporting module (only default export is available soon).
check the JS files used on the frontend and replace:
import { componentJsClass } from './../manifest.json';
with this:
import manifest from './../manifest.json';
const {
componentJsClass,
} = manifest; -
If you were using
getAllBlocksList
function as a callback forallowed_block_types_all
filter, there is no need for change. However, if you used a custom implementation function, consider using thegetAllAllowedBlocksList
in your callback since it provides more options and gives more control over blocks that are being used in the project.
Swiper changes:
Migration time: ~5min.
Swiper is not a dependency of Eightshift Boilerplate, but if you are using Swiper in your project and have something like this:
@import '~swiper/swiper.scss';
@import '~swiper/modules/pagination/pagination.scss';
please check Swiper's package.json
in node_modules/swiper/package.json
and find the exports
key, find the styles you are using and replace the path for the correct export path. Please note that this export can change depending on the Swiper version you are using.
For example, for Swiper 8.x.x
, you should replace
@import '~swiper/swiper.scss';
@import '~swiper/modules/pagination/pagination.scss';
with
@import '~swiper/css';
@import '~swiper/css/pagination';
Storybook changes:
Migration time: ~10min.
-
Check if the project is using the Storybook package
@eightshift/storybook
because we changed the release numbers. Check the eightshift-storybook repository's releases page for reference. At the time of writing this, the current version is1.4.1
. -
Open
.storybook/main.js
. It should look like this:module.exports = {
stories: ['./../src/Blocks/**/story.js'],
addons: [
'@storybook/addon-essentials',
'@storybook/addon-a11y'
],
core: {
builder: 'webpack5',
},
features: {
emotionAlias: false,
}
}; -
Open
.storybook/preview-body.html
. It should look like this:<style>
body {
padding: 0.75em;
opacity: 1;
}
</style> -
Open
.storybook/preview-head.html
. It should look like this:<script>
window.wp = {};
esRedesignBlocksLocalization = {}
</script> -
Open
.storybook/preview.js
. It should look like this:import { dispatch } from '@wordpress/data';
import { STORE_NAME } from '@eightshift/frontend-libs/scripts/editor/store';
import { storybookWindowObjects, storybookDefaultMocksCategories, storybookDefaultMocksColorPalette, storybookWpStyles } from '@eightshift/frontend-libs/scripts/storybook';
import globalSettings from '../src/Blocks/manifest.json';
// Storybook order is really important because it won't work in any configuration. Be careful when changing stuff here.
// Set default window objects.
storybookWindowObjects();
// Set default categories.
storybookDefaultMocksCategories();
// Set default color palette.
storybookDefaultMocksColorPalette(globalSettings);
// WP styles.
storybookWpStyles();
// Project styles.
require('./../assets/styles/application.scss');
// Project Blocks Frontend Part.
require('./../src/Blocks/assets/styles/application-blocks.scss');
require('./../src/Blocks/assets/styles/application-blocks-editor.scss');
// Project Blocks Editor Part.
require('../src/Blocks/assets/scripts/application-blocks-editor');
// Prevent one inline style tag.
dispatch(STORE_NAME).setConfigOutputCssGlobally(false);