Angular2 .gitignore

39

我正在设置一个Angular 2示例项目。我的.gitignore是否已足够,还是我漏掉了什么?

node_modules
typings
jspm_packages
bower_components
app/**/*.js
app/**/*.map
2个回答

67

angular-cli 生成

# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp
/out-tsc

# dependencies
/node_modules

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
testem.log
/typings

# e2e
/e2e/*.js
/e2e/*.map

# System Files
.DS_Store
Thumbs.db

3
使用 ng new MyProject 命令创建的项目不包括任何 .gitignore 文件 ...? - phil294
我不知道为什么。我确定它应该可以。这是它应该生成的文件 https://github.com/angular/angular-cli/blob/e9372d3c11af622f026d391088e173eb5c66bda9/packages/%40angular/cli/blueprints/ng/files/gitignore - Günter Zöchbauer
1
谢谢!找到了问题所在。由于http://stackoverflow.com/a/43525586/3779853,ng cli没有正确更新。 - phil294
/e2e/*.ts怎么样? - katie
现在位于 https://github.com/angular/angular-cli/blob/6fc6e84/packages/schematics/angular/workspace/files/__dot__gitignore.template - qaisjp
1
2021年 - 当应用程序创建时,此文件将自动生成 - ng版本11 - npm版本12 - @phil294 - Mauricio Gracia Gutierrez

2

通过"@angular/cli": "~15.0.2"更新自动生成的.gitignore文件,为Angular 15.0.0添加了/.angular/cache和其他应该被忽略的新文件夹:

# See http://help.github.com/ignore-files/ for more about ignoring files.

# Compiled output
/dist
/tmp
/out-tsc
/bazel-out

# Node
/node_modules
npm-debug.log
yarn-error.log

# IDEs and editors
.idea/
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*

# Miscellaneous
/.angular/cache
.sass-cache/
/connect.lock
/coverage
/libpeerconnection.log
testem.log
/typings

# System files
.DS_Store
Thumbs.db

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接