-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathesbuild.package.js
56 lines (52 loc) · 1.6 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
const fs = require('fs');
const path = require('path');
const { copyFolderFiles, addReleaseFlag } = require('@hackolade/hck-esbuild-plugins-pack');
const esbuild = require('esbuild');
const { clean } = require('esbuild-plugin-clean');
const { copy } = require('esbuild-plugin-copy');
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, 'forward_engineering', 'ddlProvider.js'),
path.resolve(__dirname, 'reverse_engineering', 'api.js'),
],
bundle: true,
keepNames: true,
platform: 'node',
target: 'node16',
outdir: RELEASE_FOLDER_PATH,
minify: true,
logLevel: 'info',
external: [
'lodash',
'@azure/app-configuration',
'@azure/identity',
'@azure/keyvault-secrets',
'oci-common',
'oci-objectstorage',
'oci-secrets',
],
plugins: [
clean({
patterns: [DEFAULT_RELEASE_FOLDER_PATH],
}),
copy({
assets: {
from: [path.join('node_modules', 'lodash', '**', '*')],
to: [path.join('node_modules', 'lodash')],
},
}),
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));