Skip to content

Commit 4caa3cc

Browse files
committed
please work
1 parent 16a7ade commit 4caa3cc

File tree

5 files changed

+33
-3
lines changed

5 files changed

+33
-3
lines changed

lib/buildtools/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"lodash": "^4.17.21",
3131
"typedoc": "^0.28.4",
3232
"uglify-js": "^3.19.3",
33+
"vite": "^6.3.5",
3334
"vitest": "^3.2.3"
3435
},
3536
"scripts": {

lib/lib-compiler/dist.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { Command } from "@commander-js/extra-typings";
2+
import chalk from "chalk";
3+
import { build, context } from "esbuild";
4+
function getBuildCommand(esbuildOptions) {
5+
return new Command().option("--dev", "If specified, the built output is not minified for easier debugging").option("--watch", "Run esbuild in watch mode").action(async ({ dev, watch }) => {
6+
if (watch) {
7+
const buildContext = await context({
8+
...esbuildOptions,
9+
minify: !dev,
10+
plugins: [{
11+
name: "Watch Plugin",
12+
setup({ onEnd }) {
13+
onEnd(() => {
14+
console.log(chalk.greenBright("Build completed."));
15+
});
16+
}
17+
}]
18+
});
19+
console.log(chalk.yellowBright("Running ESBuild in watch mode."));
20+
await buildContext.watch();
21+
} else {
22+
await build(esbuildOptions);
23+
}
24+
});
25+
}
26+
export {
27+
getBuildCommand as default
28+
};

lib/lib-compiler/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@
1616
"exports": {
1717
".": {
1818
"types": "./index.ts",
19-
"default": "./dist/index.js"
19+
"default": "./dist.js"
2020
}
2121
},
2222
"scripts": {
23-
"build": "yarn tsc",
24-
"prepare": "yarn build"
23+
"build": "esbuild --format=esm --platform=node --packages=external --outfile=./dist.js ./index.ts"
2524
}
2625
}

lib/markdown-tree/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "@sourceacademy/markdown-plugin-directory-tree",
33
"description": "A Markdown-It plugin used to convert directory structures into a neatly formatted text diagram that can be displayed in code blocks",
4+
"version": "1.0.0",
45
"private": true,
56
"type": "module",
67
"devDependencies": {

yarn.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3393,6 +3393,7 @@ __metadata:
33933393
typedoc: "npm:^0.28.4"
33943394
typescript: "npm:^5.8.2"
33953395
uglify-js: "npm:^3.19.3"
3396+
vite: "npm:^6.3.5"
33963397
vitest: "npm:^3.2.3"
33973398
bin:
33983399
buildtools: ./bin/index.js

0 commit comments

Comments
 (0)