Build: Use absolute paths in .gitignore and .npmignore.

.gitignore/.npmignore treat all its paths as relative to *every*
directory in the repository. In most cases that’s not what’s desired.

(cherry-picked from 2d7315051193212fca6e7d64a3de87d96977c418)