pkg-ok icon indicating copy to clipboard operation
pkg-ok copied to clipboard

Any plans for checking the files array or npmrc

Open thetutlage opened this issue 7 years ago • 6 comments

I am regular user of pkg-ok and loves it 😄

I try to be explicit about the files I publish to the npm using the files array or the .npmrc file. I have been bitten quite a few times, where as per pkg-ok the paths are correct, however, I forgot to add them to the files array.

I am checking to see if you have any plans to check the published files and then validate paths. Not only it makes sure that the path exists, it also makes sure that paths are also published to npm.

I am happy to work on this feature (only if you want to add it).

Thanks

thetutlage avatar Sep 22 '18 14:09 thetutlage

Thanks @thetutlage :) glad you like it.

Not sure to know how files field relate to .npmrc? Could you point me to some docs? Also a basic package.json and .npmrc examples would be helpful.

typicode avatar Sep 24 '18 00:09 typicode

Maybe the @thetutlage has meant the .npmignore rather than .npmrc, I'm not sure if latter can control what gets published to the registry.

Andarist avatar Oct 06 '18 09:10 Andarist

Maybe there is an npm JS API or npm publish --dry-run could be used to get the list of files that will be published and match against that.

abraham avatar Mar 11 '22 16:03 abraham

For reference - this is what got implemented in Preconstruct to validate this sort of a thing: https://github.com/preconstruct/preconstruct/blob/50744cf58f9473c16e765e92c441a118a5b5b985/packages/cli/src/validate-included-files.ts#L8

Andarist avatar Mar 11 '22 16:03 Andarist

Nice. npm-packlist looks particularly useful.

abraham avatar Mar 11 '22 16:03 abraham

npm pack --dry-run --json shows which files will be packaged: https://github.com/sindresorhus/np/pull/682

This could then be verified against the files list.

tommy-mitchell avatar Apr 06 '23 01:04 tommy-mitchell