Skip to content

Commit

Permalink
fix script, build
Browse files Browse the repository at this point in the history
  • Loading branch information
zardoy committed Jan 21, 2024
1 parent 228d939 commit d0f94d4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions scripts/genTypes.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
//@ts-check
import fs from 'fs'

const targetFile = './dist/types.d.ts';
const modules = fs.readdirSync('./dist/lib/modules').filter(f => f !== 'index')
types = modules.filter(module => module.endsWith('.d.ts')).map(module => `import "./lib/modules/${module}"`).join('\n') + '\n' + types
const plugins = fs.readdirSync('./dist/lib/modules').filter(f => f !== 'index')
let types = ''
types = plugins.filter(module => module.endsWith('.d.ts')).map(module => `import "./lib/plugins/${module}"`).join('\n') + '\n' + types
fs.writeFileSync(targetFile, types, 'utf8')

let indexTs = fs.readFileSync('./dist/index.d.ts', 'utf8')
indexTs = `import './types';` + indexTs
fs.writeFileSync('./dist/index.d.ts', indexTs, 'utf8')

0 comments on commit d0f94d4

Please sign in to comment.