From 0ac2a598cc8c982e3fd16c9778a3c96f727638bc Mon Sep 17 00:00:00 2001 From: Tyler Chan Date: Sat, 24 Jan 2026 15:34:05 +0800 Subject: [PATCH 1/3] add missing lint conf --- editors/vscode/.eslintrc.json | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 editors/vscode/.eslintrc.json diff --git a/editors/vscode/.eslintrc.json b/editors/vscode/.eslintrc.json new file mode 100644 index 0000000..d41149e --- /dev/null +++ b/editors/vscode/.eslintrc.json @@ -0,0 +1,30 @@ +{ + "root": true, + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": 6, + "sourceType": "module" + }, + "plugins": [ + "@typescript-eslint" + ], + "rules": { + "@typescript-eslint/naming-convention": [ + "warn", + { + "selector": "import", + "format": ["camelCase", "PascalCase"] + } + ], + "@typescript-eslint/semi": "warn", + "curly": "warn", + "eqeqeq": "warn", + "no-throw-literal": "warn", + "semi": "off" + }, + "ignorePatterns": [ + "out", + "dist", + "**/*.d.ts" + ] +} From c17966965f222e6d68760773d2f1b7983b8391e7 Mon Sep 17 00:00:00 2001 From: Tyler Chan Date: Sat, 24 Jan 2026 15:47:25 +0800 Subject: [PATCH 2/3] refactor: update VSCode extension bootstrap logic to handle binary version checks and downloads; remove outdated ESLint naming convention rule --- editors/vscode/.eslintrc.json | 7 ---- editors/vscode/src/bootstrap.ts | 73 +++++++++++++++++++++++++-------- 2 files changed, 55 insertions(+), 25 deletions(-) diff --git a/editors/vscode/.eslintrc.json b/editors/vscode/.eslintrc.json index d41149e..32fc39d 100644 --- a/editors/vscode/.eslintrc.json +++ b/editors/vscode/.eslintrc.json @@ -9,13 +9,6 @@ "@typescript-eslint" ], "rules": { - "@typescript-eslint/naming-convention": [ - "warn", - { - "selector": "import", - "format": ["camelCase", "PascalCase"] - } - ], "@typescript-eslint/semi": "warn", "curly": "warn", "eqeqeq": "warn", diff --git a/editors/vscode/src/bootstrap.ts b/editors/vscode/src/bootstrap.ts index 2973709..6aa710e 100644 --- a/editors/vscode/src/bootstrap.ts +++ b/editors/vscode/src/bootstrap.ts @@ -4,10 +4,16 @@ import * as path from 'path'; import * as https from 'https'; import * as os from 'os'; import { IncomingMessage } from 'http'; +import { exec } from 'child_process'; +import { promisify } from 'util'; + +const execAsync = promisify(exec); const BINARY_NAME = 'naviscope'; const REPO_OWNER = 'biuld'; const REPO_NAME = 'naviscope'; +// Update this version when bundling a new version of the extension +const EXPECTED_VERSION = '0.1.0'; export async function bootstrap(context: vscode.ExtensionContext): Promise { const naviscopeHome = path.join(os.homedir(), '.naviscope'); @@ -23,31 +29,63 @@ export async function bootstrap(context: vscode.ExtensionContext): Promise { try { - await downloadBinary(binaryPath); - vscode.window.showInformationMessage(`Naviscope installed successfully!`); - return binaryPath; - } catch (error) { - vscode.window.showErrorMessage(`Failed to download Naviscope: ${error}`); - if (fs.existsSync(binaryPath)) { - fs.unlinkSync(binaryPath); - } - return undefined; + const { stdout } = await execAsync(`"${binaryPath}" --version`); + // Expected output: "naviscope 0.1.0" + return stdout.includes(EXPECTED_VERSION); + } catch (e) { + console.warn('Failed to check version:', e); + return false; } } @@ -112,7 +150,6 @@ function getPlatformIdentifier(): string | null { if (arch === 'arm64') { return 'macos-aarch64'; } - // Intel Mac is not supported } return null; } From acae1b03bd79486480f173f583a8940362183e2d Mon Sep 17 00:00:00 2001 From: Tyler Chan Date: Sat, 24 Jan 2026 15:55:18 +0800 Subject: [PATCH 3/3] refactor: update build scripts in package.json for VSCode extension; change prepublish script to use 'build' and streamline build process with new commands --- editors/vscode/package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/editors/vscode/package.json b/editors/vscode/package.json index 28382ee..5321087 100644 --- a/editors/vscode/package.json +++ b/editors/vscode/package.json @@ -19,10 +19,11 @@ ], "main": "./dist/extension.js", "scripts": { - "vscode:prepublish": "npm run package", + "vscode:prepublish": "npm run build", + "build": "npm run check-types && npm run lint && node esbuild.js --production", "compile": "npm run check-types && npm run lint && node esbuild.js", "watch": "npm run check-types && npm run lint && node esbuild.js --watch", - "package": "npm run check-types && npm run lint && node esbuild.js --production", + "package": "vsce package", "check-types": "tsc --noEmit", "lint": "eslint src --ext ts", "test": "npm run compile && node ./dist/test/runTest.js"