mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
Publish VSCode extension
This commit is contained in:
13
packages/bun-vscode/.gitignore
vendored
13
packages/bun-vscode/.gitignore
vendored
@@ -1,3 +1,10 @@
|
||||
node_modules
|
||||
extension
|
||||
example/.vscode
|
||||
# Project files
|
||||
|
||||
/node_modules
|
||||
/extension
|
||||
/example/.vscode
|
||||
/.vscode-test
|
||||
|
||||
# macOS files
|
||||
|
||||
.DS_Store
|
||||
|
||||
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "bun-vscode",
|
||||
"version": "0.0.13",
|
||||
"version": "0.0.15",
|
||||
"author": "oven",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -8,11 +8,13 @@
|
||||
},
|
||||
"main": "dist/extension.js",
|
||||
"devDependencies": {
|
||||
"@types/bun": "^1.1.10",
|
||||
"@types/vscode": "^1.60.0",
|
||||
"@vscode/debugadapter": "^1.56.0",
|
||||
"@vscode/debugadapter-testsupport": "^1.56.0",
|
||||
"@vscode/test-cli": "^0.0.10",
|
||||
"@vscode/test-electron": "^2.4.1",
|
||||
"@vscode/vsce": "^2.20.1",
|
||||
"bun-types": "^0.7.3",
|
||||
"esbuild": "^0.19.2",
|
||||
"typescript": "^5.0.0"
|
||||
},
|
||||
@@ -43,6 +45,7 @@
|
||||
"build": "node scripts/build.mjs",
|
||||
"pretest": "bun run build",
|
||||
"test": "node scripts/test.mjs",
|
||||
"dev": "vscode-test --config scripts/dev.mjs",
|
||||
"prepublish": "npm version patch && bun run build",
|
||||
"publish": "cd extension && bunx vsce publish"
|
||||
},
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
import { buildSync } from "esbuild";
|
||||
import { execSync } from "node:child_process";
|
||||
import { cpSync, mkdirSync, rmSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
import { dirname } from "node:path";
|
||||
|
||||
let { pathname } = new URL("..", import.meta.url);
|
||||
if (process.platform === "win32") {
|
||||
pathname = path.normalize(pathname).substring(1); // remove leading slash
|
||||
}
|
||||
process.chdir(pathname);
|
||||
process.chdir(dirname(import.meta.dirname));
|
||||
|
||||
buildSync({
|
||||
entryPoints: ["src/extension.ts", "src/web-extension.ts"],
|
||||
|
||||
26
packages/bun-vscode/scripts/dev.mjs
Normal file
26
packages/bun-vscode/scripts/dev.mjs
Normal file
@@ -0,0 +1,26 @@
|
||||
import { defineConfig } from "@vscode/test-cli";
|
||||
import { dirname, join } from "node:path";
|
||||
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
||||
|
||||
const workspacePath = dirname(import.meta.dirname);
|
||||
const vscodePath = join(workspacePath, ".vscode-test");
|
||||
const vscodeTestPath = join(vscodePath, "launch.test.js");
|
||||
|
||||
if(!existsSync(vscodeTestPath)) {
|
||||
mkdirSync(vscodePath, { recursive: true });
|
||||
writeFileSync(vscodeTestPath, `// Generated by ${import.meta.filename}
|
||||
// A test that intentionally waits forever and does nothing,
|
||||
// so you can debug and test the VSCode extension in a clean environment.
|
||||
suite("VSCode extension", function () {
|
||||
this.timeout(Number.MAX_SAFE_INTEGER);
|
||||
test("wait forever", (done) => {});
|
||||
});
|
||||
`);
|
||||
}
|
||||
|
||||
export default defineConfig({
|
||||
workspaceFolder: join(workspacePath, "example"),
|
||||
extensionDevelopmentPath: workspacePath,
|
||||
skipExtensionDependencies: true,
|
||||
files: vscodeTestPath,
|
||||
});
|
||||
@@ -1,12 +1,8 @@
|
||||
import { exec } from "node:child_process";
|
||||
import { readdirSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
import { dirname } from "node:path";
|
||||
|
||||
let { pathname } = new URL("..", import.meta.url);
|
||||
if (process.platform === "win32") {
|
||||
pathname = path.normalize(pathname).substring(1); // remove leading slash
|
||||
}
|
||||
process.chdir(pathname);
|
||||
process.chdir(dirname(import.meta.dirname));
|
||||
|
||||
let extPath;
|
||||
for (const filename of readdirSync("extension")) {
|
||||
@@ -20,6 +16,6 @@ if (!extPath) {
|
||||
throw new Error("No .vsix file found");
|
||||
}
|
||||
|
||||
exec(`code --new-window --install-extension=${path} --extensionDevelopmentPath=${pathname} example`, {
|
||||
exec(`code --new-window --install-extension=${extPath} --extensionDevelopmentPath=${process.cwd()} example`, {
|
||||
stdio: "inherit",
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user