powershell
Xmcloud Project Bootup

Sitecore XM Cloud project bootup

Why it is needed?

As I started working on the Sitecore xm cloud project, I realized that there were certain repetitive tasks that developers had to perform every day. This process was not efficient, and I decided to invest my time in writing a script that would automate these tasks. By doing so, I would save time and be able to use that extra time to do something more productive.

Project bootup script

The script will carry out the activities listed below.

  1. Start the docker desktop if not running.
  2. Launch vscode as administrator with font-end project.
  3. Execute the powershell script that will spin up the Docker containers.
  4. Start JSS the project in the connected mode.
xmcloud-project-bootup.bat
::Start the Docker Desktop
powershell -Command Start-Process -Verb RunAs -FilePath  'C:\Program Files\Docker\Docker\Docker Desktop.exe' -Wait
 
::open the starter project in vscode
powershell -Command Start-Process -Verb RunAs code "C:\Projects\xm-cloud\xm-cloud\src\sxastarter"
 
::spin up the container and start the fed starter project in connected mode
powershell -Command "Start-Process -Verb RunAs powershell '-NoExit -ExecutionPolicy Bypass -Command cd \\\"C:\Projects\xm-cloud\xm-cloud\\\"; & \\\".\up.ps1\\\"; cd \\\"C:\Projects\xm-cloud\xm-cloud\src\sxastarter\\\"; npm run \\\"start:connected\\\"' "

This script is tested on windows 11 and required to update the path as per the need.