This is a repository of tools that can be used when using the PlayCanvas editor.
playcanvas-tools command
Command list
- init
- download
- upload
- archive
- sw
Arguments
- -t token
- -p projectId
- -s scenes
- -b branchId
- -n projectName
- -r remotePath
yarn global add playcanvas-tools
Create a config file (playcanvas.json
)
playcanvas-cli init
cd projectname
playcanvas-cli download
playcanvas-cli sw --name cachename
<!-- index.html -->
...
<script>
if ("serviceWorker" in navigator) {
navigator.serviceWorker.register("./serviceWorker.js").then(function (registration) {
if (typeof registration.update == "function") {
registration.update();
}
})
.catch(function (error) {
console.log("Error Log: " + error);
});
}
</script>
...
https://developer.mozilla.org/ja/docs/Mozilla/Add-ons/WebExtensions/manifest.json
{
"name": "**projectname**",
"short_name": "**projectname**",
"icons": [
{
"src": "**logo**",
"sizes": "192x192",
"type": "image/png"
}
],
"start_url": "./index.html",
"display": "standalone",
"background_color": "#f16625",
"theme_color": "#f16625"
}
You can create it interactively with the playcanvas-cli init
command, but you can create playcanvas.json
by entering it as a one-line command in CI etc.
$ playcanvas-cli <input>
Options(required)
--accessToken -t
--projectId -p
--scenes -s
--branchId -b
--projectName -n
--remotePath -r
Examples
CircleCI
--------
$ playcanvas-cli --accessToken "$PLAYCANVAS_ACCESS_TOKEN" --projectId "$PLAYCANVAS_PROJECT_ID" --scenes "$PLAYCANVAS_SCENES" --branchId "PLAYCANVAS_BRANCH_ID" --projectId "$PLAYCANVAS_PROJECT_ID" --remotePath "$PLAYCANVAS_REMOTE_PATH"
$ playcanvas-cli -t "$PLAYCANVAS_ACCESS_TOKEN" -p "$PLAYCANVAS_PROJECT_ID" -s "$PLAYCANVAS_SCENES" -b "PLAYCANVAS_BRANCH_ID" -n "$PLAYCANVAS_PROJECT_NAME" --r "$PLAYCANVAS_REMOTE_PATH"
--------
$ playcanvas-cli -t token -p projectId -s scenes -b branchId -n projectName -r remotePath