chore: add a tool to get the static module definitions

This commit is contained in:
pan93412 2022-01-26 14:50:50 +08:00
parent c412f53f11
commit 69a71cb710
No known key found for this signature in database
GPG Key ID: 42154B1B1CFE3377
2 changed files with 23 additions and 0 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@ node_modules
.idea .idea
.vscode .vscode
.history .history
examples/moddef.json

View File

@ -0,0 +1,22 @@
const fsPromises = require('fs/promises')
const path = require('path')
const server = require('../server')
const exportFile = path.join(__dirname, 'moddef.json')
async function main() {
const def = await server.getModulesDefinitions(
path.join(__dirname, '..', 'module'),
{
'daily_signin.js': '/daily_signin',
'fm_trash.js': '/fm_trash',
'personal_fm.js': '/personal_fm',
},
false,
)
fsPromises.writeFile(exportFile, JSON.stringify(def, null, 4))
console.log(`👍 Get your own definition at: ${exportFile}`)
}
main()