The dcu is the core code and metadata synchronization utility, which allows you to grab all of the user modifiable source code and metadata from a Commerce Cloud server, edit it as necessary in your chosen tool, and then upload it back to the server. The utilities also makes it possible to transfer content between Commerce Cloud server instances. The dcu supports these main operations:

The basic command for grabbing files is:

dcu --grab

The basic command for uploading a single file is:

dcu --put <path to file>

For example:

dcu --put "widget/Add Product To Wish List/instances/
Add Product To Wish List Widget/display.template"

The basic command for uploading all files under a specified directory is:

dcu --putAll <directory>

For example:

dcu --putAll theme

During each of these operations, the utility provides messages to tell you the status of the grab or upload. You can modify these basic commands with the options described in the Understand dcu options section.

Transfer source code and metadata between Commerce Cloud instances

You can use the dcu to transfer source code from one Commerce Cloud instance to another. This can be useful for promoting source code from a test environment to production.

To use the transfer feature, you must execute a grab from the source instance, for example:

dcu --grab --clean --node http://sourceInstance --user username --password pwd

After the grab is finished, you transfer the files to the destination instance, using a command similar to the following:

dcu --transferAll path --node http://destinationInstance --user username --
    password pwd

The dcu takes a “best effort” approach to transferring content between instances. In general, it matches by name so that if, for example, a widget instance on the destination instance has the same name as a widget instance on the source instance, they are assumed to be the same. The matching rules for each entity type are described in the table below.

Type

Matching rules

Global elements

Matches on the <element> tag. If the element does not exist, a warning is issued.

Application-level JavaScript modules

Matches on the JavaScript file name. If the file name does not exist, it is created on the destination instance.

Text snippets

Matches on locale.

Stacks

Matches on the stack instance’s display name. If the stack instance does not exist, a warning is issued.

Themes

Matches on the theme name. If a matching theme does not exist, one is created on the target instance, using the same name and source code.

Widgets

Widgets are matched on version number and display name. If the widget does not exist, a warning is issued. Widget instances are matched on display name. If a matching widget instance does not exist, a new widget instance is created on the target instance using the same display name and source code.

Elements

Widget elements are matched on version number, display name and <element> tag. If the element does not exist, a warning is issued.

Understand dcu options

The following table describes the options you can use with the dcu.

Option

Description

-h, --help

Provides usage information for the utility.

-V, --version

Provides the utility’s version number.

-n, --node <node>

The URL for the administration interface on the target Commerce Cloud instance, for example, http://localhost:9080. Used with --grab, --put, and --putAll. If --node is not specified, the utility attempts to use the most recently specified node.

-k, --applicationKey <key>

The application key to use to log into the target Commerce Cloud administration interface. It is recommended that you create an application key for authentication purposes. For detailed information on creating an application key, refer to the Use the application key for authentication section.

It is also possible to specify the application key using the CC_APPLICATION_KEY environment variable.

-u, --username <userName>
-p, --password <password>

These options are no longer available, having been replaced by the applicationKey option.

-g, --grab

Copies all available content from the target Commerce Cloud instance into the current working directory, or the base directory if one has been specified.

Note: During a grab, a new directory called .ccc is created on disk alongside the grabbed directories. This is called the Tracking Directory and holds important metadata used by the utility. Do not modify this directory.

-t, --put <path to file>

Sends the specified file back to the specified Commerce Cloud instance. The <path to file> can be either a relative or absolute path, in either Windows or POSIX format. Relative paths are relative to the base directory, which you can specify using the --base option. If the
--base option is not provided, the base directory is assumed to be the current working directory.

If a full path is provided, then any value specified in the
--base option is ignored.

-b, --base <directory>

Specifies the base directory. This can be either a relative or absolute path, in either Windows or POSIX format.

-l, --locale <locale>

Retrieves text snippets and resources for the specified locale only. Also, the informational messages displayed by the Design Code Utility will appear in the locale specified.

-a, --allLocales

Gets text data for all locales rather than just the current locale for the target Commerce Cloud instance.

-c, --clean

Deletes all local files that have been previously grabbed. Used only with the --grab option.

-m, --putAll <directory>

Sends all files back to the target Commerce Cloud instance, beneath the specified directory. The <directory> can be either a relative or absolute path, in either Windows or POSIX format. Relative paths are relative to the base directory, which you can specify using the --base option. If the --base option is not provided, the base directory is assumed to be the current working directory.

If a full path is provided, then any value specified in the --base option is ignored.

-x, --transferAll <path>

Transfers all files from the local machine to the specified Commerce Cloud instance, matching by name. For example, if a widget instance is called Red Footer and the utility finds a widget instance on the target that is also called Red Footer, the utility assumes they are the same.

-i, --updateInstances

Updates all instance templates, less and locale strings using their respective base assets. By default, when a base widget template, less or locale file is modified, the changes affect only widget instances that are subsequently created. When you select this option, all widget instance assets of a specific type are overwritten with their corresponding base contents. You can use this option to correct issues affecting a large number of existing instances. It is recommended to use this option sparingly.

-o, --noInstanceConfigUpdate

By default, when performing a put, putAll or tranferAll, widget instance metadata is updated on the Commerce Cloud instance. However, you may want to have widget instance configuration metadata different between Commerce Cloud instances. Use this option to suppress widget instance metadata updates.

-C, --compileLess [auto]

This option, used in conjunction with ccproxy, prepares a local copy of the rendered storefronts CSS file. The CCAdminUI endpoint ensures that all standard storefront styles are included, as well as any less files you may have created. If the active site theme is restricted, the Less Compiler also includes the current active theme in the CSS output.

Add JavaScript to existing user-created widgets

You can add JavaScript to an existing user-created widget by creating a new .js file under the widget’s /js directory and issuing a put, putAll or transferAll.


Copyright © 1997, 2017 Oracle and/or its affiliates. All rights reserved. Legal Notices