2012-05-23 42 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 
相關問題