Gitignore.io Template Fork
source link: https://blog.joeblau.com/gitignore-io-template-fork
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
November 7, 2017
Growing Beyond GitHub’s gitignore Template List #
Since Feb 13, 2013, gitignore.io relied on GitHub’s list of gitignore templates to power the website. GitHub maintains the most popular gitignore template list as reflected by it’s 50,000+ stars. As gitignore.io grows, our community faces challenges relying on GitHub’s template list.
Acceptance - gitignore templates must meet contributing guideline requirements preventing merges from small and undocumented projects. As a result, gitignore.io already has twice as many gitignore templates.
Composition - Larger templates, such as the
Objective-C.gitignore, can not be composed from smaller templates.
Objective-C.gitignoreincludes Cocoapods, Carthage, Fastlane, and iOSInjectionProject which should all be separate templates.
Inheritance - The JetBrains template is an example where one template has multiple uses. All Idea IDE’s ignore the same core list of files. If a C++ developer is working in CLion, the CLion template should inherit from the JetBrains template.
Extension - GitHub’s original template list challenged developers who wanted functionality but were not accepted because point 1 and 2. The community needed a way to make changes that weren’t accepted by the main repository, but still made sense.
The Plan #
Todays fork plans to address all five issues.
Responsiveness - I am migrating to the https://github.com/dvcs/gitignore repository with the goal of merging pull requests and/or providing feedback within 5 days.
Acceptance - I will accept all templates that make sense. If you have a new template or modification to an existing template, I will merge it. Occasionally, developers submit templates without fully understanding the architecture of gitignore.io so I will work to make sure each pull request can be merged using one of the following three features.
Composition - I’m introducing a new
.stackfile extension to support composition. The
ReactNativetemplate combines multiple templates with the stack design pattern.
Here is the example for React Native:
// Base - Base template ReactNative.gitignore // Stack - Templates added to the base template ReactNative.Android.stack@ -> Android.gitignore ReactNative.Buck.stack@ -> Buck.gitignore ReactNative.Gradle.stack@ -> Gradle.gitignore ReactNative.Linux.stack@ -> Linux.gitignore ReactNative.Node.stack@ -> Node.gitignore ReactNative.Xcode.stack@ -> Xcode.gitignore ReactNative.macOS.stack@ -> macOS.gitignore
There is a base react native template, then each stack with follows the format
Gitignore.io’s template generation engine will compose all of the stacks into the final template at run-time resulting in the final template.
Inheritance - This happens through symlinks from the child to the parent template. JetBrains is the largest collection of templates that use symlinks on gitignore.io.
JetBrains.gitignore AppCode.gitignore@ -> JetBrains.gitignore CLion.gitignore@ -> JetBrains.gitignore Intellij.gitignore@ -> JetBrains.gitignore JetBrains+all.gitignore@ -> JetBrains.gitignore JetBrains+iml.gitignore@ -> JetBrains.gitignore PhpStorm.gitignore@ -> JetBrains.gitignore PyCharm.gitignore@ -> JetBrains.gitignore RubyMine.gitignore@ -> JetBrains.gitignore WebStorm.gitignore@ -> JetBrains.gitignore
Extension - The
.patchfile extension allows gitignore.io to extend a template without modifying the original. This was extremely useful allowing gitignore.io to add ignore patterns to neglected templates. As gitignore.io cleans up the template list, this will see less usage.
Going forward #
Contribute - Please submit a pull request if you have a project with
.giignoretemplate that is not in our repository.
Aggregate valuable and interesting links.
Joyk means Joy of geeK