2012-05-23 38 views
146

我有一个新的流星项目。我猜.meteor DIR有配置文件(需要)和临时文件的组合(不需要)。我应该把什么在流星的.gitignore文件?

那么什么是你的.gitignore

+8

'settings.json'特别是如果你有API令牌在那里。 – Jesse

+1

我使用webstorm,我的.gitignore中唯一的一行是 '''.idea /''' – Dude

回答

197

你想排除版本控制的唯一目录是.meteor/local

流星会自动创建正确的.meteor.meteor/.gitignore,但是 - 您不需要执行任何操作。

+5

这仍然是这种情况吗?因为这个我今天下午开始了一个项目,没有找到.gitignore。 – akst

+17

heh。现在我懂了。它不在项目根目录内,而是在.meteor文件夹内。 – Nek

+0

我忽略了整个.meteor目录没有'包'文件,我现在没有任何问题在不同的环境中移动项目。 – thinklinux

21

你可能想要把所有的配置设置文件在那里,如果你正在推动公共回购。

我存储的任何安全敏感数据的配置设置,如加密密钥和用于SMTP一样,Twitter,Facebook和其他服务在config.js各种密码,然后把在的.gitignore或在信息/排除文件。东西我不想在公共回购。

只是一个额外的建议,考虑为您的.gitignore

+4

你不应该忽略这个答案,因为接受的答案不会阻止你在'settings.json'中发布你的社交媒体和AWS标记。 – Jesse

10

你gitignore还应包括:

公共/ node_modules

你补充这与管理节点模块依赖安装properly crafted package.json

这将需要安装一个新的地方时,NPM安装。

7

this article,你应该忽略你的settings.json,特别是如果你有环境的具体信息,包括API密钥。

6

流星会在.meteor目录默认情况下.gitignore

但是,您的项目的.gitignore应该排除任何敏感数据配置文件和node_modules

+0

如果排除node_modules,则必须在package.json“dependencies”部分中包含任何子目录。否则,它可能会导致你的部署。 – Deborah

3

如果使用

如果你是Mac用户,你可以忽略DS_Store

,如果您使用NPM忽略npm如果博th windows和mac用户在同一个项目上工作,因为相同的npm版本对于mac和windows是不同的,所以它显示错误。

+0

intellij的问题是您将失去ECMAScript级别。 –

7

一起来看流星1.3你也想忽略node_modules。没有理由将所有库添加到git中,因为您可以通过npm安装它们。该node_modules文件夹最有可能比你的应用程序(不包括.meteor/local文件夹)

0
  1. gitignore用于忽略了git的服务器和读取所有的时间所有的不必要的负担更大。
  2. 所以把最好的东西放在gitignore里面是可打包的实体。现在,这包括流星可下载的软件包,因此,您应该在gitignore中添加“.meteor/local”。
  3. 当您将它添加到gitignore配置中时,它将项目的大小减小到与包一样小n倍。
  4. 如果您现在将整个项目剪切粘贴到不同位置,或者在没有.meteor/local文件夹的情况下获取存储库并使用meteor命令启动该项目,则流星会首先下载所需的软件包,然后启动服务器。
3

下面是我使用Webstorm和流星1.4与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/* 
1

这是.gitignore文件以我的IntelliJ使用:

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

我们用这个gitignore,这englobes许多IDE和流星,以及系统文件等。

### 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 
2

您需要将安装的软件包目录名为node_modules,它位于根目录中。当你提交项目时,它将被忽略。产品经理也可以使用package.json轻松地在他们的服务器上安装软件包。

1
### 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 
相关问题