Fix:修复插件文件的类型定义文件没有生成的问题
This commit is contained in:
parent
4e6688e4e0
commit
ac5bb1d684
21
simple-mind-map/bin/createPluginsTypeFiles.js
Normal file
21
simple-mind-map/bin/createPluginsTypeFiles.js
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
const { exec } = require('child_process')
|
||||||
|
const fs = require('fs')
|
||||||
|
|
||||||
|
const base = './src/plugins/'
|
||||||
|
const list = fs.readdirSync(base)
|
||||||
|
const files = []
|
||||||
|
list.forEach(item => {
|
||||||
|
const stat = fs.statSync(base + item)
|
||||||
|
if (stat.isFile()) {
|
||||||
|
files.push(item)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const str = files
|
||||||
|
.map(item => {
|
||||||
|
return base + item
|
||||||
|
})
|
||||||
|
.join(' ')
|
||||||
|
|
||||||
|
exec(
|
||||||
|
`tsc ${str} --declaration --allowJs --emitDeclarationOnly --outDir types/src/ --target es2017 --skipLibCheck `
|
||||||
|
)
|
||||||
@ -22,7 +22,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "eslint src/",
|
"lint": "eslint src/",
|
||||||
"format": "prettier --write .",
|
"format": "prettier --write .",
|
||||||
"types": "npx -p typescript tsc index.js --declaration --allowJs --emitDeclarationOnly --outDir types --target es2017 --skipLibCheck",
|
"types": "npx -p typescript tsc index.js --declaration --allowJs --emitDeclarationOnly --outDir types --target es2017 --skipLibCheck & node ./bin/createPluginsTypeFiles.js",
|
||||||
"wsServe": "node ./bin/wsServer.mjs"
|
"wsServe": "node ./bin/wsServer.mjs"
|
||||||
},
|
},
|
||||||
"module": "index.js",
|
"module": "index.js",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user