The CLI itemres command
The Sitecore Items as Resources plugin includes an itemres
command. This command creates an item package in a resource file with configurable options.
To install the Items as Resources plugin, run the following code:
dotnet sitecore plugin add -n Sitecore.DevEx.Extensibility.ResourcePackage --version <version>
Usage
You can use the command as follows:
dotnet sitecore itemres [subcommand] [options]
Subcommands
You can use the following subcommands:
-
create
- creates a resource package. -
unicorn
- creates a Unicorn resource package. -
cleanup
- cleans up database items contained in .dat files if the item data in both entries are equal. This subcommand is available for CLI 4.1 or later.
The create subcommand
The create
subcommand creates a new items and resources package. The CLI names the package based on the convention items.{databaseName}.{providedName}.dat
.
You can use the following options with the create
subcommand:
Option |
Description |
---|---|
|
Required. Package path to output (extension added if not provided). |
|
Overwrite an existing package. |
|
Include module configurations. Wildcards and multiple values are allowed. |
|
Explicitly exclude module configurations. Wildcards and multiple values are allowed. |
|
Path to the root Default: current working directory. |
|
Report additional diagnostic and performance data. |
|
Report additional diagnostic and performance data. |
|
Help for the command. |
The following are examples of using the create
subcommand:
Command |
Result |
---|---|
|
Creates the |
|
Creates the |
Attempt to create
|
Does not create the package and returns with the following message: RequestResponse
|
Attempt to create
|
Creates and overwrites the package. |
|
Creates the package and includes only the |
|
Creates the package and includes only the |
|
Creates the package and includes only the |
|
Creates the package and includes only the |
|
Creates package and includes the |
|
Creates package and includes only the |
|
Creates package and includes only the |
|
Creates package and includes only the |
|
Creates package and includes only the |
|
Creates package and excludes the |
|
Creates package and includes the |
|
Does not create the package and returns with the following message: RequestResponse
|
Attempt to create
|
Does not create the package and returns with the following message: RequestResponse
|
Attempt to create
|
Creates the package in the |
|
Creates additional diagnostic and performance data, such as a root config path or count of nodes with performance, for example, 73ms (8.1ms/node). |
|
Creates additional diagnostic and performance data, such as FSIndex: Loaded filesystem indices in, for example, 70ms (9 metadata) or created package of 1 trees in, for example, 1983ms (9 items; 220.3ms/node). |
The unicorn subcommand
The unicorn
subcommand creates a new items and resources package from Unicorn serialization with the specific name format items.{databaseName}.{providedName}.dat
.
You can use the following options with the unicorn
subcommand:
Option |
Description |
---|---|
|
Required. Path to unicorn serialization. |
|
Required. Package path to output (extension added if not provided). Multiple values are allowed. |
|
Overwrite an existing package. |
|
Path to the root Default: current working directory. |
|
Report additional diagnostic and performance data. |
|
Report additional diagnostic and performance data. |
|
Help for the command. |
The following are examples of using the unicorn
subcommand:
Command |
Result |
---|---|
|
Creates the |
The cleanup subcommand
The cleanup
subcommand cleans up database items in .dat files if the item data in both entries are equal.
You can use the following options with the cleanup
subcommand:
Option |
Description |
---|---|
|
Force items cleanup without field comparison. Available from version 5.1.28. |
|
Simulate items cleanup without deleting items. Available from version 5.1.28. |
|
Sitecore Item path or GUID to cleanup. Required for Sitecore 10.3 if using the |
|
Recursively cleanup all items under the specified path. |
|
The path to the Default: |
|
Named Sitecore environment to use. Default: |
|
Report additional diagnostic and performance data. |
|
Report additional diagnostic and performance data. |
|
Help for the command. |
The --path
and --recurse
options are available for Sitecore 10.3 and later. The --force
and --what-if
options can be used in combination with --path
for Sitecore 10.3 and later. Using --force
and --what-if
without specifying the --path
is possible only in XM Cloud.
The following table shows an example of using the cleanup
subcommand:
Command |
Result |
---|---|
|
Output: RequestResponse
|
|
The command will not perform any action. You must provide a path with the |
|
The command will not perform any action. You must provide a path with the |
|
Output: RequestResponse
|