Dart: default gitignore?

后端 未结 4 1530
一生所求
一生所求 2021-01-02 00:25

I created a new app and the Dart Editor (M4) created a slew of files and folders. Now I\'m not sure which I can safely put in the gitignore. Here\'s the tree:



        
相关标签:
4条回答
  • 2021-01-02 00:59

    Dart default

    .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 The new https://github.com/dart-lang/build package introduces a

    .dart_tool/
    

    directory which should be excluded.

    When it comes to generated files it is generally best to not submit them to source control, but a specific Builder may provide a recommendation otherwise.

    IDE

    .idea # IntelliJ, WebStorm
    

    bazel

    /bazel-*
    .bazelify
    packages.bzl
    BUILD
    WORKSPACE
    

    See also

    • https://github.com/github/gitignore/blob/master/Dart.gitignore
    • https://www.dartlang.org/guides/libraries/private-files
    0 讨论(0)
  • 2021-01-02 01:11

    Don’t commit the following files and directories created by pub, Dart Editor, and dart2js:

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

    Don’t commit files and directories dropped by other development environments. For example:

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

    Avoid committing generated JavaScript files:

    *.dart.js
    

    For more details, read https://www.dartlang.org/tools/private-files.html.

    0 讨论(0)
  • 2021-01-02 01:13

    From What Not to Commit on dartlang.org:

    # 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
    
    0 讨论(0)
  • 2021-01-02 01:25

    An up to date sample Dart .gitignore is available in the gitignore repo on Github:

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

    Note that this does not contain IDE or editor files, just Dart files. You can find IDE and editor .gitignores in the same repo.

    I include doc/api in my .gitignore. I tend to write substantial documentation comments and I like to use dartdoc to generate the documentation for review.

    0 讨论(0)
提交回复
热议问题