Reputation: 11159
I've put together a little library called Mockery (edit: now called pretendr because there's another project called mockery), and I want to put it in npm. The library has directories called lib
and test
for the source files and unit tests respectively. I have the following in my package.json:
"files" : [
"Makefile",
"README.md",
"lib/",
"lib/mockery.js",
"test/",
"test/runner.js",
"test/tests.js"
],
"directories" : {
"lib" : "lib",
"test" : "test"
},
"main" : "lib/mockery"
But for some reason, everything in my lib
directory just seems to go in the root directory of my npm module. The test
directory works automatically (even if I don't include the "directories"
part of the package.json). How can I make npm put my lib directory contents in the correct place?
Upvotes: 2
Views: 5264
Reputation: 39261
I think it's not because of the directories entry, but you have "lib/" under a files entry, too. According to npm doc:
The "files" field is an array of files to include in your project.
If you name a folder in the array, then it will also include the files inside that folder.
(Unless they would be ignored by another rule.)
Upvotes: 4
Reputation: 11159
I've worked it out... it was a really silly mistake. Turns out there's a package called mockery
, and mine is called Mockery
, and they just looked very similar in directory file names. That's the problem with standard ways of doing things!
Upvotes: 2