From b17bfed03c45a552037e9dff56529ec041c16731 Mon Sep 17 00:00:00 2001 From: tacheometry <39647014+tacheometry@users.noreply.github.com> Date: Mon, 20 Feb 2023 01:30:59 +0200 Subject: [PATCH] Use a rbxm file for the plugin (#13) --- extension/.gitignore | 3 ++- extension/CHANGELOG.md | 4 ++++ extension/package-lock.json | 4 ++-- extension/package.json | 6 +++--- extension/src/vscode/commands/installPlugin.ts | 11 ++++++++--- 5 files changed, 19 insertions(+), 9 deletions(-) diff --git a/extension/.gitignore b/extension/.gitignore index bce03a9..d19a293 100644 --- a/extension/.gitignore +++ b/extension/.gitignore @@ -2,4 +2,5 @@ dist node_modules *.tsbuildinfo *.vsix -*.rbxmx \ No newline at end of file +*.rbxmx +*.rbxm diff --git a/extension/CHANGELOG.md b/extension/CHANGELOG.md index 737ed5d..b6c624c 100644 --- a/extension/CHANGELOG.md +++ b/extension/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.1.3 + +- Now using a `rbxm` file for the plugin instead of `rbxmx`. + ## 2.1.2 - Fix install command creating a directory with the file name. diff --git a/extension/package-lock.json b/extension/package-lock.json index 623aa88..449821c 100644 --- a/extension/package-lock.json +++ b/extension/package-lock.json @@ -1,12 +1,12 @@ { "name": "testez-companion", - "version": "2.1.2", + "version": "2.1.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "testez-companion", - "version": "2.1.2", + "version": "2.1.3", "license": "GPL-3.0", "dependencies": { "ajv": "^8.11.2", diff --git a/extension/package.json b/extension/package.json index c203394..21eb183 100644 --- a/extension/package.json +++ b/extension/package.json @@ -11,7 +11,7 @@ } ], "license": "GPL-3.0", - "version": "2.1.2", + "version": "2.1.3", "engines": { "vscode": "^1.74.0" }, @@ -35,7 +35,7 @@ "scripts": { "vscode:prepublish": "npm run build", "build": "webpack build --mode production --config ./webpack.config.js && npm run build:plugin", - "build:plugin": "cd ../plugin && rojo build -o '../extension/TestEZ Companion.rbxmx'", + "build:plugin": "cd ../plugin && rojo build -o '../extension/TestEZ_Companion.rbxm'", "watch": "webpack watch --mode development --config ./webpack.config.js", "test": "jasmine --config=./jasmine.json", "test:watch": "nodemon --ext ts --exec \"npm test\"", @@ -158,7 +158,7 @@ "category": "TestEZ Companion" }, { - "title": "Save plugin .rbxmx", + "title": "Save plugin .rbxm", "command": "testez-companion.buildPlugin", "category": "TestEZ Companion" }, diff --git a/extension/src/vscode/commands/installPlugin.ts b/extension/src/vscode/commands/installPlugin.ts index a0cc9e5..7fcdef7 100644 --- a/extension/src/vscode/commands/installPlugin.ts +++ b/extension/src/vscode/commands/installPlugin.ts @@ -3,14 +3,15 @@ import * as path from "path"; import * as fs from "fs"; import * as os from "os"; -const RBXMX_NAME = "TestEZ Companion.rbxmx"; +const RBXM_NAME = "TestEZ_Companion.rbxm"; const copyPlugin = async (sourceFile: string, destinationDir: string) => { const showError = (message: string) => vscode.window.showErrorMessage( `An error occured while trying to copy the plugin to ${destinationDir} (Error: ${message})` ); - const fullDestination = path.join(destinationDir, RBXMX_NAME); + const fullDestination = path.join(destinationDir, RBXM_NAME); + const oldPlugin = path.join(destinationDir, "TestEZ Companion.rbxmx"); await fs.promises .mkdir(destinationDir, { @@ -21,6 +22,10 @@ const copyPlugin = async (sourceFile: string, destinationDir: string) => { }); fs.promises .copyFile(sourceFile, fullDestination) + .then(() => fs.promises.rm(oldPlugin)) + .catch((e) => { + if (e.code !== "ENOENT") showError(e.message); + }) .then(() => vscode.window.showInformationMessage( `Successfully copied the plugin to ${fullDestination}` @@ -30,7 +35,7 @@ const copyPlugin = async (sourceFile: string, destinationDir: string) => { }; export default async () => { - const pluginPath = path.join(__dirname, "..", RBXMX_NAME); + const pluginPath = path.join(__dirname, "..", RBXM_NAME); switch (os.platform()) { case "win32":