gitignore.io
TypeScript icon, indicating that this package has built-in type declarations

0.1.6 • Public • Published

gitignore.io

A Javascript SDK for https://gitignore.io

Installation

npm install --save gitignore.io
# -or-
yarn add gitignore.io

Usage

Documentation is available here

  • Import library
const api = require('gitignore.io');
  • Get list of all available configs
    • Returns an Array of config names
api.listAll().then(list => console.log(list));

// returns
//
// [
//   '1c',                '1c-bitrix',           'a-frame',
//   'actionscript',      'ada',                 'adobe',
//   'advancedinstaller', 'adventuregamestudio', 'agda',
//   'al',                'alteraquartusii',     'altium',
//   ......
  • Fetch all available configs with metadata
    • Returns an Object of all configs
api.fetchAll().then(allConfigs => console.log(allConfigs));

// returns
//
// {
//   certificates: {
//     contents: '\n### certificates ###\n*.pem\n*.key\n*.crt\n*.priv\n',
//     name: 'certificates',
//     key: 'certificates',
//     fileName: 'certificates.gitignore'
//   },
//   vaadin: {
//     contents: '\n### Vaadin ###\n.vaadin-designer\n.designer\n',
//     name: 'Vaadin',
//     key: 'vaadin',
//     fileName: 'Vaadin.gitignore'
//   },
//   ........
  • Fetch a final config file for specified config names
    • Returns a String of config
api.fetchConfig(['node', 'code', 'linux']).then(config => console.log(config));

// returns
//
// ### Code ###
// .vscode/*
// !.vscode/settings.json
// !.vscode/tasks.json
// !.vscode/launch.json
// !.vscode/extensions.json

// ### Linux ###
// *~

// # temporary files which can be created if a process still has a handle open of a deleted file
// .fuse_hidden*

TODO

  • [ ] Proper error handling
  • [x] Rewrite to Typescript
  • [x] Add typings
  • [x] Add browser support
  • [x] Publish to npm
  • [ ] Add CLI

Readme

Keywords

none

Package Sidebar

Install

npm i gitignore.io

Weekly Downloads

5

Version

0.1.6

License

MIT

Unpacked Size

15.5 kB

Total Files

5

Last publish

Collaborators

  • stefanjarina