Tuesday, 25 April 2017

npm should I publish my source?

I hope this question won't be too opinionated, I'm asking about the best/common practise for this.

I'm publishing an npm module written in ES6 and transpiled to ES5 and UMD using babel and rollup.

The file structure could be resumed like this:

/coverage/
/dist/
/node_modules/
/src/
/test/
/tools/
.editorconfig
.eslintrc
.gitattributes
.gitignore
.travis.yml
CHANGELOG.md
CONTRIBUTING.md
LICENSE.txt
package.json
README.md

The source code is within /src/ and the compiled code into /dist/.
These dirs are .gitignored:

  • coverage
  • dist
  • node_modules

What the user would really use is indeed the content of /dist/.

I've been using a starter kit with a build process that:

  1. takes the original packages.json
  2. removes all the scripts and dev related fields from it
  3. copies it into dist
  4. also copies the files (untouched) LICENSE and README into dist

The entire package source will be published on github but I'm not sure about what to publish on nmp:

A) the entire file structure (removing /coverage/ and /node_modules/) with a top level packages.json that has an entry point to the relevant file in dist

or

B) just publish the content of dist with a stripped down packages.json and the README & LICENSE. To notice that just publishing the content of /dist would not let sourcemap work, of course.

What is the common practise here?



via Leonardo

No comments:

Post a Comment