Documentation

Read and search through all the Sitecore JSS documentation

JSS CLI

During JSS development, you will be commonly using scripts provided by the JSS CLI (command line interface). These scripts can be run from within a JSS application at your command line of choice (bash, PowerShell, cmd, etc).

Frequently used scripts

These are the main scripts you will be using frequently during JSS development. These were partially covered in Quick start.

jss setup

Runs the interactive setup process where you will optionally provide info about connecting/deploying to a Sitecore instance. The input is saved to scjssconfig.json file in the app root.

Note: for CI deployments, setup accepts arguments to build the config from variables. Use jss setup --help for details.

jss start

Starts the application in disconnected mode. Sitecore is not required, or used even if available. Content comes from local files.

jss start:connected

Starts the application in connected mode, where it connects to Sitecore to retrieve the layout data and content but still runs locally.

jss deploy config

Copies the Sitecore .config file from /sitecore/config to your Sitecore instance's Website/App_Config/zzz folder specified in scjssconfig.json file in the app root. This is a convenience script; you can also manually deploy the JSS app configuration in some other way, or have the config owned by the Sitecore instance instead of the JSS app.

jss deploy app

Shorthand for jss deploy items && jss deploy files. Used to deploy both the app's manifest items (routes, templates, etc) and a production build of the app's code.

jss deploy app accepts all options supported by jss deploy items or jss deploy files.

jss deploy items

When you want to build a manifest and deploy items to Sitecore. This is applicable when using the code-first JSS development methodology.

jss deploy items has many options that enable modifying how the package deploys, such as excluding content items with --noContent. Run jss deploy items --help to see all the options with descriptions.

When run with default options, jss deploy items also runs jss manifest, and jss package. Options for all of these commands may also be passed to deploy items.

Content, media, or dictionary items are excluded by default for safety, in case a content editor has changed the data. To deploy these items, run jss deploy items --includeContent --includeDictionary to deploy everything.

jss deploy files

Builds your application for production (jss build) and copies all of its files to the configured Sitecore instance in scjssconfig.json. No items are deployed, and no manifest is generated.

jss deploy files has many options that enable modifying how the files deploy, such as skipping a build and using existing /dist items with --skipBuild. Run jss deploy files --help to see all the options with descriptions.

When run with default options, jss deploy files also runs jss build.

jss deploy component

When using Sitecore-first/connected development methodology, this command scaffolds out a new component (rendering item, datasource template, and allowed placeholder settings) in Sitecore. The developer must still create the component in the JSS app and add the component to a route with Experience Editor, but this command takes care of the rest. jss deploy component can be used to also modify existing components (e.g. to add fields, change field types, or set display names). On an existing component, only explicitly specified arguments apply (e.g. using --fields will add/modify only the fields specified, and will not delete any other fields.

jss deploy component should never be used if code-first/disconnected development is in use as it does not update the disconnected manifest, only Sitecore items.

jss deploy component has many options that enable modifying how the component is scaffolded, such as specifying datasource template fields with --fields or setting a display name with --displayName. Run jss deploy component --help to see all the options with descriptions.

Other scripts

All scripts you need to run during development are defined either via the jss CLI command (use --help for options) or as package scripts in package.json.

jss build

Creates a production build for deploying to Sitecore. Result - a JS bundle and other static assets under /dist folder.

jss manifest

Runs the app's manifest generation process, which will generate the app manifest file under /sitecore/manifest in app root.

jss manifest has options that enable modifying how the manifest generates, such as --includeContent to add content and routes data to the manifest. Run jss manifest --help to see all the options with descriptions.

Manifest does not include content, media, or dictionary items by default for safety, in case a content editor has changed the data. To include these items, run jss manifest --includeContent --includeDictionary to include everything.

jss package

Creates a Sitecore update package that includes both the app manifest and the production build artifacts.

jss package has many options that enable modifying how the package deploys, such as excluding build artifacts with --noFiles. Run jss package --help to see all the options with descriptions.

When run with default options, jss package also runs jss build and jss manifest. Options for all of these commands may also be passed to package.

jss deploy template

When using Sitecore-first/connected development methodology, this command scaffolds out a new template in Sitecore. jss deploy template can be used to also modify existing templates (e.g. to add fields, change field types, or set display names). On an existing template, only explicitly specified arguments apply (e.g. using --fields will add/modify only the fields specified, and will not delete any other fields.

jss deploy template should never be used if code-first/disconnected development is in use as it does not update the disconnected manifest, only Sitecore items.

jss deploy template has options that enable modifying how the template is scaffolded, such as specifying template fields with --fields or setting a display name with --displayName. Run jss deploy template --help to see all the options with descriptions.


Found a problem? Have something to add? Edit this on GitHub