diff options
author | Florian Dold <florian@dold.me> | 2021-03-27 13:55:15 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2021-03-27 13:55:15 +0100 |
commit | c26a41ce70a56c73571c51e1fb4aca5a5b4de225 (patch) | |
tree | abbda3d07a381d8fc8cb75fae00288bc26c8a732 /packages/pogen/po2.js | |
parent | 35bbe6af2db1bd69ae661610fa234541c1d2d570 (diff) | |
download | wallet-core-c26a41ce70a56c73571c51e1fb4aca5a5b4de225.tar.xz |
pogen WIP
Diffstat (limited to 'packages/pogen/po2.js')
-rw-r--r-- | packages/pogen/po2.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/packages/pogen/po2.js b/packages/pogen/po2.js new file mode 100644 index 000000000..532a1522f --- /dev/null +++ b/packages/pogen/po2.js @@ -0,0 +1,32 @@ +const ts = require("typescript"); + +const configPath = ts.findConfigFile( + /*searchPath*/ "./", + ts.sys.fileExists, + "tsconfig.json" + ); +if (!configPath) { + throw new Error("Could not find a valid 'tsconfig.json'."); +} + +console.log(configPath); + +const cmdline = ts.getParsedCommandLineOfConfigFile(configPath, {}, { + fileExists: ts.sys.fileExists, + getCurrentDirectory: ts.sys.getCurrentDirectory, + onUnRecoverableConfigFileDiagnostic: (e) => console.log(e), + readDirectory: ts.sys.readDirectory, + readFile: ts.sys.readFile, + useCaseSensitiveFileNames: true, +}) + +console.log(cmdline); + +const prog = ts.createProgram({ + options: cmdline.options, + rootNames: cmdline.fileNames, +}); + +const allFiles = prog.getSourceFiles(); + +console.log(allFiles.map(x => x.path));
\ No newline at end of file |