@datapos/datapos-development 0.3.31 → 0.3.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +4 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -17,11 +17,13 @@ async function buildConfig(directoryPath) {
|
|
|
17
17
|
async function documentInterface(directoryPath) {
|
|
18
18
|
const configJSON = await readJSONFile(`${directoryPath || ''}config.json`);
|
|
19
19
|
const indexCode = await fs.readFile(`${directoryPath || ''}src/index.ts`, 'utf8');
|
|
20
|
-
// Match class methods and
|
|
21
|
-
const regex =
|
|
20
|
+
// Match class methods and top-level functions, avoiding control flow
|
|
21
|
+
const regex = /^\s{4}(?:async\s+)?(?:private\s+|public\s+|protected\s+)?([A-Za-z_]\w*)\s*\([^)]*\)\s*(?::\s*[^{]+)?\s*\{/gm;
|
|
22
22
|
const matches = [...indexCode.matchAll(regex)].map((m) => m[1]);
|
|
23
23
|
|
|
24
|
+
configJSON.interface = matches;
|
|
24
25
|
console.log(matches);
|
|
26
|
+
await fs.writeFile(`${directoryPath || ''}config.json`, JSON.stringify(configJSON, undefined, 4));
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
// Operations - Build public directory index.
|