With the release of Sitecore version 10.2, Sitecore Headless Services also upgraded to version 19.0.0. New steps were added for creating projects without Next.js sample data, saving time by skipping data deletion in initial steps. Let's update.
Regarding the version of the jss command
command must be updated to the latest version. The following results were displayed when the version was checked.
github % jss --version
JSS CLI is running in global mode because it was not installed in the local node_modules folder.
19.0.0
You can see that the 19.0.0 command is installed.
Create a Next.js project
First, create a project as before.
jss create nextjs-test nextjs
When the creation is completed, the following message is displayed.
The explanation is given in the Next.js sample app parameter shown at the end.
* --fetchWith {REST|GraphQL} : Specifies how Sitecore data (layout, dictionary) is fetched. Default is REST.
* --prerender {SSG|SSR} : Specifies the Next.js pre-rendering form for the optional catch-all route. Default is SSG.
* --empty {true|false} : Specifies whether the sample should be empty. Disconnected mode and styleguide components will be removed. Default is false.
The third --empty introduces the point that the sample data will be implemented in a deleted form. So, once again, we will create a project with the following parameters.
jss create nextjs-demo nextjs --empty
In the new directory you created, you can see that the directory under /src/components is empty. Similarly, there is no /data directory at the top level.
To make it work, data and components must be added.
2022-02-22 Postscript: This empty sample is used in the "Change to Sitecore First" section.Summary
When a new version of a headless site is needed, the necessary data can be migrated to this empty template. This feature will be useful in the future.