Skip to content

Commit

Permalink
refactor(core): fix esbuild to pass linter
Browse files Browse the repository at this point in the history
  • Loading branch information
bandantonio committed Nov 12, 2023
1 parent 6ccb6a5 commit 39b8282
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions esbuild.config.mjs
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();

0 comments on commit 39b8282

Please sign in to comment.