crc16-xmodem.ts

Simple implementation of crc16-xmodem
git clone git://git.finwo.net/lib/crc16-xmodem.ts
Log | Files | Refs | README | LICENSE

build.js (1078B)


      1 const esbuild  = require('esbuild');
      2 const path     = require('path');
      3 const tsconfig = require('../tsconfig.json');
      4 const globber  = require('fast-glob');
      5 
      6 const { dtsPlugin } = require('esbuild-plugin-d.ts');
      7 
      8 (async () => {
      9   console.log('Configuring build');
     10   const outdir = path.join(__dirname, '..', tsconfig.compilerOptions.outDir);
     11   const entryPoints = await globber(
     12     tsconfig.include.map((glob) => path.join(__dirname, '..', glob))
     13   );
     14 
     15   const options = {
     16     bundle: false,
     17     outdir,
     18     target: 'es2018',
     19     platform: 'node',
     20     format: 'cjs',
     21     sourcemap: tsconfig.compilerOptions.sourceMap,
     22     tsconfig: path.join(__dirname, '..', 'tsconfig.json'),
     23     entryPoints,
     24     plugins: [dtsPlugin({tsconfig})],
     25   };
     26 
     27   console.log('Building');
     28   const result = await esbuild.build(options);
     29 
     30   //console.log({
     31   //  options,
     32   //  result,
     33   //});
     34 
     35   if (result.errors.length) {
     36     console.log(result.errors);
     37     process.exit(1);
     38   }
     39 
     40   if (result.warnings.length) {
     41     console.log(result.warnings);
     42     process.exit(1);
     43   }
     44 
     45   console.log('Done');
     46 })();