forked from redhat-developer/vscode-openshift-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathesbuild.mjs
More file actions
50 lines (46 loc) · 1.47 KB
/
esbuild.mjs
File metadata and controls
50 lines (46 loc) · 1.47 KB
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
/*-----------------------------------------------------------------------------------------------
* Copyright (c) Red Hat, Inc. All rights reserved.
* Licensed under the MIT License. See LICENSE file in the project root for license information.
*-----------------------------------------------------------------------------------------------*/
import * as esbuild from 'esbuild';
import { sassPlugin } from 'esbuild-sass-plugin';
import * as fs from 'fs/promises';
const webviews = [
'cluster',
'create-service',
'describe',
'devfile-registry',
'git-import',
'helm-chart',
'log',
'welcome',
'feedback',
'add-service-binding',
];
function kebabToCamel(text) {
return text.replace(/-./g, searchResult => searchResult.substring(1).toUpperCase());
}
await Promise.all([
...webviews.map(webview =>
esbuild.build({
entryPoints: [
`./src/webview/${webview}/app/index.tsx`,
],
bundle: true,
outfile: `./out/${kebabToCamel(webview)}Viewer/index.js`,
platform: 'browser',
target: 'chrome108',
sourcemap: true,
loader: {
'.png': 'file',
'.svg': 'file',
},
plugins: [
sassPlugin(),
]
})
),
...webviews.map(webview =>
fs.cp(`./src/webview/${webview}/app/index.html`, `./out/${kebabToCamel(webview)}Viewer/index.html`)
),
]);