Skip to content

Commit

Permalink
inline types into d.ts
Browse files Browse the repository at this point in the history
also move all non-runtime dependencies to devDependencies
  • Loading branch information
rotu committed Jun 28, 2023
1 parent 1cbb496 commit 5b260d2
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 32 deletions.
27 changes: 27 additions & 0 deletions build/dts-bundle-generator-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"compilationOptions": {
"preferredConfigPath": "../tsconfig.json"
},
"entries": [
{
"filePath": "../src/index.ts",
"outFile": "../dist/maplibre-gl.d.ts",
"libraries": {
"inlinedLibraries": [
"@mapbox/tiny-sdf",
"@types/geojson",
"@types/kdbush",
"@types/mapbox__point-geometry",
"@types/mapbox__vector-tile",
"@types/pbf",
"gl-matrix",
"potpack"
]
},
"output": {
"umdModuleName": "maplibregl",
"exportReferencedTypes": true
}
}
]
}
4 changes: 2 additions & 2 deletions build/generate-typings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ if (!fs.existsSync('dist')) {

console.log('Starting bundling types');
const outputFile = './dist/maplibre-gl.d.ts';
childProcess.execSync(`dts-bundle-generator --umd-module-name=maplibregl -o ${outputFile} ./src/index.ts`);
childProcess.execSync(`dts-bundle-generator --umd-module-name=maplibregl -o ${outputFile} --config ./build/dts-bundle-generator-config.json ./src/index.ts`);
let types = fs.readFileSync(outputFile, 'utf8');
// Classes are not exported but should be since this is exported as UMD - fixing...
types = types.replace(/declare class/g, 'export declare class');
fs.writeFileSync(outputFile, types);

console.log('Finifhed bundling types for maplibre-gl ');
console.log('Finished bundling types for maplibre-gl ');

Loading

0 comments on commit 5b260d2

Please sign in to comment.