-
Notifications
You must be signed in to change notification settings - Fork 15
/
esbuild.package.js
37 lines (35 loc) · 1.17 KB
/
esbuild.package.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const fs = require('fs');
const path = require('path');
const esbuild = require('esbuild');
const { clean } = require('esbuild-plugin-clean');
const { copyFolderFiles, addReleaseFlag } = require('@hackolade/hck-esbuild-plugins-pack');
const { EXCLUDED_EXTENSIONS, EXCLUDED_FILES, DEFAULT_RELEASE_FOLDER_PATH } = require('./buildConstants');
const packageData = JSON.parse(fs.readFileSync('./package.json').toString());
const RELEASE_FOLDER_PATH = path.join(DEFAULT_RELEASE_FOLDER_PATH, `${packageData.name}-${packageData.version}`);
esbuild
.build({
entryPoints: [
path.resolve(__dirname, 'forward_engineering', 'api.js'),
path.resolve(__dirname, 'reverse_engineering', 'api.js'),
],
bundle: true,
keepNames: true,
platform: 'node',
target: 'node16',
outdir: RELEASE_FOLDER_PATH,
minify: true,
logLevel: 'info',
plugins: [
clean({
patterns: [DEFAULT_RELEASE_FOLDER_PATH],
}),
copyFolderFiles({
fromPath: __dirname,
targetFolderPath: RELEASE_FOLDER_PATH,
excludedExtensions: EXCLUDED_EXTENSIONS,
excludedFiles: EXCLUDED_FILES,
}),
addReleaseFlag(path.resolve(RELEASE_FOLDER_PATH, 'package.json')),
],
})
.catch(() => process.exit(1));