Skip to content

Commit

Permalink
Merge pull request #232 from timocov/patch-1
Browse files Browse the repository at this point in the history
Replaced generate-dts script with a config file
  • Loading branch information
jahaganiev authored Apr 3, 2024
2 parents 273383b + 28f61f6 commit a691c77
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 61 deletions.
41 changes: 41 additions & 0 deletions dts-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
const fs = require('fs');

const pluginsDir = './src/plugins';
const distDir = './dist';
const excludePlugins = ['base-plugin'];

const outputConfig = {
noBanner: true,
};

const config = {
compilationOptions: {
preferredConfigPath: './tsconfig.json',
},
entries: [
{
filePath: './src/index.ts',
outFile: './dist/index.d.ts',
output: outputConfig,
},
...fs
.readdirSync(pluginsDir)
.map((pluginName) => {
if (
!fs.lstatSync(`${pluginsDir}/${pluginName}`).isDirectory() ||
excludePlugins.includes(pluginName)
) {
return null;
}

return {
filePath: `${pluginsDir}/${pluginName}/index.ts`,
outFile: `${distDir}/${pluginName}.d.ts`,
output: outputConfig,
};
})
.filter(Boolean),
],
};

module.exports = config;
60 changes: 0 additions & 60 deletions node-scripts/generate-dts.js

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"scripts": {
"watch": "webpack",
"pretty": "prettier --write \"./**/*.{js,jsx,ts,tsx,json}\"",
"generate-dts": "node node-scripts/generate-dts.js"
"generate-dts": "dts-bundle-generator --config dts-config.js"
},
"devDependencies": {
"dts-bundle-generator": "^9.0.0",
Expand Down

0 comments on commit a691c77

Please sign in to comment.