4 ms·
Just beware that some files may seem unnecessary but are expected from an idiomatic npm package. Three things that come to mind -- a markdown file named README.
by creatonez 3y ago
Just beware that some files may seem unnecessary but are expected from an idiomatic npm package. Three things that come to mind -- a markdown file named README.md, any generated typescript definitions, and typescript/babel sourcemaps. And something I've seen far too often: please don't give a minified, rolled up bundle as the only option, otherwise you are chucking your library's users back into the dark ages of Bower.js.
- nfriedly 3y agoThe readme gets included automatically even if you don't specify it in the files field, ditto for the changelog license, and package.json. Compare https://github.com/express-rate-limit/express-rate-limit/blob/v7.1.5/package.json#L50-L53 https://github.com/express-rate-limit/express-rate-limit/blo... to https://www.npmjs.com/package/express-rate-limit?activeTab=code https://www.npmjs.com/package/express-rate-limit?activeTab=c... Agree with you about the other points.
- rezonant 3y agoStrongly agree on minification. You should not minify or bundle anything in your NPM package. That decision should only be made by the top level project if it wishes.
- josephg 3y agoYep. And if you’re writing typescript, please include type definitions, source maps, type definition source maps and the original typescript source. Having all of this stuff makes it possible to ctrl+click on functions in my libraries and read the corresponding source code. That’s a godsend during development - well worth a few extra kb of files in the npm module. tsconfig.json: "declaration": true, "declarationMap": true, "sourceMap": true, ... package.json (assuming typescript compiles src/ to dist/): "files": [ "dist/*", "src/*" ],
- shepherdjerred 3y agoIt makes me wonder why these are even configurable. These should all be emitted by default.