npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

npm publish --ignore=x

I want to publish and dynamically ignore a folder.
Normally we put ignored items in .npmignore or whatever is not in the files property in package.json.
But in my case, I want to dynamically ignore a file/folder, at the command line when publishing, in my case, a folder called .r2g, so that would be:

npm publish --ignore=".r2g"

For context, see:

the .r2g folder is necessary for testing before publishing, but when we actually publish, we can drop the .r2g dir, as a last step.

I don’t see how npmignore can’t be used for this. This is what it’s meant for.

damnit lol, I need it to be dynamic! :) I have a use case where sometimes I want to publish a folder and sometimes I don’t.

on stackoverflow, I have this question

stackoverflow com /questions/52574019/dynamically-add-folder-to-ignore-when-using-npm-publish