-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: setup esbuild for bundling typescript (#16)
use the bundling extensions documentation as a guide for setting up esbuild. unfortunately, esbuild is necessary since bun does not support the "cjs" output format yet, which is required for vscode extensions. see: https://code.visualstudio.com/api/working-with-extensions/bundling-extension#using-esbuild
- Loading branch information
Showing
8 changed files
with
73 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "build extension", | ||
"type": "shell", | ||
"command": "bun run build" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { build } from "esbuild"; | ||
|
||
const isProduction = process.argv.includes("--production"); | ||
|
||
// see: https://code.visualstudio.com/api/working-with-extensions/bundling-extension#using-esbuild | ||
await build({ | ||
entryPoints: [ | ||
"static/**/*", | ||
"theme/**/*", | ||
"src/extension.ts", | ||
"package.json", | ||
"package.nls.json", | ||
"CHANGELOG.md", | ||
"LICENSE.md", | ||
"README.md", | ||
], | ||
loader: { | ||
".json": "copy", | ||
".md": "copy", | ||
".png": "copy", | ||
".svg": "copy", | ||
}, | ||
outdir: "dist", | ||
external: ["vscode"], | ||
format: "cjs", | ||
platform: "node", | ||
bundle: true, | ||
sourcesContent: false, | ||
minify: isProduction, | ||
sourcemap: !isProduction, | ||
}); | ||
|
||
if (isProduction) { | ||
const { createVSIX } = await import("@vscode/vsce"); | ||
await createVSIX({ cwd: "dist" }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import * as vscode from "vscode"; | ||
|
||
export function activate(context: vscode.ExtensionContext) { | ||
console.log(`[${context.extension.id}] active`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"extends": ["@tsconfig/bun", "@tsconfig/strictest"], | ||
"include": ["scripts", "src"] | ||
} |