Simplifying playcanvas-sync for multi-project workflows

I’ve been using playcanvas-sync to manage PlayCanvas scripts locally and edit them with my preferred IDE. It’s great, but I ran into one major issue:

The .pcsync config file has to be saved in the home directory.
This makes it difficult to:

  • Work on multiple PlayCanvas projects at the same time
  • Quickly switch between projects without editing that file over and over

My Solution

I made a small enhancement to make playcanvas-sync easier to use for multi-project setups:

  1. Added pcconfig.json in the project root: no need to touch your home directory anymore
  2. Updated ./src/utils/config-vars.js: so the tool reads from pcconfig.json

How to use it

If you want to try my solution:

  1. Download the updated config-vars.js file from this post and place it in:
    ./src/utils/config-vars.js
  2. Download pcconfig.json and place it in your project root, and replace your ids

Download here

It doesn’t have to be there: GitHub - playcanvas/playcanvas-sync: Real-time synchronization of files between PlayCanvas and your local machine

Config variables can be set in a file called .pcconfig in your home directory, in pcconfig.json in your target directory (and your remote PlayCanvas branch), or provided as environment variables (which would have the highest precedence).

It can be in one of those three places. I generally use pcconfig.json in your target directory

I think that wording is a little confusing:

Config variables can be set in a file called .pcconfig in your home directory, in pcconfig.json in your target directory (and your remote PlayCanvas branch)...

It might read as if .pcconfig and pcconfig.json are somehow related or part of the same location. I think it would be clearer written as:

There are three ways you can set up the config variables:
1. In a file called `.pcconfig` in your home directory  
2. In `pcconfig.json` in your target directory  
3. As environment variables (which have the highest precedence)

Maybe it’s just me, or my English :grimacing:, but at first glance I found it a bit hard to parse!

1 Like