Upload Code for SFRA
You can use the SFRA command-line upload tool to upload your code.
-
In the cartridge you want to upload, locate, or create a
dw.json
file.Thedw.json
file is automatically created if thesgmf-scripts
createCartridge
build tool command is used to create the cartridge. However, for some cartridges, such as theapp_storefront_base
andmodules
cartridges provided by B2C Commerce, you must create thedw.json
file and add it to the cartridge. Create thedw.json
file in the top-level folder of the repository, as a sibling of thecartridges
directory.Thedw.json
file contains the information required to establish a server connection and the code version to upload your cartridges to.{ "hostname": "yoursandbox-inside-your-realm.demandware.net", "username": "yourusername", "password": "yourpwd", "code-version": "version1" }
CAUTION:This file is normally unencrypted. However, because it contains the instance and password data necessary to upload code, you can use extra measures to secure it. -
To upload the code, use the applicable command.
-
To upload all cartridges for the repository, use
uploadCartridge
:npm run uploadCartridge
-
To upload a specific cartridge, use
uploadCartridge
with the name of the cartridge:npm run uploadCartridge mycartridge
-
To upload a single file, use
upload
.If you use the same commands as the app_storefront_base cartridge, run:npm run upload path/to/my/filename.ext
-
To detect changes to files in your cartridge and automatically upload them to the server, use
watch
.If you use the same commands as theapp_storefront_base
cartridge, run:npm run watch
The
watch
command makes it simple to keep the code on your sandbox instanace up-to-date.
-
-
Make sure that your code is actually on the server:
- Select Administration > Site Development > Code Deployment.
-
Click the Code Version link for the code version you
specified in the
dw.json
file.If your cartridge was uploaded successfully, it appears in the list of cartridges on the Version Summary page.
The command-line watch
and upload
commands are wrappers
for the Dwupload project. Download the project from GitHub if you want to
contribute.
Infocenter Retirement: On June 30, 2023, the Infocenter was retired, and documentation currently hosted on the Infocenter will be published to Salesforce Help, Commerce Cloud Developer Center, and Salesforce B2C Commerce Developer Documentation Resources. For more information, see the release note.