summaryrefslogtreecommitdiff
path: root/packages/pogen/po2.js
diff options
context:
space:
mode:
Diffstat (limited to 'packages/pogen/po2.js')
-rw-r--r--packages/pogen/po2.js32
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