Subscription Manager Local Development

ūüöö Moving to ReadMe

Our technical documentation is now hosted on ReadMe. This article has already been migrated; check it out there. The Knowledge Center version will be retired on February 29th, 2024.

Develop the Subscription Manager on your local machine or create a Github repo to manage your files using smi-serve. Local development empowers faster, parallelized teamwork and simplifies upgrading and accessing updates through custom scripts and enhanced merge control. 

 


Requirements

  • Make sure you have Node.js installed on your system. If not, you can download and install it from¬†nodejs.org.
  • You must be on the latest version of the Subscription Manager.

Setup smi-serve

To use smi-serve via npx, follow the instructions below. Be sure to create a local directory where you would like the files to be saved before beginning.

 

Step 1: Authentication 

To manage authentication credentials for Ordergroove, execute:

npx @ordergroove/smi-serve auth

This command opens the Ordergroove platform for you to log in. Once you login, you can proceed to the next step. Any errors encountered during the process will be displayed.

 

Step 2: Initialization

To initialize the current directory with the files / assets from your Subscription Manager and start the development server, use:

npx @ordergroove/smi-serve init

You will be prompted to select which files to initialize with:

  • Pull "[YOUR STORE]" templates stored in https://rc3.ordergroove.com/: Select this option to initialize the most recently saved version of your Subscription Manager
  • Fresh install latest version of @ordergroove/smi-templates: Select this option to install the latest version of Ordergroove's theme files for the Subscription Manager

To answer all prompts as yes use: 

npx @ordergroove/smi-serve init -y

To force override local files that are present in the same directory use:

npx @ordergroove/smi-serve init -f

After selecting which files to install, the development server will automatically begin. If you need to restart the development server, or you are begining a new session without installing files, use

npx @ordergroove/smi-serve serve

This command starts the development server and serves assets. The server's behavior can be modified using various options listed in the customization section.

 

Step 3: Deploy Changes to Ordergroove

To deploy changes to Ordergroove, use the deploy command:

npx @ordergroove/smi-serve deploy

This will automatically push changes to your live storefront.

 

Options

You can use a configuration file (.ogrc.json by default) to store settings from the command line. The following option is available:

--configFile or -c: Specify the path to the Ordergroove configuration file. Defaults to .ogrc.json.

This config is auto generated when you login and placed into the current working directory.

 


Customization

The program provides several options to customize its behavior:

  • --verbose or -v: Enable verbose logging.
  • --outdir or -o: Specify the output directory for build artifacts. Defaults to node_modules/.smi-serve-build.
  • --port or -p: Specify the HTTP port for the development server. Defaults to an available free port.
  • --env or -e: Specify the Ordergroove environment: prod or staging. Defaults to prod.
  • --impersonate or -i: Enable customer impersonation.

Example usage with options:

npx @ordergroove/smi-serve serve --verbose --port 8080 --production

 

Integrating with Github

After initializing smi-templates with smi-serve command in Step 2, you can integrate with git.

Step 1: Initialization

Initialize the local directory as a Git repository

$ git init

Step 2: Add Theme Files

Add the theme files in your new local repository. This stages them for the first commit.

$ git add

Step 3: Commit

Commit the files that you’ve staged in your local repository.

$ git commit -m "First commit"

Step 4: Update Remote URL

To add the URL for the remote repository where your local repository will be pushed, run the following command. Replace REMOTE-URL with the repository’s full URL.

$ git remote add origin REMOTE-URL

Step 5: Verify Remote URL

To verify that you set the remote URL correctly, run the following command.

$ git remote -v

Step 6: Push Changes

To push the changes in your local repository to GitHub.com, run the following command.

$ git push -u origin master

This last command will sync local files with the remote repo but it will not sync it with Ordergroove. In order to deploy to OG you can use the deploy command from smi-serve.

 

Comments

0 comments

Article is closed for comments.