Skip to content

Beacon CLI

The Beacon CLI is installed locally on the developers machine and constantly updates files being added, edited and deleted.

Installation

  1. Clone the cli
shell
git clone git@bitbucket.org:dearnex/beacon-cli
  1. Install the node_modules
shell
yarn install
  1. Setup the beacon command
shell
yarn link
  1. Create a new .env file
dotenv
API_URL=https://platform.dearnex.cloud/api/v1
API_KEY=

DEV_API_URL=
DEV_API_KEY=

INFO

DEV_* keys are only required if you are also working on the codebase for the main Beacon application, if not this key is not necessary.

  1. Create your api key in Beacon

Open up https://platform.dearnex.cloud and click the user icon in the header > settings > developer

From here create a new API with any name you like and copy and paste the generated key into your .env file like so:

dotenv
API_KEY=5|Nz6mMbfe3TCQNIjpzAHn76TlFkwqodEytI7zUMvj

Load the themes

With the CLI it doesn't matter how many themes you manage, all the names and paths to your themes are in the themes.json file. If you do not have a themes.json in the root directory, create one.

Default layout of themes.json

json
{
    "live": {
        
    },
    "dev": {
        
    }
}

If you are using the development version of Beacon you will want to use the "dev" key, this will manage all the themes you're working on locally. "live" will push them all to the production system.

Add a theme the themes.json

You'll first need the theme reference code which you can get by visiting the admin section in Beacon. Once viewing a theme copy the reference

json
{
    "my-first-theme": {
        "id": "[PASTE REFERENCE HERE]",
        "path": "C:\\Path\\To\\Theme"
    }
}

The key of your theme is what will be used by the command-line to watch for changes.

Run the CLI

To run the cli it's easy, just type the below command.

shell
beacon watch my-first-theme

If you want to run a development theme, you can simply append dev to the end of the command. Just make sure that you've got the theme loaded in dev in themes.json and that the id being used is from the development version of Beacon and not production.

shell
beacon watch my-first-theme dev

Where my-first-theme is used, switch it out for any key for any theme you're working on.

WARNING

If you delete files while the watcher is not running, those changes will not be reflected and you will need to re-add the file using touch views/my-deleted-file.blade.php and then delete it again while the watcher is running.

Limitations

  • Adding new folders requires the command is restarted
  • There are no testing environments in production (atm) so any changes you make will be distributed to all active websites using that theme