Currently, I am working on developing a cli package and when it comes to displaying the version, I am utilizing the version
imported from package.json
.
Upon running tsc
, the structure of the dist folder appears as follows:
/dist
--/package.json
--/README.md
--/src
----files
----...
The package.json
contains the property:
"files": [
"dist/**/*"
],
When using npm pack
to preview the tarball contents, only three files are packed:
npm notice 1.9kB dist/package.json
npm notice 1.7kB package.json
npm notice 1.2kB README.md
However, if I exclude importing the version from package.json
, it does not end up in the dist
directory and all content within dist
is correctly packed.
As a temporary workaround, I am reading package.json
with fs
, but this solution lacks elegance.
Is there a more efficient way to resolve this issue?