Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update migration 11-12 guide #336

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 4 commits
Commits
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
39 changes: 38 additions & 1 deletion website/docs/migrations/11-12.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ The `Manifest` class has been removed. If you are using this class in your proje

**Migration time: ~5min.**

1. Run the `wp boilerplate manifest-cache` CLI command to add the cache functionality to your project.
1. Run the `wp boilerplate create manifest-cache` CLI command to add the cache functionality to your project.

2. Open the `functions.php` (or `<plugin-name>.php`) file and add the following code before the `Main` class initialization:
- [for themes](https://github.com/infinum/eightshift-libs/blob/main/src/Init/theme/functions.php)
Expand Down Expand Up @@ -218,3 +218,40 @@ const projectConfig = {
},
};
```

### Update ES Lint config

**Migration time: ~10min.**

Depending on the state the project is in, you might need to allocate some time for fixing errors and warnings after updating the coding standards.

ESLint configuration has been updated in Frontend libs 12 and a new build config was added.

To implement the changes, follow these steps:

1. Delete the `.eslintrc.js` and `.eslintignore` files from the theme root (if they exist)

2. Add `eslint.config.mjs` file to the theme root with the following content:
```js
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't add the exact code here as if something changes we need to update this guide. Add a link where they can see the code and copy it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you are referring to the Eightshift Frontend Libs config eslint.config.mjs file this example is different as it includes the ignore pattern which replaces the values from the .eslintignore deprecated file

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well if this needs to be added in the config we should add it. @goranalkovic-infinum please check if this needs to be added

Copy link
Contributor

@goranalkovic-infinum goranalkovic-infinum Aug 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iruzevic We should replace the files in the default setup (standard version), but it should also stay in the guide since you won't have those files on existing projects. Same is valid for .swcrc

import config from '@eightshift/frontend-libs/linters/eslint.config.mjs';

export default [{
ignores: ["public/**/*.js"],
}, ...config];
```

3. Add a `.swcrc` file to theme root with the following content:
```json
Copy link
Member

@iruzevic iruzevic Jul 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this part and replace it with the link from the libs
https://github.com/infinum/eightshift-libs/blob/main/src/InitSetup/standard/theme/.swcrc

{
"jsc": {
"parser": {
"syntax": "ecmascript",
"jsx": true,
"decorators": false,
"dynamicImport": true
}
}
}
```

4. Make sure the project is using NodeJS version 20 (or newer) both in development and production environments.