Fork of github.com/did-method-plc/did-method-plc
1const pkgJson = require('@npmcli/package-json') 2const { nodeExternalsPlugin } = require('esbuild-node-externals') 3 4const buildShallow = 5 process.argv.includes('--shallow') || process.env.PLC_BUILD_SHALLOW === 'true' 6 7if (process.argv.includes('--update-main-to-dist')) { 8 return pkgJson 9 .load(__dirname) 10 .then((pkg) => pkg.update({ main: 'dist/index.js' })) 11 .then((pkg) => pkg.save()) 12} 13 14require('esbuild').build({ 15 logLevel: 'info', 16 entryPoints: [ 17 'src/index.ts', 18 ], 19 bundle: true, 20 sourcemap: true, 21 treeShaking: true, 22 outdir: 'dist', 23 platform: 'node', 24 assetNames: 'src/static', 25 plugins: buildShallow ? [nodeExternalsPlugin()] : [], 26})