Skip to content

Commit

Permalink
Use a rbxm file for the plugin (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
tacheometry committed Feb 19, 2023
1 parent c41f013 commit b17bfed
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
3 changes: 2 additions & 1 deletion extension/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ dist
node_modules
*.tsbuildinfo
*.vsix
*.rbxmx
*.rbxmx
*.rbxm
4 changes: 4 additions & 0 deletions extension/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
4 changes: 2 additions & 2 deletions extension/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}
],
"license": "GPL-3.0",
"version": "2.1.2",
"version": "2.1.3",
"engines": {
"vscode": "^1.74.0"
},
Expand All @@ -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\"",
Expand Down Expand Up @@ -158,7 +158,7 @@
"category": "TestEZ Companion"
},
{
"title": "Save plugin .rbxmx",
"title": "Save plugin .rbxm",
"command": "testez-companion.buildPlugin",
"category": "TestEZ Companion"
},
Expand Down
11 changes: 8 additions & 3 deletions extension/src/vscode/commands/installPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand All @@ -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}`
Expand All @@ -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":
Expand Down

0 comments on commit b17bfed

Please sign in to comment.