From 9eeacb317e9384bd07c1a6c360bb6891f2bc655c Mon Sep 17 00:00:00 2001 From: Chris Saganic Date: Mon, 20 Mar 2023 09:14:47 -0700 Subject: [PATCH] feat: show module imports --- src/get-package-json.ts | 5 +++++ src/main.ts | 4 ++-- src/other-file.ts | 0 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 src/get-package-json.ts delete mode 100644 src/other-file.ts diff --git a/src/get-package-json.ts b/src/get-package-json.ts new file mode 100644 index 0000000..74b6752 --- /dev/null +++ b/src/get-package-json.ts @@ -0,0 +1,5 @@ +// get-package-json.ts +import fs from "fs" + +// read package.json and return its contents +export default () => fs.readFileSync('package.json', 'utf8') \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index a9a3da2..9740274 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,5 +1,5 @@ // main.ts -import fs from "fs" +import getPackageJson from "./get-package-json.js" // log the contents of package.json -console.log('Working', fs.readFileSync('package.json', 'utf8')) \ No newline at end of file +console.log('Working', getPackageJson()) \ No newline at end of file diff --git a/src/other-file.ts b/src/other-file.ts deleted file mode 100644 index e69de29..0000000