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