Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ esbuild or something similar should be used. ( https://deno.land/x/esbuild )
import {
ExtensionContext,
importVsCodeApi,
} from "https://deno.land/x/vscode@1.84.0/mod.ts";
} from "https://deno.land/x/vscode@1.85.0/mod.ts";

export function activate(context: ExtensionContext) {
const vscode = importVsCodeApi();
Expand Down
103 changes: 50 additions & 53 deletions example/build.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { fromFileUrl } from "https://deno.land/std@0.205.0/path/mod.ts";
import { denoPlugins } from "https://deno.land/x/esbuild_deno_loader@0.8.2/mod.ts";
import {
build as esBuild,
Plugin,
} from "https://deno.land/x/esbuild@v0.19.5/mod.js";
import { ensureFile } from "https://deno.land/std@0.205.0/fs/mod.ts";
} from "https://deno.land/x/esbuild@v0.19.7/mod.js";
import { ensureFile } from "https://deno.land/std@0.208.0/fs/mod.ts";
import { resolve } from "https://deno.land/std@0.208.0/path/mod.ts";

/**
* ```bash
Expand All @@ -14,27 +14,20 @@ import { ensureFile } from "https://deno.land/std@0.205.0/fs/mod.ts";

/** */
export const writeTextFileWithLog = async (
path: URL,
path: string,
content: string,
): Promise<void> => {
console.log(path.toString() + " に書き込み中... " + content.length + "文字");
console.log(path + " に書き込み中... " + content.length + "文字");
await ensureFile(path);
await Deno.writeTextFile(path, content);
console.log(path.toString() + " に書き込み完了!");
console.log(path + " に書き込み完了!");
};

const distributionPath = new URL(
"../vscodeExtensionDistribution/",
import.meta.url,
);
const distributionPath = "./vscodeExtensionDistribution/";

const build = async (): Promise<string> => {
const esbuildResult = await esBuild({
entryPoints: [
fromFileUrl(
new URL("./main.ts", import.meta.url),
),
],
entryPoints: ["./example/main.ts"],
plugins: denoPlugins() as Plugin[],
write: false,
bundle: true,
Expand All @@ -57,44 +50,48 @@ const build = async (): Promise<string> => {

const scriptRelativePath = "./main.js";

writeTextFileWithLog(
new URL(scriptRelativePath, distributionPath),
await build(),
);
await Promise.all([
writeTextFileWithLog(
resolve(distributionPath, scriptRelativePath),
await build(),
),

writeTextFileWithLog(
new URL("./package.json", distributionPath),
JSON.stringify({
"name": "example",
"version": "0.0.1",
"description": "example VSCode extension",
"repository": {
"url": "git+https://github.com/narumincho/vscode.git",
"type": "git",
},
"license": "MIT",
"homepage": "https://github.com/narumincho/vscode",
"author": "narumincho",
"engines": {
"vscode": "^1.76.0",
},
"dependencies": {},
"activationEvents": [],
"contributes": {
"commands": [
{
"command": "extension.helloWorld",
"title": "Hello World",
},
],
},
"browser": scriptRelativePath,
"publisher": "narumincho",
}),
);
writeTextFileWithLog(
resolve(distributionPath, "./package.json"),
JSON.stringify({
"name": "example",
"version": "0.0.1",
"description": "example VSCode extension",
"repository": {
"url": "git+https://github.com/narumincho/vscode.git",
"type": "git",
},
"license": "MIT",
"homepage": "https://github.com/narumincho/vscode",
"author": "narumincho",
"engines": {
"vscode": "^1.76.0",
},
"dependencies": {},
"activationEvents": [],
"contributes": {
"commands": [
{
"command": "extension.helloWorld",
"title": "Hello World",
},
],
},
"browser": scriptRelativePath,
"publisher": "narumincho",
}),
),

writeTextFileWithLog(
new URL("README.md", distributionPath),
`example extension
writeTextFileWithLog(
resolve(distributionPath, "README.md"),
`example extension
`,
);
),
]);

Deno.exit();
82 changes: 41 additions & 41 deletions gen/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions gen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
tokio = { version = "1.33.0", features = ["macros", "rt-multi-thread"] }
tokio = { version = "1.35.0", features = ["macros", "rt-multi-thread"] }
anyhow = "1.0.75"
reqwest = "0.11.22"
thiserror = "1.0.50"
Expand All @@ -15,5 +15,5 @@ swc_common = "0.31.22"
swc_ecma_parser = "0.137.16"
swc_ecma_ast = "0.107.8"
swc_ecma_codegen = "0.142.18"
once_cell = "1.18.0"
once_cell = "1.19.0"
string_cache = "0.8.7"
Loading