Skip to content

Commit eb1e4f6

Browse files
committed
Update version of TS Executor
1 parent 9823907 commit eb1e4f6

File tree

9 files changed

+87
-14
lines changed

9 files changed

+87
-14
lines changed

examples/browser-only/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
},
1717
"theiaPluginsDir": "plugins",
1818
"theiaPlugins": {
19+
"robertjndw.ts-executor-web": "https://github.com/robertjndw/ts-executor-web/releases/download/v0.0.0/ts-executor-web-0.0.1.vsix",
1920
"vscode.typescript": "https://open-vsx.org/api/vscode/typescript/1.95.3/file/vscode.typescript-1.95.3.vsix",
2021
"vscode.typescript-language-features": "https://open-vsx.org/api/vscode/typescript-language-features/1.95.3/file/vscode.typescript-language-features-1.95.3.vsix"
2122
},
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension=".json" ContentType="application/json"/><Default Extension=".vsixmanifest" ContentType="text/xml"/><Default Extension=".mjs" ContentType="application/javascript"/><Default Extension=".md" ContentType="text/markdown"/><Default Extension=".js" ContentType="application/javascript"/><Default Extension=".ts" ContentType="video/mp2t"/><Default Extension=".map" ContentType="application/json"/><Default Extension=".txt" ContentType="text/plain"/><Default Extension=".wasm" ContentType="application/wasm"/></Types>
2+
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension=".json" ContentType="application/json"/><Default Extension=".vsixmanifest" ContentType="text/xml"/><Default Extension=".mjs" ContentType="application/javascript"/><Default Extension=".md" ContentType="text/markdown"/><Default Extension=".js" ContentType="application/javascript"/><Default Extension=".ts" ContentType="video/mp2t"/><Default Extension=".map" ContentType="application/json"/><Default Extension=".yml" ContentType="text/yaml"/><Default Extension=".txt" ContentType="text/plain"/><Default Extension=".wasm" ContentType="application/wasm"/></Types>
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Package and Upload VSIX
2+
on:
3+
workflow_dispatch:
4+
5+
permissions:
6+
contents: write
7+
8+
jobs:
9+
package:
10+
name: Package
11+
runs-on: ubuntu-latest
12+
steps:
13+
# Check out current repository
14+
- name: Fetch Sources
15+
uses: actions/checkout@v4
16+
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: 20
20+
cache: "npm"
21+
registry-url: "https://npm.pkg.github.com"
22+
23+
- name: Install CI
24+
run: npm ci
25+
26+
- name: Package VSIX
27+
run: npm run package
28+
29+
- name: Create initial tag
30+
run: |
31+
if [ -z "$(git tag -l 'v*')" ]; then
32+
git tag v0.0.0
33+
fi
34+
35+
- name: Bump version and push tag
36+
id: bump
37+
uses: anothrNick/[email protected]
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
WITH_V: true
41+
DEFAULT_BUMP: 'patch'
42+
43+
- name: Create Release
44+
id: create_release
45+
uses: softprops/action-gh-release@v2
46+
with:
47+
tag_name: ${{ steps.bump.outputs.new_tag }}
48+
name: Version ${{ steps.bump.outputs.new_tag }}
49+
draft: false
50+
prerelease: false
51+
files: ./*.vsix
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
dist
12
node_modules
23
.vscode-test-web/
34
*.vsix

examples/browser-only/plugins/robertjndw.ts-executor-web/extension/dist/web/extension.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/browser-only/plugins/robertjndw.ts-executor-web/extension/dist/web/extension.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/browser-only/plugins/robertjndw.ts-executor-web/extension/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"Other"
1515
],
1616
"activationEvents": [
17-
"*"
17+
"onLanguage:typescript",
18+
"onLanguage:javascript"
1819
],
1920
"browser": "./dist/web/extension.js",
2021
"contributes": {
Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,28 @@
11
# ts-executor-web
2-
VSCode Extension to execute TypeScript in the Browser
2+
3+
A VSCode extension to execute TypeScript code directly in the browser.
4+
5+
## Features
6+
- **Execute Code in Browser**: Bundle and run the code from your active editor.
7+
- **Virtual File System**: Dynamically loads and bundles files from the workspace.
8+
- **Output Capture**: Captures console logs and displays them in the VSCode output channel.
9+
10+
## Prerequisites
11+
- **Visual Studio Code** version 1.74.0 or later.
12+
- **Node.js** and **npm** for installing dependencies and building the project.
13+
14+
## Usage
15+
Executing TypeScript/JavaScript Code
16+
Open the main TypeScript or JavaScript file and trigger the `Run TypeScript Code` command from the command palette. Alternatively, you can use the "Run" button in the editor title menu (top right corner).
17+
18+
## Installation
19+
1. Clone the repository.
20+
2. Install dependencies:
21+
```sh
22+
npm install
23+
```
24+
3. Build the project as VSIX file:
25+
```sh
26+
npm run package
27+
```
28+
4. Install the extension from the VSIX file

examples/browser-only/plugins/robertjndw.ts-executor-web/extension/src/web/extension.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,14 @@ export async function activate(context: vscode.ExtensionContext) {
1515
const outputChannel = vscode.window.createOutputChannel('TS Executor Logs');
1616

1717
await esbuild.initialize({
18-
wasmURL: 'https://unpkg.com/esbuild-wasm/esbuild.wasm',
18+
wasmURL: 'https://unpkg.com/esbuild-wasm@0.24.2/esbuild.wasm',
1919
});
2020

2121
// The command has been defined in the package.json file
2222
// Now provide the implementation of the command with registerCommand
2323
// The commandId parameter must match the command field in package.json
2424
const disposable = vscode.commands.registerCommand('ts-executor-web.runCode', async () => {
25-
vscode.window.showInformationMessage('Running TypeScript code in the web extension host...');
26-
console.log('Running TypeScript code in the web extension host...');
27-
2825
const workspaceFiles = await vscode.workspace.findFiles('**/*.{ts,js}', '**/node_modules/**');
29-
console.log('Workspace files:', workspaceFiles.map(file => file.fsPath));
3026
if (workspaceFiles.length === 0) {
3127
vscode.window.showErrorMessage('No JavaScript or TypeScript files found in the workspace.');
3228
return;
@@ -46,7 +42,6 @@ export async function activate(context: vscode.ExtensionContext) {
4642
vscode.window.showErrorMessage('No active editor or entry file detected.');
4743
return;
4844
}
49-
console.log('Entry file:', entryFile);
5045

5146
// Bundle the files using esbuild-wasm
5247
let bundledCode: string;
@@ -100,7 +95,6 @@ export async function activate(context: vscode.ExtensionContext) {
10095
vscode.window.showErrorMessage(`Error bundling files: ${err}`);
10196
return;
10297
}
103-
console.log('Bundled code successfully');
10498

10599
// Prepare a custom console to capture logs
106100
const capturedLogs: string[] = [];
@@ -120,7 +114,6 @@ export async function activate(context: vscode.ExtensionContext) {
120114
};
121115

122116
// Execute the code in a sandbox
123-
console.log('Executing bundled code...');
124117
try {
125118
const sandbox = {
126119
console: customConsole,
@@ -146,4 +139,4 @@ export async function activate(context: vscode.ExtensionContext) {
146139
// This method is called when your extension is deactivated
147140
export function deactivate() {
148141
// Noop
149-
}
142+
}

0 commit comments

Comments
 (0)