{"action":"created","issue":{"url":"https://api.github.com/repos/npm/npm/issues/19899","repository_url":"https://api.github.com/repos/npm/npm","labels_url":"https://api.github.com/repos/npm/npm/issues/19899/labels{/name}","comments_url":"https://api.github.com/repos/npm/npm/issues/19899/comments","events_url":"https://api.github.com/repos/npm/npm/issues/19899/events","html_url":"https://github.com/npm/npm/issues/19899","id":299743183,"number":19899,"title":"File Not Included In Package if named 'package'.","user":{"login":"Undistraction","id":161489,"avatar_url":"https://avatars2.githubusercontent.com/u/161489?v=4","gravatar_id":"","url":"https://api.github.com/users/Undistraction","html_url":"https://github.com/Undistraction","followers_url":"https://api.github.com/users/Undistraction/followers","following_url":"https://api.github.com/users/Undistraction/following{/other_user}","gists_url":"https://api.github.com/users/Undistraction/gists{/gist_id}","starred_url":"https://api.github.com/users/Undistraction/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Undistraction/subscriptions","organizations_url":"https://api.github.com/users/Undistraction/orgs","repos_url":"https://api.github.com/users/Undistraction/repos","events_url":"https://api.github.com/users/Undistraction/events{/privacy}","received_events_url":"https://api.github.com/users/Undistraction/received_events","type":"User","site_admin":false},"labels":[{"id":104304843,"url":"https://api.github.com/repos/npm/npm/labels/support","name":"support","color":"000000","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-02-23T15:12:56Z","updated_at":"2018-02-24T07:28:37Z","closed_at":"2018-02-24T06:17:43Z","author_association":"NONE","body":"#### I'm opening this issue because:\r\n\r\nNPM is doing something I don't understand.\r\n\r\n#### What's going wrong?\r\n\r\nA file is missing from my package when downloaded from npm because it contains `package` in the file name: `package.template.json`.\r\n\r\nIf I run `npm pack` I can verify the file is present in the generated tarball, however once I publish the package and install it, the file is no longer present in the installed package.\r\n\r\nIf I change the name of the file to something other than 'package',  it is included as expected.\r\n\r\nIt seems that there is nothing on the list of [automatically ignored files](https://docs.npmjs.com/misc/developers) that would cause the file to be ignored.\r\n\r\nMy hunch is that this is caused by a regex that isn't specific enough and matches just on filename and not extension. \r\n\r\n#### How can the CLI team reproduce the problem?\r\n\r\n- Clone / Fork https://github.com/Undistraction/default-template\r\n- Rename package\r\n- Run `npm pack` and verify file `package.template.json` is present in `/templates` dir.\r\n- Publish package\r\n- Install package\r\n- Verify file `package.template.json` is not present in `/templates` dir.\r\n\r\n### supporting information:\r\n\r\nnpm: 5.5.1\r\nnode: 9.3.0\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/npm/npm/issues/comments/368207745","html_url":"https://github.com/npm/npm/issues/19899#issuecomment-368207745","issue_url":"https://api.github.com/repos/npm/npm/issues/19899","id":368207745,"user":{"login":"zkat","id":17535,"avatar_url":"https://avatars1.githubusercontent.com/u/17535?v=4","gravatar_id":"","url":"https://api.github.com/users/zkat","html_url":"https://github.com/zkat","followers_url":"https://api.github.com/users/zkat/followers","following_url":"https://api.github.com/users/zkat/following{/other_user}","gists_url":"https://api.github.com/users/zkat/gists{/gist_id}","starred_url":"https://api.github.com/users/zkat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zkat/subscriptions","organizations_url":"https://api.github.com/users/zkat/orgs","repos_url":"https://api.github.com/users/zkat/repos","events_url":"https://api.github.com/users/zkat/events{/privacy}","received_events_url":"https://api.github.com/users/zkat/received_events","type":"User","site_admin":false},"created_at":"2018-02-24T07:28:37Z","updated_at":"2018-02-24T07:28:37Z","author_association":"OWNER","body":"no worries! Your report was thorough enough and provided the links to the information I needed so it was easy to debug for someone who's used to people getting surprised by the (sometimes surprising) behavior of the file packer.\r\n\r\nYou can read [the page on Files and Ignores](https://github.com/npm/npm/wiki/Files-and-Ignores) for more details (note: the part at the bottom about implementation is no longer applicable, since we use [`npm-packlist`](https://npm.im/npm-packlist) now). You can also check out [the test suite for file inclusion/exclusion logic](https://github.com/npm/npm/blob/latest/test/tap/files-and-ignores.js) which is both pretty thorough and, imo, fairly easy to read through when you're trying to understand the sharp corners. Hopefully that'll help if you ever run into these issues again.\r\n\r\nAs a final note, I highly recommend folks using an explicit `files` array in their `package.json`, because it's great at making sure you're only picking up the files you _actually_ wanna publish, and often trumps some of the shenanigans of .gitignore/.npmignore.\r\n\r\nHave a good one!"}}
{"actor":{"display_login":"zkat"}}