|
1 | | -const fs = require('fs'); |
2 | | -const path = require('path'); |
| 1 | +import fs from 'fs'; |
| 2 | +import path from 'path'; |
| 3 | +import { fileURLToPath } from 'url'; |
| 4 | +import { getAllEntries } from './helper.js'; |
3 | 5 |
|
4 | | -const data = JSON.parse(fs.readFileSync(path.join(__dirname, '../docs/data.json'))); |
5 | | - |
6 | | -function getEntries(entry) { |
7 | | - return [ |
8 | | - entry, |
9 | | - ...getAllEntries(entry.members.global), |
10 | | - ...getAllEntries(entry.members.inner), |
11 | | - ...getAllEntries(entry.members.instance), |
12 | | - ...getAllEntries(entry.members.events), |
13 | | - ...getAllEntries(entry.members.static) |
14 | | - ]; |
15 | | -} |
| 6 | +const __filename = fileURLToPath(import.meta.url); |
| 7 | +const __dirname = path.dirname(__filename); |
16 | 8 |
|
17 | | -function getAllEntries(arr) { |
18 | | - return arr.flatMap(getEntries); |
19 | | -} |
| 9 | +const data = JSON.parse(fs.readFileSync(path.join(__dirname, '../docs/data.json'))); |
20 | 10 |
|
21 | 11 | const allData = getAllEntries(data); |
22 | 12 |
|
@@ -616,4 +606,3 @@ fs.writeFileSync(path.join(__dirname, '../docs/reference/data.json'), JSON.strin |
616 | 606 | fs.writeFileSync(path.join(__dirname, '../docs/reference/data.min.json'), JSON.stringify(converted)); |
617 | 607 | buildParamDocs(JSON.parse(JSON.stringify(converted))); |
618 | 608 |
|
619 | | -module.exports= { getAllEntries }; |
0 commit comments