MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / main

Function main

src/esbuild.mjs:31–157  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

29}
30
31async function main() {
32 const name = "extension"
33 const production = process.argv.includes("--production")
34 const watch = process.argv.includes("--watch")
35 const minify = production
36 const sourcemap = true // Always generate source maps for error handling.
37
38 /**
39 * @type {import('esbuild').BuildOptions}
40 */
41 const buildOptions = {
42 bundle: true,
43 minify,
44 sourcemap,
45 logLevel: "silent",
46 format: "cjs",
47 sourcesContent: false,
48 platform: "node",
49 define: {
50 "process.env.PKG_RELEASE_CHANNEL": JSON.stringify(process.env.PKG_RELEASE_CHANNEL || "stable"),
51 "process.env.POSTHOG_API_KEY": JSON.stringify(process.env.POSTHOG_API_KEY || ""),
52 },
53 }
54
55 const srcDir = __dirname
56 const buildDir = __dirname
57 const distDir = path.join(buildDir, "dist")
58
59 if (fs.existsSync(distDir)) {
60 console.log(`[${name}] Cleaning dist directory: ${distDir}`)
61 await removeDirWithRetries(distDir)
62 }
63
64 /**
65 * @type {import('esbuild').Plugin[]}
66 */
67 const plugins = [
68 {
69 name: "copyFiles",
70 setup(build) {
71 build.onEnd(() => {
72 copyPaths(
73 [
74 ["../README.md", "README.md"],
75 ["../CHANGELOG.md", "CHANGELOG.md"],
76 ["../LICENSE", "LICENSE"],
77 ["../.env", ".env", { optional: true }],
78 ["node_modules/vscode-material-icons/generated", "assets/vscode-material-icons"],
79 ["../webview-ui/audio", "webview-ui/audio"],
80 ["assets/marketplace", "dist/assets/marketplace"],
81 ],
82 srcDir,
83 buildDir,
84 )
85 })
86 },
87 },
88 {

Callers 1

esbuild.mjsFile · 0.70

Calls 4

removeDirWithRetriesFunction · 0.85
allMethod · 0.80
logMethod · 0.65
disposeMethod · 0.65

Tested by

no test coverage detected