Some checks failed
Monorepo Pipeline / ⚡ Prioritize Release (push) Successful in 27s
Monorepo Pipeline / 🧪 Test (push) Failing after 24s
Monorepo Pipeline / 🏗️ Build (push) Failing after 22s
Monorepo Pipeline / 🧹 Lint (push) Successful in 1m4s
Monorepo Pipeline / 🚀 Release (push) Has been skipped
Monorepo Pipeline / 🐳 Build Directus (Base) (push) Has been skipped
Monorepo Pipeline / 🐳 Build Gatekeeper (Product) (push) Has been skipped
Monorepo Pipeline / 🐳 Build Build-Base (push) Has been skipped
Monorepo Pipeline / 🐳 Build Production Runtime (push) Has been skipped
45 lines
1.4 KiB
JavaScript
45 lines
1.4 KiB
JavaScript
import { build } from 'esbuild';
|
|
import { resolve, dirname } from 'path';
|
|
import { mkdirSync } from 'fs';
|
|
import { fileURLToPath } from 'url';
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = dirname(__filename);
|
|
|
|
const entryPoint = resolve(__dirname, 'src/index.ts');
|
|
const outfile = resolve(__dirname, 'index.js');
|
|
|
|
try {
|
|
mkdirSync(dirname(outfile), { recursive: true });
|
|
} catch (e) { }
|
|
|
|
console.log(`Building from ${entryPoint} to ${outfile}...`);
|
|
|
|
build({
|
|
entryPoints: [entryPoint],
|
|
bundle: true,
|
|
platform: 'node',
|
|
target: 'node18',
|
|
outfile: outfile,
|
|
format: 'esm',
|
|
external: [],
|
|
plugins: [{
|
|
name: 'mock-jquery',
|
|
setup(build) {
|
|
build.onResolve({ filter: /^jquery$/ }, args => ({ path: args.path, namespace: 'mock-jquery' }));
|
|
build.onLoad({ filter: /.*/, namespace: 'mock-jquery' }, () => ({ contents: 'export default {};', loader: 'js' }));
|
|
}
|
|
}, {
|
|
name: 'mock-canvas',
|
|
setup(build) {
|
|
build.onResolve({ filter: /^canvas$/ }, args => ({ path: args.path, namespace: 'mock-canvas' }));
|
|
build.onLoad({ filter: /.*/, namespace: 'mock-canvas' }, () => ({ contents: 'export default {};', loader: 'js' }));
|
|
}
|
|
}]
|
|
}).then(() => {
|
|
console.log("Build succeeded!");
|
|
}).catch((e) => {
|
|
console.error("Build failed:", e);
|
|
process.exit(1);
|
|
});
|