Skip to content

Commit

Permalink
adds typescript transpiling for api scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
smohadjer committed Aug 15, 2024
1 parent aea6a9a commit 66cdefe
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions bin/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,23 @@ let ctxjs = await esbuild.context({
outdir: 'public/resources/js',
});

const jsApiFiles = fs.readdirSync('api/ts').filter(name => name !== '.DS_Store').map(item => 'api/ts/'+item);
const ctxJSRootFiles = await esbuild.context({
entryPoints: jsApiFiles,
bundle: false,
platform: 'node',
outdir: 'api',
});

if (args[0] === 'watch') {
await ctxjs.watch();
await ctxJSRootFiles.watch();
console.log('watching js...');
} else {
await ctxjs.rebuild();
await ctxJSRootFiles.rebuild();
ctxjs.dispose();
ctxJSRootFiles.dispose();
console.log('disposed context');
}

Expand Down

0 comments on commit 66cdefe

Please sign in to comment.