A
A
Alexander Kurakin2016-02-11 15:05:28
JavaScript
Alexander Kurakin, 2016-02-11 15:05:28

What to include in an NPM package, what to leave in a repository?

What to include in an NPM package, what to leave in a repository?
Let's say the library is written in ES2015 + TypeScript and is isomorphic.
I did not find a single approach in a year of observation, so a discussion is proposed:

  1. Should NPM packages include source (ES2015 + TypeScript) files?
  2. Should NPM packages include compiled files? If so, which ones? Browserify bundle, CommonJS (ES5.1) files, ES2015 files?
  3. Should I include tests in an NPM package?
  4. Should I store compiled files in the repository?
  5. Consider the root of the repository as the root of the NPM package, or create a directory package?
  6. Should NPM packages include things like examples?

Thank you!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
Konstantin Kitmanov, 2016-02-11
@kuraga333

1. Turn on. If the project is in ES6 right away, why should I import ES6 compiled into ES5? And tree-shake won't work...
2. CommonJS. Who needs ES6 modules - see point 1. bundle The consumer of the bundle will do it himself.
3. Tests are a good source of information on the topic "how it should work, and how to call it at all." But you can not include it, but then it's better to write in readme.md, they say, "for more examples, see test/ in the repo."
4. Doesn't make much sense. prepublish solves the "remember to compile before publishing" problem.
5. Why? You will have to copy everything you need to this directory manually or in a prepublish script, extra work.

C
Cat Anton, 2016-02-11
@27cm

What prevents you from seeing what the creators of popular NPM packages write in .npmignore?

S
sim3x, 2016-02-11
@sim3x

1 +
2 - (depending on the package, write what you need to install in order for the package to work)
3 +
4 -
5 repo root
example
https://github.com/sass/node-sass

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question