javascript - setting up npm package directories - Stack Overflow

I've put together a little library called Mockery (edit: now called pretendr because there's

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?

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?

Share edited Jan 18, 2012 at 9:13 Nathan asked Jan 17, 2012 at 14:27 NathanNathan 11.2k4 gold badges40 silver badges50 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 4

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.)

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!

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744861013a4597701.html

相关推荐

  • javascript - setting up npm package directories - Stack Overflow

    I've put together a little library called Mockery (edit: now called pretendr because there's

    2天前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信