mirror of
https://github.com/cline/cline.git
synced 2025-06-03 03:59:07 +00:00

* Run pretest in CI to build all tests * Alias paths when running tests * Bundle ES modules with esbuild * alias packages * Preserve the test scripts exit code and display the output * Remove outdated test
62 lines
1.2 KiB
JavaScript
62 lines
1.2 KiB
JavaScript
const { execSync } = require("child_process")
|
|
const esbuild = require("esbuild")
|
|
|
|
const watch = process.argv.includes("--watch")
|
|
|
|
/**
|
|
* @type {import('esbuild').Plugin}
|
|
*/
|
|
const esbuildProblemMatcherPlugin = {
|
|
name: "esbuild-problem-matcher",
|
|
|
|
setup(build) {
|
|
build.onStart(() => {
|
|
console.log("[watch] build started")
|
|
})
|
|
build.onEnd((result) => {
|
|
result.errors.forEach(({ text, location }) => {
|
|
console.error(`✘ [ERROR] ${text}`)
|
|
console.error(` ${location.file}:${location.line}:${location.column}:`)
|
|
})
|
|
console.log("[watch] build finished")
|
|
})
|
|
},
|
|
}
|
|
|
|
const srcConfig = {
|
|
bundle: true,
|
|
minify: false,
|
|
sourcemap: true,
|
|
sourcesContent: true,
|
|
logLevel: "silent",
|
|
entryPoints: ["src/packages/**/*.ts"],
|
|
outdir: "out/packages",
|
|
format: "cjs",
|
|
platform: "node",
|
|
define: {
|
|
"process.env.IS_DEV": "true",
|
|
"process.env.IS_TEST": "true",
|
|
},
|
|
external: ["vscode"],
|
|
plugins: [esbuildProblemMatcherPlugin],
|
|
}
|
|
|
|
async function main() {
|
|
const srcCtx = await esbuild.context(srcConfig)
|
|
|
|
if (watch) {
|
|
await srcCtx.watch()
|
|
} else {
|
|
await srcCtx.rebuild()
|
|
|
|
await srcCtx.dispose()
|
|
}
|
|
}
|
|
|
|
execSync("tsc -p ./tsconfig.test.json --outDir out", { encoding: "utf-8" })
|
|
|
|
main().catch((e) => {
|
|
console.error(e)
|
|
process.exit(1)
|
|
})
|