Generating your boilerplate .gitignore the dead simple way
Step 2: there's no step 2. You should now have a
.gitignore file in your current directory. Happy starting your project!
- intended to be lightweight
🚀(2.06 KiB output size at v0.2.0)
- intended to be used with
npx, which enhances the designated
clinature of this tool
- 0 dependencies and 0 dependents
- suitable as integrations into other
cli's or IDE's, such as this and this
Command Line Interface API
The execution of this script should result in 2 streams of data:
stdoutwhich, on a successful execution, outputs the full path of the newly written .gitignore file (i.e.
/path/to/my/project/.gitignore). This value could be piped into other programs or otherwise consumed in environments such as IDE's, where the user then has the option to open the file for inspection after it is created.
stderrwhich ends with the string
doneif the execution was successful, or spits our information about the error if the execution failed.
When writing an integration plugin that executes
npx simplegitignore, it is recommended that you inspect the value of
stderr to decide appropriate courses of action, as shown in these examples.
Known caveats (!important!)
The current version:
- will overwrite any existing .gitignore file (
💣 💣 💣you've been warned!)
- doesn't gracefully handle any network error while fetching the remote
- doesn't allow specifying any output destination (in other words: it always writes to the current directory)
- should not be
npm installed or
imported because it will just immediately invoke then exit. In other words: no programmatic use!
While pull requests are much welcomed to address the above, do keep in mind that the general idea behind this tool is to stay dead simple
If you require more sophisticated features, including support for programmatic use, the gitignore npm module might be a much better alternative.
While the main idea behind this tool is to KISS, it might be interesting to have it integrated into IDE's, potentially saving time for us developers. At writing time,
simplegitignore plugin for Atom and extension for Visual Studio Code have been on the market. If you like to tinker with writing software that integrates into Text Editors or IDE's in general (which is an interesting challenge on its own), you are more than welcomed to chime in and pick your favorite editor for which to write a
simplegitignore plugin. If you do create one, it'd be my honor to have it featured here on this page, too!
This tool uses the content straight from Github's Globally Useful gitignores repo. All credits go to its respective contributors.