I'd like to ignore all the .sh files in a project, except for the ones located in a particular directory, let's call the directory foo.
so we have:
project/
bar.sh
baz.sh
foo/
a.sh
b.sh
I don't want to publish bar.sh and baz.sh to NPM, but I do want to publish a.sh and b.sh to NPM. It turns out I have a number of .sh files outside of the foo directory, and it would be more convenient to ignore all of them in one fell swoop.
What can I add to my .npmignore file that would accomplish this?
In the docs for .npmignore it states:
In which case you ignore all the
.shfiles (i.e.*.sh) then negate that pattern using the apostrophe!and specify the folder name that you want to include. For example:Example 1
Using this configuration, (within the context of the example folder structure shown below), all these files are ignored:
a.sh,b.sh,e.sh,f.shThe following files are included/published:
c.shandd.sh.Note:
e.shandf.share ignored too using this config as they're in a sub folder.Example 2
To also include/publish the
.shfiles in any sub folders of the folderfoothen configure your.npmignoreas follows:Using this configuration, (within the context of the example folder structure shown below), only files:
a.shandb.share ignored. All other.shfiles are published.Example folder structure