Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F22416778
build.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
build.js
View Options
import
{
rmSync
}
from
'fs'
;
import
esbuild
from
'esbuild'
;
const
buildConfig
=
{
entryPoints
:
[
'src/**/*.ts'
],
bundle
:
false
,
platform
:
'node'
,
format
:
'esm'
,
sourcemap
:
true
,
target
:
'esnext'
,
outdir
:
'lib'
,
minify
:
false
,
loader
:
{
'.ts'
:
'ts'
}
};
async
function
build
(
watch
=
false
)
{
try
{
if
(
!
watch
)
{
console
.
log
(
'๐งน Cleaning up...'
);
// Clean up build directories
rmSync
(
'lib'
,
{
recursive
:
true
,
force
:
true
});
rmSync
(
'@types'
,
{
recursive
:
true
,
force
:
true
});
console
.
log
(
'โก Transpiling TypeScript with esbuild...'
);
// Use esbuild for TypeScript transpilation
await
esbuild
.
build
(
buildConfig
);
console
.
log
(
'โ Build completed successfully'
);
}
else
{
// Watch mode
console
.
log
(
'๐ Watching for changes...'
);
const
context
=
await
esbuild
.
context
(
buildConfig
);
await
context
.
watch
();
}
}
catch
(
error
)
{
console
.
error
(
'โ Build failed:'
,
error
);
process
.
exit
(
1
);
}
}
// Check if watch mode is requested
const
isWatch
=
process
.
argv
.
includes
(
'--watch'
);
// Run build
build
(
isWatch
);
export
default
build
;
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Sat, Nov 28, 01:46 (1 d, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1229567
Default Alt Text
build.js (1 KB)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline