* Setup interface for image processing * Implement getInfo() on SharpImageProcessor * Reorganize pds image processing code * Implement initial resize() on SharpImageProcessor * Test sharp image processor, apply a couple fixes * Tidy * Implement initial pds image uri builder/signer/verifier * Initial implementation of image processing server * Update node types for node v18 * Add disk caching to pds image service * Test pds image process caching, tidy * Move pds image processor away from an interface * Add sharp to pds build externals * Move away from xrpc-server errors to http-errors for pds image server * Tidy pds image exports * Tidy
38 lines
1005 B
JavaScript
38 lines
1005 B
JavaScript
const pkgJson = require('@npmcli/package-json')
|
|
const { copy } = require('esbuild-plugin-copy')
|
|
const { nodeExternalsPlugin } = require('esbuild-node-externals')
|
|
|
|
const buildShallow =
|
|
process.argv.includes('--shallow') || process.env.ATP_BUILD_SHALLOW === 'true'
|
|
|
|
if (process.argv.includes('--update-main-to-dist')) {
|
|
return pkgJson
|
|
.load(__dirname)
|
|
.then((pkg) => pkg.update({ main: 'dist/index.js' }))
|
|
.then((pkg) => pkg.save())
|
|
}
|
|
|
|
require('esbuild').build({
|
|
logLevel: 'info',
|
|
entryPoints: ['src/index.ts', 'src/bin.ts', 'src/db/index.ts'],
|
|
bundle: true,
|
|
sourcemap: true,
|
|
outdir: 'dist',
|
|
platform: 'node',
|
|
external: [
|
|
'better-sqlite3',
|
|
// Referenced in pg driver, but optional and we don't use it
|
|
'pg-native',
|
|
'sharp',
|
|
],
|
|
plugins: [].concat(buildShallow ? [nodeExternalsPlugin()] : []).concat([
|
|
copy({
|
|
assets: {
|
|
from: ['./src/mailer/templates/**/*'],
|
|
to: ['./templates'],
|
|
keepStructure: true,
|
|
},
|
|
}),
|
|
]),
|
|
})
|