Upload Code for SFRA

You can use the SFRA command-line upload tool to upload your code.

  1. In the cartridge you want to upload, locate, or create a dw.json file.
    The dw.json file is automatically created if the sgmf-scripts createCartridge build tool command is used to create the cartridge. However, for some cartridges, such as the app_storefront_base and modules cartridges provided by B2C Commerce, you must create the dw.json file and add it to the cartridge. Create the dw.json file in the top-level folder of the repository, as a sibling of the cartridges directory.
    The dw.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"
    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.
  2. 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 the app_storefront_base cartridge, run:
      npm run watch 

      The watch command makes it simple to keep the code on your sandbox instanace up-to-date.

  3. Make sure that your code is actually on the server:
    1. Select Administration > Site Development > Code Deployment.
    2. 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.

X Privacy Update: We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used. By continuing to use this site you are giving us your consent to do this. Privacy Policy.