Some checks failed
Monorepo Pipeline / ⚡ Prioritize Release (push) Successful in 1s
Monorepo Pipeline / 🧹 Lint (push) Failing after 13s
Monorepo Pipeline / 🏗️ Build (push) Failing after 11s
Monorepo Pipeline / 🧪 Test (push) Failing after 25s
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
58 lines
1.9 KiB
JavaScript
58 lines
1.9 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 entryPoints = [
|
|
resolve(__dirname, 'src/index.ts'),
|
|
resolve(__dirname, 'src/server.ts')
|
|
];
|
|
|
|
try {
|
|
mkdirSync(resolve(__dirname, 'dist'), { recursive: true });
|
|
} catch (e) { }
|
|
|
|
console.log(`Building entry points...`);
|
|
|
|
build({
|
|
entryPoints: entryPoints,
|
|
bundle: true,
|
|
platform: 'node',
|
|
target: 'node18',
|
|
outdir: resolve(__dirname, 'dist'),
|
|
format: 'esm',
|
|
jsx: 'automatic',
|
|
loader: {
|
|
'.tsx': 'tsx',
|
|
'.ts': 'ts',
|
|
'.js': 'js',
|
|
},
|
|
external: ["@react-pdf/renderer", "react", "react-dom", "jsdom", "jsdom/*", "jquery", "jquery/*", "canvas", "fs", "path", "os", "http", "https", "zlib", "stream", "util", "url", "net", "tls", "crypto"],
|
|
plugins: [{
|
|
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' }));
|
|
}
|
|
}, {
|
|
name: 'mock-jsdom',
|
|
setup(build) {
|
|
build.onResolve({ filter: /^jsdom/ }, args => ({ path: args.path, namespace: 'mock-jsdom' }));
|
|
build.onLoad({ filter: /.*/, namespace: 'mock-jsdom' }, () => ({ contents: 'export default {};', loader: 'js' }));
|
|
}
|
|
}]
|
|
}).then(() => {
|
|
console.log("Build succeeded!");
|
|
}).catch((e) => {
|
|
if (e.errors) {
|
|
console.error("Build failed with errors:");
|
|
e.errors.forEach(err => console.error(` ${err.text} at ${err.location?.file}:${err.location?.line}`));
|
|
} else {
|
|
console.error("Build failed:", e);
|
|
}
|
|
process.exit(1);
|
|
});
|