Xsolla Backend Script Manager for VSCode
This extension lets you manage the scripts of an Xsolla Backend powered backend
cluster. Quickly and easily download all the live scripts running in your XBE cluster, make and save edits and publish
your changes. Published changes will take effect immediately so there's no need to restart any services.
This extension uses the Source Control Manager interface to make it easy to manage your cluster's scripts.
Features
The Xsolla Backend Script Manager provides several key features:
- Checkout scripts from an Xsolla Backend cluster.
- Generate a package.json with required dependencies.
- Add, modify, or delete service scripts locally in your workspace.
- Commit local changes to the remote server as unpublished.
- View and diff local and remote changes.
- Publish or delete unpublished remote script changes.
- Commands:
xbe.checkout
| Connect to an Xsolla Backend powered cluster and synchronize scripts.
xbe.commit
| Save all local changes to the remote server as unpublished.
xbe.commit-script
| Save local changes for a specific script to the remote server as unpublished.
xbe.revert
| Reverts all uncommitted local changes to files in the current workspace.
xbe.revert-script
| Revert all local changes made to a specific script.
xbe.publish
| Publish all unpublished remote changes.
xbe.publish-script
| Publish the remote changes for a specific script.
xbe.delete-unpublished
| Clear all unpublished remote changes from the server.
xbe.delete-unpublished-script
| Clear unpublished remote changes for a specific script.
Contents
[TOC]
Initial Setup
Account
See our [account quickstart guide] - or
use the demo account credentials for
learning purposes.
Environment
- Create an empty folder for your workspace, name it something like
xbe-scripts
.
- Open a new Visual Studio Code window and open your folder via File -> Open Folder...
- Save a new workspace file (e.g.
xbe-scripts.code-workspace
) to your folder via File -> Save Workspace As...
Installation
- Navigate to the Extensions panel (or press
Ctrl+Shift+X
).
- In the search bar, type
Xsolla Backend
and select the Xsolla Backend Script Manager.
- Click the Install button to add the extension to Visual Studio Code.
You’re now ready to synchronize scripts from your Xsolla Backend cluster.
Tutorials
The following tutorial sections will guide you through:
- Checking out scripts (below)
- Modifying and reverting local changes
- Commiting changes to the remote server
- Publishing (or discarding) remote changes
- Deleting scripts
Step 1: Checking Out Cluster Scripts
Viewing Extension Output
It can be helpful to view the extension output to monitor the synchronization process:
- Open the Output panel in Visual Studio Code (
Ctrl+Shift+U
).
- In the dropdown menu, select Xsolla Backend to view extension output.
Synchronizing Cluster Scripts
Once your workspace is set up, you can synchronize scripts from your Xsolla Backend cluster:
- Open the Command Palette (
Ctrl+Shift+P
).
- In the input prompt, type
xbe: checkout
and press Enter.
- You will be prompted for:
- Host: This is the base API URL of your Xsolla Backend cluster (e.g.
https://api.demo.xbe.goxbe.cloud/v1
).
- Service: Select one of the available live scripting services from the list shown.
- Username: Enter the username of an account with
admin
role.
- Password: Enter the account password.
- Dependencies: Choose whether to write a package.json file.
Once synchronization is complete, you’ll notice several new files and folders in your workspace. This includes your
scripts and configuration files downloaded from the selected service, a .vscode
folder containing your service
settings, and if specified, a package.json
file containing the relevant dependencies.
Connection settings are stored in your workspace file (such as xbe-scripts.code-workspace
) under settings
.
These consist of your cluster API base URL as well as your cached authentication token, which will be used to
reconnect to the cluster as needed. If your token expires you will be prompted for a username and password once
again and a new token will replace it. Your workspace file should look similar to this:
{
"folders": [
{
"path": "."
}
],
"settings": {
"xbe.host": "https://api.demo.xbe.goxbe.cloud/v1",
"xbe.token": "..."
}
}
Service-specific settings are stored in the .vscode/settings.json
file in your workspace. These include the service
name and install dependencies selections you entered, for example:
{
"xbe.service": "scripting-services",
"xbe.installDependencies": true
}
Step 2: Modifying/Reverting Local Script Changes
Editing a Script
- Open
MetricsCollector.ts
from the jobs
folder.
- Make an edit to the script and save the file.
- Notice that the Source Control icon now shows one pending change.
Viewing Changes
- Click the Source Control icon to see two categories: Changed Local Scripts and Unpublished Remote Scripts.
- The Changed Local Scripts category shows locally modified scripts, allowing you to view diffs between your
local version and the remote server version:
Discarding Local Changes
- In the Source Control panel, locate the
MetricsCollector.ts
file under the Changed Local Scripts
section.
- Click on the
Discard Local Changes
button next to the file name.
- This will discard any local modifications and restore the file to its original state as it exists on the remote
server.
- The pending change indicator will be cleared, confirming that your local changes have been successfully reverted.
Step 3: Committing Changes to the Remote Server
Creating a New Script
In your workspace, create a new file called TestScript.ts
.
Add the following code to TestScript.ts
as an example:
const testNumber: number = 5;
Save the file, and you will see that the Source Control icon shows one pending change.
Committing Changes
- Open the Source Control panel by clicking on the Source Control icon in the left sidebar.
- You will see
TestScript.ts
listed under the Changed Local Scripts section.
- Click the
Commit Local Changes
button next to TestScript.ts
to commit the file.
- You will be prompted to enter a commit message.
- Press Enter to save the changes to the remote server.
Once the commit operation is successful, the script will move from the Changed Local Scripts section to the *
Unpublished Remote Scripts* section, indicating that it has been saved to the remote server but is not yet live.
Editing Unpublished Remote Scripts
- If you wish to make further changes to an unpublished script prior to publishing, simply edit it in your workspace
commit it again. The updated version will replace the previous unpublished version.
Committing All Local Changes
- You can commit all local changes at once by clicking the Commit All Local Changes button in the Source Control
panel. This will commit all pending changes in the Changed Local Scripts section to the remote server.
Step 4: Publishing/Discarding Unpublished Remote Changes
If you are ready to make the script live, click the Publish Committed Changes button.
- This action publishes the script to the Xsolla Backend cluster, making it live and executable once the server
restarts.
- If your server is configured to restart on publish, the server will restart immediately after a configured
timeout.
If you decide that you no longer want to keep the unpublished changes, you can delete the script instead of
publishing it by clicking Discard Committed Changes button.
- Note: Discarding an unpublished script will not affect the published version that is currently live on the server.
Step 5: Deleting Scripts
In this step, we will delete the TestScript.ts
file locally, commit the deletion, and publish the change to remove
it from the remote server. Deletion of a script is treated like any other change in the Xsolla Backend Script Manager:
- In your workspace, delete the file
TestScript.ts
and open the Source Control panel.
- You will notice that
TestScript.ts
appears crossed out under the Changed Local Scripts section,
indicating that it has been deleted locally.
- In the Source Control panel, Commit your local changes to
TestScript.ts
.
- After committing the deletion,
TestScript.ts
will move to the Unpublished Remote Scripts section.
- To finalize the deletion click Publish Committed Changes .
- This will publish the deletion of
TestScript.ts
from the Xsolla Backend cluster, and it will no longer
be loaded.
Contribute
See instructions to install from source