Before you move forward with the sync tool, you must ensure you can compile the file watching module nsfw, which depends on native module node-gyp. You can create an empty folder and run the following:
npm init -y
npm install nsfw
If you have errors compiling the module, you must resolve them. I have Visual Studio compiler, so I don’t have errors compiling it. I believe you don’t have to use Visual Studio, and other compilers can be used, like mingw. You can google your console error to find a solution.
Once you can install nsfw without errors, you can proceed with the sync tool setup. I would recommend not to use -g flag which installs the tool globally. Generally, try to keep modules locally, unless it is a global tool, like yarn for example.
- Config file.
The tool will need to read the configuration properties, like your project ID, API key, etc. It can read them from multiple files, or from a single file. Depending on your OS, your home directory is different (under Windows it is usually in C:\Users\username).
As such, you can create a.pcconfigin your home directory and add your API key and filtering rules there, e.g.:
{
"PLAYCANVAS_API_KEY": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"PLAYCANVAS_BAD_FILE_REG": "^\\.|~$|jsconfig.json",
"PLAYCANVAS_BAD_FOLDER_REG": "^\\.|typings"
}
And the rest of the configuration keep in pcconfig.json of your playcanvas-sync folder or what have you.
- Example:
-
Create a folder
playcanvas -
Go inside the
playcanvas, and create a new folder for your project, e.g.example -
Go to
playcanvasroot and clone the sync tool to it and install it
mkdir playcanvas
cd playcanvas
mkdir example
git clone https://github.com/playcanvas/playcanvas-sync
cd playcanvas-sync
npm install
- Now, you should have the following folder structure:
playcanvas
|- example
|- playcnavas-sync
- Go to your home dir and add
.pcconfigfile, as in the above example. - Go to your
playcanvas-syncfolder and add apcconfig.json:
{
"PLAYCANVAS_BRANCH_ID": "xxxxxxxxxxxx",
"PLAYCANVAS_PROJECT_ID": xxxxx,
"PLAYCANVAS_TARGET_DIR": "../example"
}
- PLAYCANVAS_BRANCH_ID is
- PLAYCANVAS_PROJECT_ID is
Now you should be ready to use the pcsync, e.g. from playcanvas-sync folder run pcsync pullAll and it should pull all your project files to the example directory.

