Skip to content

Commit 413c5be

Browse files
committed
Add dist files
1 parent 8f500e7 commit 413c5be

File tree

4 files changed

+234
-15
lines changed

4 files changed

+234
-15
lines changed

.github/workflows/manual-vsce-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
prerelease:
1010
description: Publish as pre-release
1111
required: true
12-
default: false
12+
default: true
1313
type: boolean
1414

1515
permissions:

apps/vscode-extension/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@
147147
"@vscode/codicons": "^0.0.41",
148148
"@vscode/test-electron": "^2.5.2",
149149
"esbuild": "^0.25.11",
150+
"esbuild-plugin-copy": "^2.1.1",
150151
"glob": "^11.1.0",
151152
"mocha": "^11.3.0",
152153
"npm-run-all": "^4.1.5"

apps/vscode-extension/scripts/build.js

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
const process = require("node:process");
22
const console = require("node:console");
3+
const fs = require("node:fs");
4+
const path = require("node:path");
5+
const { copy } = require("esbuild-plugin-copy");
36
const production = process.argv.includes("--production");
47
const watch = process.argv.includes("--watch");
58

@@ -20,11 +23,28 @@ async function main() {
2023
define: production ? { "process.env.NODE_ENV": '"production"' } : undefined,
2124
minify: production,
2225
sourcemap: !production,
23-
plugins: [workspacePackagesPlugin, esbuildProblemMatcherPlugin],
26+
plugins: [
27+
workspacePackagesPlugin,
28+
esbuildProblemMatcherPlugin,
29+
copy({
30+
assets: [
31+
{
32+
from: ["./node_modules/oxfmt/**/*", "../../node_modules/oxfmt/**/*"],
33+
to: ["./node_modules/oxfmt"],
34+
},
35+
{
36+
from: ["./node_modules/@oxfmt/**/*", "../../node_modules/@oxfmt/**/*"],
37+
to: ["./node_modules/@oxfmt"],
38+
},
39+
],
40+
once: true,
41+
}),
42+
],
2443
});
2544
if (watch) {
2645
await ctx.watch();
2746
} else {
47+
fs.rmSync("./dist", { recursive: true, force: true });
2848
await ctx.rebuild();
2949
await ctx.dispose();
3050
}
@@ -42,9 +62,7 @@ const esbuildProblemMatcherPlugin = {
4262
build.onEnd((result) => {
4363
result.errors.forEach(({ text, location }) => {
4464
console.error(`✘ [ERROR] ${text}`);
45-
console.error(
46-
` ${location.file}:${location.line}:${location.column}:`
47-
);
65+
console.error(` ${location.file}:${location.line}:${location.column}:`);
4866
});
4967
console.log("[watch] build finished");
5068
});
@@ -59,26 +77,19 @@ const esbuildProblemMatcherPlugin = {
5977
const workspacePackagesPlugin = {
6078
name: "workspace-packages",
6179
setup(build) {
62-
const path = require("node:path");
6380
const pkgRoot = path.resolve(__dirname, "../../../packages");
6481
/** @type {Record<string, string>} */
6582
const alias = {
6683
"@pretty-ts-errors/utils": path.join(pkgRoot, "utils/src/index.ts"),
67-
"@pretty-ts-errors/formatter": path.join(
68-
pkgRoot,
69-
"formatter/src/index.ts"
70-
),
71-
"@pretty-ts-errors/vscode-formatter": path.join(
72-
pkgRoot,
73-
"vscode-formatter/src/index.ts"
74-
),
84+
"@pretty-ts-errors/formatter": path.join(pkgRoot, "formatter/src/index.ts"),
85+
"@pretty-ts-errors/vscode-formatter": path.join(pkgRoot, "vscode-formatter/src/index.ts"),
7586
};
7687
build.onResolve(
7788
{ filter: /^@pretty-ts-errors\/(utils|formatter|vscode-formatter)$/ },
7889
(args) => {
7990
const target = alias[args.path];
8091
return target ? { path: target } : undefined;
81-
}
92+
},
8293
);
8394
},
8495
};

0 commit comments

Comments
 (0)