What should I put in a meteor .gitignore file?

2019-03-08 09:08发布

问题:

I have a new meteor project. I'm guessing the .meteor dir has a combination of configuration files (needed) and temporary files (not needed).

So what's in your .gitignore?

回答1:

The only directory you want excluded from version control is .meteor/local.

Meteor automatically creates the right .meteor and .meteor/.gitignore, though -- you shouldn't need to do anything.



回答2:

You might want to put any configuration settings files in there if you are pushing to a public repos.

I store any security sensitive data configuration settings like encryption keys and various passwords for services like smtp, twitter, facebook and others in a config.js and then put that in .gitignore or in the info/exclude file. Stuff I don't want in a public repo.

Just an additional suggestion to consider for your .gitignore



回答3:

Your gitignore should also contain:

public/node_modules

And you supplement this with a properly crafted package.json that manages node module dependency installation.

This will necessitate a npm install when installed somewhere new.



回答4:

According to this article, you should ignore your settings.json, especially if you have environment specific information to include API keys.



回答5:

With meteor 1.3 you want to also ignore node_modules. There is no reason to have all of the libraries added to git because you can install them through npm. The node_modules folder most likely is larger than your app (excluding the .meteor/local folder)



回答6:

Meteor creates a .gitignore in the .meteor directory by default.

However, your project's .gitignore should exclude any sensitive data config files and node_modules.



回答7:

if you use

  • Intellij IDE ignore .ideafolder
  • Sublime Text ignore sublime-project sublime-workspace

if you are mac user you can ignore DS_Store

and if you use npm ignore npm cause if both windows and mac user work on same project, as the same npm version is different for mac and windows it shows error.



回答8:

Here is what I use with Webstorm and Meteor 1.4 deployed with Mupx.

# Meteor files to ignore now handled by .ignore file within .Meteor folder automatically

# settings file to ignore to protect API keys
settings.json

# MUP / MUPX file to ignore to protect server passwords and sensitive info.
mup.json

# npm package files to ignore
node?modules/
npm-debug.log

# Webstorm IDE files to ignore
.idea/*

# Typing type definition files to ignore. Webstorm uses type definitions for autocomplete even without typescript
typings/*


回答9:

We use this gitignore, which englobes many IDEs and Meteor, along system files and others.

### WebStorm ###
.idea/

### OSX ###
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear on external disk
.Spotlight-V100
.Trashes
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### Windows ###
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows shortcuts
*.lnk

### Linux ###
*~
# KDE directory preferences
.directory

### SublimeText ###
# cache files for sublime text
*.tmlanguage.cache
*.tmPreferences.cache
*.stTheme.cache
# workspace files are user-specific
*.sublime-workspace
# project files should be checked into the repository, unless a significant
# proportion of contributors will probably not be using SublimeText
# *.sublime-project
# sftp configuration file
sftp-config.json

### Node/NPM ###
node_modules
npm-debug.log

### Development ###
dump
mochawesome-reports
ngrok


回答10:

you will need to put installed packages directory named node_modules which is located in root directory. and while you commit project it will be ignored. also product manager can easily install packages in their server using package.json.



回答11:

### MeteorJS ###
# default meteor build and local packages
.meteor/local

# meteor settings file
settings.json

# meteor build output files
*.tar.gz

# general swp files from vim
*.swp

# End of https://www.gitignore.io/api/meteorjs


回答12:

This is the .gitignore file I use with Intellij:

  node_modules/
  .meteor/local/*
  .idea/
  npm-debug.log
  packages/*/.npm/


回答13:

you can use this site https://www.gitignore.io/ to generate a .gitignore file for any project , just insert the thechnologies you use and your IDE



回答14:

  1. gitignore is used to ignore all the unnecessary burden over the git server and your fetching all the time.
  2. So the best possible stuff to put inside the gitignore is packagable entity. Now, this includes the meteor downloadable packages, so, you should just add ".meteor/local" inside gitignore.
  3. When you add it to gitignore configuration, it reduces the size of project to n times smaller as it would be with the packages.
  4. If you cut-paste the entire project now to different location or fetch the repository without .meteor/local folder and start the project using meteor command, the meteor first downloads the required packages and then starts the server.


回答15:

.meteor/local is the only thing you want missing from version control.

Meteor automatically generates a .gitignore file that would fit your needs.

If it's a public repository you'll likely want to include "settings-development.json" or any other JSON files containing information you don't want to disclose to the public such as AWS API keys.

However Bitbucket and some others provides free private repositories which should fit your needs.