When packaging nodejs modules, often you face some complexities with the build process. Some common cases will be covered here.

Upstream repo does not have required tags

Manually downloading a git commit snapshot when the repo does not have tags matching with npmjs.com releases

Exclude generated files from source package

Exclude generated files from the source package (repacking)

Embed simple modules as a component

Embed a simple dependency as a component (ignore, group and checksum options in watch file)

Avoid self build dependency loop

Simple case of circular self build dependency (babel-plugin-lodash build depends on itself)

Using extlinks and extcopies options of pkg-js-tools for creating node_modules directory with symlinks or copies of modules installed in /usr/share/nodejs