I'm writing a cli package and for showing the version I'm importing version from package.json.
When I do that, after running tsc the dist folder looks like that:
/dist
--/package.json
--/README.md
--/src
----files
----...
the package.json has the following property:
"files": [
"dist/**/*"
],
I use npm pack to see what will be part of the tarball.
when I try to pack it, only 3 files are packed:
npm notice 1.9kB dist/package.json
npm notice 1.7kB package.json
npm notice 1.2kB README.md
but If I don't import the version from package.json, it is no longer in the dist directory and all the content in dist gets packed properly.
As a temporary measure I'm reading package.json with fs, but that's far an elegant solution.
Is there a way to solve this issue?
The issue caused by npm, downgrading permission (ran as root on the ci), adding to the npm config unsafe-perm solved it.