13

我创建了一个新应用程序,Dart 编辑器 (M4) 创建了大量文件和文件夹。现在我不确定哪个可以安全地放入 gitignore。这是树:

app/.buildlog
app/build.dart
app/packages/analyzer_experimental
app/packages/args
app/packages/browser
app/packages/csslib
app/packages/html5lib
app/packages/js
app/packages/logging
app/packages/meta
app/packages/pathos
app/packages/source_maps
app/packages/unittest
app/packages/web_ui
app/pubspec.lock
app/pubspec.yaml
app/web/app.css
app/web/app.dart
app/web/app.html
app/web/out/app.css
app/web/out/app.dart
app/web/out/app.dart.map
app/web/out/app.html
app/web/out/app.html_bootstrap.dart
app/web/out/packages
app/web/out/xclickcounter.dart
app/web/out/xclickcounter.dart.map
app/web/packages
app/web/xclickcounter.dart
app/web/xclickcounter.html

我假设可以忽略以下文件:

app/.buildlog
app/packages/*
app/web/out/*
app/web/packages

那是对的吗?

4

4 回答 4

22

dartlang.org 上的What Not to Commit

# files and directories created by pub
.dart_tool/
.packages
.pub/
build/
pubspec.lock  # Except for application packages
# API documentation directory created by dartdoc
doc/api/
# files and directories created by other development environments
*.iml         # IntelliJ
*.ipr         # IntelliJ
*.iws         # IntelliJ
.idea/        # IntelliJ
.DS_Store     # Mac
# generated JavaScript files
*.dart.js
*.info.json      # Produced by the --dump-info flag.
*.js             # When generated by dart2js. Don't specify *.js if your
                 # project includes source files written in JavaScript.
*.js_
*.js.deps
*.js.map
于 2013-04-17T14:55:22.703 回答
5

不要提交以下由 pub、Dart Editor 和 dart2js 创建的文件和目录:

packages/
pubspec.lock  // Except for application packages
.project
.buildlog
*.js_
*.js.deps
*.js.map 

不要提交其他开发环境丢弃的文件和目录。例如:

.project      // Eclipse
*.iml         // IntelliJ
*.ipr         // IntelliJ
*.iws         // IntelliJ
.idea/        // IntelliJ
.DS_Store     // Mac

避免提交生成的 JavaScript 文件:

*.dart.js

有关更多详细信息,请阅读https://www.dartlang.org/tools/private-files.html

于 2014-01-28T11:06:18.660 回答
2

飞镖默认

.packages      # mapping file from package names to local path
packages       # until `--no-package-symlinks` is the default
build/         # contains the output of `pub build`
.pubspec.lock  # controversial - Dart guideline is to only commit
               #     for applications but not for packages
.pub/          # cache files generated by `pub` 
               # .pub was moved to .dart_tool/.pub

build新的https://github.com/dart-lang/build包引入了一个

.dart_tool/

应该排除的目录。

当涉及到生成的文件时,通常最好不要将它们提交给源代码管理,但特定的构建器可能会提供其他建议。

IDE

.idea # IntelliJ, WebStorm

巴泽尔

/bazel-*
.bazelify
packages.bzl
BUILD
WORKSPACE

也可以看看

于 2014-08-21T06:42:28.153 回答
1

Github 上的 gitignore 存储库中提供了最新的 Dart .gitignore 示例:

https://github.com/github/gitignore/blob/master/Dart.gitignore

请注意,这不包含 IDE 或编辑器文件,仅包含 Dart 文件。您可以在同一个 repo 中找到 IDE 和编辑器 .gitignores。

我包含doc/api在我的 .gitignore 中。我倾向于写大量的文档评论,我喜欢用它dartdoc来生成文档以供审查。

于 2016-02-24T14:52:30.430 回答