-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(core): fix esbuild to pass linter
- Loading branch information
1 parent
6ccb6a5
commit 39b8282
Showing
1 changed file
with
16 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,31 @@ | ||
import { argv } from 'node:process'; | ||
import * as esbuild from 'esbuild'; | ||
|
||
const esbuildContext = { | ||
const bundleProject = async () => { | ||
const esbuildContext = { | ||
entryPoints: ['src/index.ts'], | ||
external: ['esbuild', 'asciidoctor'], | ||
outfile: `bin/index.cjs`, | ||
outfile: 'bin/index.cjs', | ||
platform: 'node', | ||
logLevel: 'info', | ||
bundle: true, | ||
minify: true, | ||
metafile: true, | ||
}; | ||
metafile: true | ||
}; | ||
|
||
const isProductionMode = (argv[3] === 'production'); | ||
const isProductionMode = (argv[3] === 'production'); | ||
|
||
if (!isProductionMode) { | ||
if (!isProductionMode) { | ||
const ctx = await esbuild.context(esbuildContext); | ||
|
||
await ctx.watch(); | ||
} else { | ||
} else { | ||
await esbuild.build(esbuildContext) | ||
.then(() => { | ||
console.log('Bundling completed successfully!'); | ||
}) | ||
.catch(() => process.exit(1)); | ||
} | ||
.then(() => { | ||
console.log('Bundling completed successfully!'); | ||
}) | ||
.catch(() => process.exit(1)); | ||
} | ||
}; | ||
|
||
bundleProject(); |