fix: recurse for entryPoints

This commit is contained in:
diced 2022-10-23 12:16:59 -07:00
parent 0150ea5e70
commit f58d33af9e
No known key found for this signature in database
GPG key ID: 370BD1BA142842D1

View file

@ -1,40 +1,23 @@
const esbuild = require('esbuild'); const esbuild = require('esbuild');
const { existsSync } = require('fs'); const { existsSync } = require('fs');
const { rm } = require('fs/promises'); const { rm } = require('fs/promises');
const { recursiveReadDir } = require('next/dist/lib/recursive-readdir');
(async () => { (async () => {
if (existsSync('./dist')) { if (existsSync('./dist')) {
await rm('./dist', { recursive: true }); await rm('./dist', { recursive: true });
} }
const entryPoints = await recursiveReadDir('./src', /.*\.(ts)$/, /(themes|queries|pages)/);
await esbuild.build({ await esbuild.build({
tsconfig: 'tsconfig.json', tsconfig: 'tsconfig.json',
outdir: 'dist', outdir: 'dist',
bundle: false,
platform: 'node', platform: 'node',
entryPoints: [ entryPoints,
'src/server/index.ts',
'src/server/util.ts',
'src/lib/logger.ts',
'src/lib/config.ts',
'src/lib/mimes.ts',
'src/lib/exts.ts',
'src/lib/config/Config.ts',
'src/lib/config/readConfig.ts',
'src/lib/config/validateConfig.ts',
'src/lib/datasources/Datasource.ts',
'src/lib/datasources/index.ts',
'src/lib/datasources/Local.ts',
'src/lib/datasources/S3.ts',
'src/lib/datasources/Swift.ts',
'src/lib/datasource.ts',
'src/scripts/read-config.ts',
'src/scripts/import-dir.ts',
],
format: 'cjs', format: 'cjs',
resolveExtensions: ['.ts', '.js'], resolveExtensions: ['.ts', '.js'],
write: true, write: true,
sourcemap: true, sourcemap: true,
minify: false,
}); });
})(); })();