UNPKG

604 BPlain TextView Raw
1
2import fs from 'fs';
3import childProcess from 'child_process';
4
5if (!fs.existsSync('dist')) {
6 fs.mkdirSync('dist');
7}
8
9console.log('Starting bundling types');
10const outputFile = './dist/maplibre-gl.d.ts';
11childProcess.execSync(`dts-bundle-generator --no-check --umd-module-name=maplibregl -o ${outputFile} ./src/index.ts`);
12let types = fs.readFileSync(outputFile, 'utf8');
13// Classes are not exported but should be since this is exported as UMD - fixing...
14types = types.replace(/declare class/g, 'export declare class');
15fs.writeFileSync(outputFile, types);
16console.log('Finished bundling types');