@bravetheskies/moonbase-cli

A CLI for creating and developing a Moonbase Shopify theme

Usage no npm install needed!

<script type="module">
  import bravetheskiesMoonbaseCli from 'https://cdn.skypack.dev/@bravetheskies/moonbase-cli';
</script>

README

AIM

  • Provide an easy to use CLI for generating, working on & managing Moonbase projects
  • Ability to create a new Moonbase project from the command line
  • Ability to connect the local project to a shopify store
  • Ability to start theme development using moonbase start
  • Allows us to clean up the Moonbase project repository by removing ugly javascript files and configs.
  • Potential to add automatic module imports:
    • Ability to add a module using moonbase add {module}
    • This will clone the selected repo and integrate with the theme
    • Any javascript imports will be automatically imported during compile-time using moonbase start

Why

  • Easy, faster development, especially for creating a theme
  • If the client requests theme files, they don't receive any confusing compiler code
  • Prevents potential for compiler changes between Moonbase themes
  • Moonbase compiler will always be up-to-date and only needs to be installed once on a machine
  • We can update a module once in the repo, and it would push the update to all themes during compile-time

Getting started

To install the CLI, open a terminal and run the following command (the -g flag tells the module to install globally):

npm install @bravetheskies/moonbase-cli -g

Commands

Command Flags Implemented?
moonbase Moonbase's CLI Menu n/a yes
- create Create a moonbase project from scratch --name --password --store --connect yes
- connect Connect moonbase to a Shopify store & git repository --name --password --store --project yes
- start Start local development --project yes
- open Open store on a theme preview --project yes
- add Automatically import (or update) a moonbase module
- update Check for updates to the moonbase cli package yes

Flags

You don't need to include flags with the command as it will run you through the setup, but if you want to make things quicker you can include a flag in the initial command to skip some of the steps.

Usage: moonbase {func} {flags}

Example: moonbase create --name=MyTheme

Flag
--name Project name
--password Shopify API password
--store Store .myshopify.com domain
--connect (Boolean) Connect to store once project is created?
--theme Theme id (if not creating a new theme)

Example usage with all flags: moonbase create --name=myproject --connect=true --password=xxx --store=example.myshopify.com --theme=123

Contributing

Contributions are welcome! To get started clone this repository, install dependencies, and you can start the CLI by running node bin/moonbase from the projects root directory.

Windows PowerShell Security Policy Issues

If you're using Windows' PowerShell, you may recieve a security message along the lines of the following:

moonbase : File C:\Users\BTS\AppData\Roaming\npm\moonbase.ps1 cannot be loaded because running scripts is disabled on this system...

This is a security feature of PowerShell to prevent running unsigned scripts. To fix this, run PowerShell as an Administrator, and enter: Set-ExecutionPolicy RemoteSigned