Commerce Cloud includes the ccw utility, a command-line tool that allows you to create new content on Commerce Cloud with the IDE or code editor of your choice. This tool allows you to create new widgets, and then upload them to the server.

For detailed information on working with widgets, stacks and elements, refer to the Developing Widgets guide.

The format for implementing the ccw is:

ccw [options]
Understand ccw utility options

The following table describes the options you can use with the ccw utility.

Option

Description

-b, --base <directory>

Identifies the base directory.

-h, --help

Provides usage information for the utility.

-l, --locale <locale>

Uses the supplied locale as the default locale. Also, the informational messages displayed by the ccw will appear in the locale specified.

-n, --node <node>

The URL for the administration interface on the target Commerce Cloud instance, for example, http://localhost:9080. 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 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.

-V, --version

Provides the utility’s version number.

-w, --createWidget

Creates a new widget.

Create a widget with the ccw utility

When you create a new widget, the ccw asks a number of questions so that it may create an element. The extension is created by calling the appropriate endpoints.

Initiate the ccw with the option to create a new widget:

ccw -w

This brings up the following wizard interface:

This image is described in the preceding text.
Understand the ccw utility questions

When creating the widget, you are prompted to answer a number of questions. The way that you answer these questions affects the way that the widget is created. The following section provides details of the questions asked during the creation of the widget.

Question

Explanation

Enter the name of the new widget

The textual name used to create the widget directory. It is also the name used when the widget is created on the Commerce Cloud instance.

Is the new widget global? (Global widgets are loaded on every page but have NO display template.)

Global widgets are a way to include common JavaScript code across every page layout in the store. A global widget can have only a single instance.

Note that a global widget is not the same as a global ViewModel. Should you create observable properties in your global widget, they will not be automatically available in any ViewModel.

Does the new widget require internationalization?

Internationalized widgets require additional resource bundles, which are created if you answer yes.

Is the new widget configurable?

If you answer yes , you are indicating that the widget requires user configurable meta data. Refer to the Developing Widgets guide for information on configuring widgets.

Should the new widget contain example source code?

If you respond yes, the generated widget will contain various instructions and examples to assist those new to widget development.

Should the new widget be sent to the instance immediately?

If you respond yes, the new widget will be created as an extension on the target Commerce Cloud instance. If you answer no, the widget is created the next time you do a putAll or transferAll.

After you have answered all of the questions, the responses are validated and a skeleton widget is created. Once the ccw has been created, it is sent to the server as an extension., unless the –noSync option has been supplied. Once you get the response that the upload is successful, you can drag the widget onto a layout.

Delete a widget with the ccw utility

The ccw utility creates widgets as extensions, allowing you to delete a previously created widget by deactivating and deleting the corresponding extension.

To delete the widget from your local disk after you have deleted the extension, issue the following command:

ccw –-grab –-clean

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