Upgrading to PagesJS 1.0.0 | Yext Hitchhikers Platform
If you are using a beta version of PagesJS (anything below version 1.0.0), we recommend upgrading your project ASAP to take advantage of the latest features!
0.1_382 or higher).
To help facilitate this, Pages offers an upgrade command that will update any necessary portions of your project automatically.
To get started, cd into your project and run the following command:
npx @yext/pages@latest upgradeThis command will perform the following actions automatically:
Logs a warning if you’re using the legacy markdown component from
react-componentsand links to the reference doc on Rendering Rich Text and MarkdownUpdates the following dependencies to latest:
@vitejs/plugin-react-
vite(to latest Vite 5) @yext/search-headless-react@yext/search-ui-react
Removes
fetchimports if it’s coming from@yext/pages/util(as it is supported natively as part of node.js 18 )Adds/updates the following
package.jsonscripts: dev, prod, buildUpdates node
enginesinpackage.jsonto^18.0.0 || >=20.0.0Checks the current version of node the user is on and errors if not on 18 or 20
Updates
@yext/pagesto the version of the upgrade script running (should be the latest)Removes the following dependencies from
package.jsonand updates imports to use@yext/pages-componentsinstead@yext/sites-components@yext/react-components
Installs dependencies based on the package manager you’re using (npm, pnpm, yarn)
Migrates from
sites-configfiles (refer to the Site Config Files (< PagesJS 1.0.0) reference) to the new consolidatedconfig.yamlformat (refer to the Site Configuration reference doc)
For a list of features and bug fixes introduced in PagesJS 1.0.0 and each beta version, check out this Github changelog .
Update HoursStatus Component
Sites using an outdated pages component may incorrectly calculate store holiday hours. This issue only affects customers viewing the page from a different time zone than the store’s location. For users in the same time zone as the location, the open status and holiday hours will be correct.
To resolve this, update your site to use the HoursStatus component from @yext/pages-components instead of an older library (@yext/sites-react-components, @yext/sites-components, or @yext/react-components). There are two ways you can do this:
- Use the upgrade command above to upgrade to the latest version of PagesJS.
- This will remove old dependencies from
package.jsonand update imports to use@yext/pages-componentsinstead of any older libraries. - However, the upgrade command will perform other actions automatically to upgrade the PagesJS version; depending on your setup, other issues may arise that need to be fixed.
- This will remove old dependencies from
- You can use the
HoursStatuscomponent from@yext/pages-componentswithout updating other components specifically for this issue. However, it is recommended that you upgrade all corresponding components to the@yext/pages-componentsones.- Add
@yext/pages-componentsto thepackage.jsonfile if it is not already there. - Update the import of
HoursStatusto use the@yext/pages-componentslibrary.
- Add