-
Notifications
You must be signed in to change notification settings - Fork 749
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Initial Wrangler loading * Remove duplicate path * lockfile * workspace * lockfile * Create thirty-windows-prove.md
- Loading branch information
Showing
6 changed files
with
42 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"cloudflare-workers-bindings-extension": patch | ||
--- | ||
|
||
Load Wrangler in extension |
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
15 changes: 15 additions & 0 deletions
15
packages/cloudflare-workers-bindings-extension/src/extension.ts
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 |
---|---|---|
@@ -1,9 +1,24 @@ | ||
import * as vscode from "vscode"; | ||
import { importWrangler } from "./wrangler"; | ||
|
||
export async function activate(context: vscode.ExtensionContext) { | ||
vscode.commands.registerCommand( | ||
"cloudflare-workers-bindings-extension.testCommand", | ||
() => | ||
vscode.window.showInformationMessage(`Successfully called test command.`) | ||
); | ||
|
||
const rootPath = | ||
vscode.workspace.workspaceFolders && | ||
vscode.workspace.workspaceFolders.length > 0 | ||
? vscode.workspace.workspaceFolders[0].uri.fsPath | ||
: undefined; | ||
|
||
if (!rootPath) { | ||
return; | ||
} | ||
|
||
const wrangler = importWrangler(rootPath); | ||
|
||
// Do stuff with Wrangler | ||
} |
15 changes: 15 additions & 0 deletions
15
packages/cloudflare-workers-bindings-extension/src/wrangler.ts
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,15 @@ | ||
import * as path from "path"; | ||
|
||
export function importWrangler( | ||
workspaceRoot: string | ||
): typeof import("wrangler") { | ||
const wrangler = path.join( | ||
workspaceRoot, | ||
"node_modules", | ||
"wrangler", | ||
"wrangler-dist", | ||
"cli.js" | ||
); | ||
|
||
return require(wrangler); | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.