npm publish --ignore=x

(Operations Research Engineering Software+) #1

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.

(Kat Marchán) #2

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

(Operations Research Engineering Software+) #3

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