FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
codeql-action/build.mjs at main · AmesianX/codeql-action · GitHub
AmesianX
/
codeql-action
Public
forked from
github/codeql-action
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
codeql-action
/
build.mjs
Copy path
More file actions
More file actions
Latest commit
History
History
History
80 lines (71 loc) · 1.86 KB
Breadcrumbs
codeql-action
/
build.mjs
Copy path
File metadata and controls
80 lines (71 loc) · 1.86 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import
{
copyFile
,
rm
}
from
"node:fs/promises"
;
import
{
dirname
,
join
}
from
"node:path"
;
import
{
fileURLToPath
}
from
"node:url"
;
import
*
as
esbuild
from
"esbuild"
;
import
{
globSync
}
from
"glob"
;
import
pkg
from
"./package.json"
with
{
type
:
"json"
}
;
const
__filename
=
fileURLToPath
(
import
.
meta
.
url
)
;
const
__dirname
=
dirname
(
__filename
)
;
const
SRC_DIR
=
join
(
__dirname
,
"src"
)
;
const
OUT_DIR
=
join
(
__dirname
,
"lib"
)
;
/**
* Clean the output directory before building.
*
*
@type
{
esbuild.Plugin
}
*/
const
cleanPlugin
=
{
name
:
"clean"
,
setup
(
build
)
{
build
.
onStart
(
async
(
)
=>
{
await
rm
(
OUT_DIR
,
{
recursive
:
true
,
force
:
true
}
)
;
}
)
;
}
,
}
;
/**
* Copy defaults.json to the output directory since other projects depend on it.
*
*
@type
{
esbuild.Plugin
}
*/
const
copyDefaultsPlugin
=
{
name
:
"copy-defaults"
,
setup
(
build
)
{
build
.
onEnd
(
async
(
)
=>
{
await
rm
(
join
(
OUT_DIR
,
"defaults.json"
)
,
{
force
:
true
,
}
)
;
await
copyFile
(
join
(
SRC_DIR
,
"defaults.json"
)
,
join
(
OUT_DIR
,
"defaults.json"
)
,
)
;
}
)
;
}
,
}
;
/**
* Log when the build ends.
*
*
@type
{
esbuild.Plugin
}
*/
const
onEndPlugin
=
{
name
:
"on-end"
,
setup
(
build
)
{
build
.
onEnd
(
(
result
)
=>
{
// eslint-disable-next-line no-console
console
.
log
(
`Build ended with
${
result
.
errors
.
length
}
errors`
)
;
}
)
;
}
,
}
;
const
context
=
await
esbuild
.
context
(
{
// Include upload-lib.ts as an entry point for use in testing environments.
entryPoints
:
globSync
(
[
`
${
SRC_DIR
}
/*-action.ts`
,
`
${
SRC_DIR
}
/*-action-post.ts`
,
"src/upload-lib.ts"
]
)
,
bundle
:
true
,
format
:
"cjs"
,
outdir
:
OUT_DIR
,
platform
:
"node"
,
plugins
:
[
cleanPlugin
,
copyDefaultsPlugin
,
onEndPlugin
]
,
target
:
[
"node20"
]
,
define
:
{
__CODEQL_ACTION_VERSION__
:
JSON
.
stringify
(
pkg
.
version
)
,
}
,
}
)
;
await
context
.
rebuild
(
)
;
await
context
.
dispose
(
)
;
Back
|
FazBrowse Home
|
New Git URL