diff --git a/package.json b/package.json index baa2397..657be96 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "vscode-syncing", "displayName": "vscode-syncing", "description": "vscode-syncing extension", - "version": "0.2.2", + "version": "0.2.3", "publisher": "sunerpy", "icon": "resources/logo.png", "engines": { @@ -15,7 +15,6 @@ "categories": [ "Other" ], - "activationEvents": [], "main": "./dist/extension.js", "contributes": { "commands": [ @@ -125,12 +124,13 @@ "prepare": "husky", "lint": "eslint src", "format": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,css,md}\"", - "vscode:prepublish": "pnpm run package", + "vscode:prepublish": "npm run esbuild-base -- --minify", + "esbuild-base": "esbuild ./src/extension.ts --bundle --outfile=dist/extension.js --external:vscode --format=cjs --platform=node", "compile": "pnpm run check-types && pnpm run lint && node esbuild.js", "watch": "npm-run-all -p watch:*", "watch:esbuild": "node esbuild.js --watch", "watch:tsc": "tsc --noEmit --watch --project tsconfig.json", - "package": "pnpm run check-types && pnpm run lint && node esbuild.js --production", + "package": "pnpm run vscode:prepublish", "package:vsix": "pnpm run package && pnpm vsce package --no-dependencies", "compile-tests": "tsc -p . --outDir out", "watch-tests": "tsc -p . -w --outDir out", @@ -168,8 +168,5 @@ "prettier": "3.6.2", "typescript": "^5.8.3" }, - "packageManager": "pnpm@9.4.0+sha512.f549b8a52c9d2b8536762f99c0722205efc5af913e77835dbccc3b0b0b2ca9e7dc8022b78062c17291c48e88749c70ce88eb5a74f1fa8c4bf5e18bb46c8bd83a", - "dependencies": { - "jsonc-parser": "^3.3.1" - } -} + "packageManager": "pnpm@9.4.0+sha512.f549b8a52c9d2b8536762f99c0722205efc5af913e77835dbccc3b0b0b2ca9e7dc8022b78062c17291c48e88749c70ce88eb5a74f1fa8c4bf5e18bb46c8bd83a" +} \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ae5d763..78502f8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -7,10 +7,6 @@ settings: importers: .: - dependencies: - jsonc-parser: - specifier: ^3.3.1 - version: 3.3.1 devDependencies: '@types/mocha': specifier: ^10.0.10 diff --git a/src/dataCollector.ts b/src/dataCollector.ts index 6361dd7..d784803 100644 --- a/src/dataCollector.ts +++ b/src/dataCollector.ts @@ -17,7 +17,6 @@ import { getPlatform, } from './utils/vscodeEnvironment'; import { VSCodeEdition, Platform } from './types/vscodeEdition'; -import * as jsonc from 'jsonc-parser'; export class DataCollector { public readonly vscodeEdition: VSCodeEdition; @@ -107,13 +106,13 @@ export class DataCollector { // 获取用户设置 const userSettings = this.getUserSettings(); if (userSettings) { - settings.user = userSettings; + (settings as any).user = userSettings; } // 获取工作区设置 const workspaceSettings = this.getWorkspaceSettings(); if (workspaceSettings) { - settings.workspace = workspaceSettings; + (settings as any).workspace = workspaceSettings; } return settings; @@ -215,12 +214,11 @@ export class DataCollector { return snippets; } - private getUserSettings(): Record | null { + private getUserSettings(): string | null { try { const settingsPath = this.getUserSettingsPath(); if (fs.existsSync(settingsPath)) { - const content = fs.readFileSync(settingsPath, 'utf8'); - return jsonc.parse(content); + return fs.readFileSync(settingsPath, 'utf8'); } } catch (error) { if (this.outputChannel) { @@ -230,14 +228,13 @@ export class DataCollector { return null; } - private getWorkspaceSettings(): Record | null { + private getWorkspaceSettings(): string | null { try { if (vscode.workspace.workspaceFolders) { const workspaceFolder = vscode.workspace.workspaceFolders[0]; const settingsPath = path.join(workspaceFolder.uri.fsPath, '.vscode', 'settings.json'); if (fs.existsSync(settingsPath)) { - const content = fs.readFileSync(settingsPath, 'utf8'); - return jsonc.parse(content); + return fs.readFileSync(settingsPath, 'utf8'); } } } catch (error) { diff --git a/src/types/types.ts b/src/types/types.ts index 01b4cb9..48da048 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -24,8 +24,8 @@ export interface ExtensionsExport { } export interface SettingsExport { - user?: Record; - workspace?: Record; + user?: string; + workspace?: string; } export interface ThemeInfo {