How to use the .npmignore


How to use the .npmignore.

I was create a Atom language package.

I wrote it by TypeScript. not JavaScript and CoffeeScript.
I want to commit to git repository only .ts files.
but apm publish are read only .gitignore.
I want to use .npmignore.

Do I have to commit even extra code?

.npmignore for APM (.apmignore?)

If I’m understanding correctly, the two files are for completely different purposes. .npmignore is for keeping files out of an npm package, which you’re not creating. You’re creating an Atom package. .gitignore is for keeping files out of a Git repository, which apm is dependent on. So, why would .npmignore work for what you want to do?


@leedohm thank you for your reply.

I want to do apm publish. it required the JavaScript files (it created by TypeScript code.)
but I want to exclude JavaScript files from my git repository. because it is working files. it generated by grunt tasks.
I think .npmignore is good idea. It allows the above behavior.

I thought apm are npm wrapper. but it is wrong.
We are need a .apmignore. isn’t it?


.gitignore keeps files out of the Git repository already. There is no need for an .apmignore.


I want keeps JavaScript files out of the Git repository.
but I want to publish JavaScript files contains of the Apm Package.


Ah ok … thank you. I understand now :blush:

The contents of the Git repository are the contents of your Atom package. So if you keep them out of the Git repo, then they aren’t in your package. I’m pretty sure I heard that the Atom team plans long-term to support other package repositories than and maybe this kind of thing would be possible with a different package repository … but I think for now you’ll have to include the JavaScript files in your Git repository.


@leedohm oh. i understand. thank you!
I try to read the code of apm. :smiley_cat:


Purely as an experiment. An ugly hack would be to push to NPM and then have a seperate git repository as the apm package which only has a package.json depending on the npm package and pointing its main to be inside that package.

Then you publish to NPM.

I would never do this though.


I want .apmignore. Can we make this a thing?


You may want to subscribe here for updates: