Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More work on danger init #436

Merged
merged 4 commits into from
Dec 7, 2017
Merged

More work on danger init #436

merged 4 commits into from
Dec 7, 2017

Conversation

orta
Copy link
Member

@orta orta commented Dec 6, 2017

This wraps up the feature I think. It handles the final CI integration step.

@orta orta self-assigned this Dec 6, 2017
@DangerCI
Copy link

DangerCI commented Dec 6, 2017

New dependencies added: parse-git-config and parse-github-url.

parse-git-config

Author: Jon Schlinkert

Description: Parse `.git/config` into a JavaScript object. sync or async.

Homepage: https://github.com/jonschlinkert/parse-git-config

Createdalmost 3 years ago
Last Updated12 months ago
LicenseMIT
Maintainers1
Releases14
Direct Dependenciesextend-shallow, fs-exists-sync, git-config-path and ini
Keywordsconfig, git and parse
README

parse-git-config NPM version NPM monthly downloads NPM total downloads Linux Build Status

Parse .git/config into a JavaScript object. sync or async.

Install

Install with npm:

$ npm install --save parse-git-config

Usage

var parse = require('parse-git-config');

// sync
var config = parse.sync();

// or async
parse(function (err, config) {
  // do stuff with err/config
});

Custom path and/or cwd

parse.sync({cwd: 'foo', path: '.git/config'});

// async
parse({cwd: 'foo', path: '.git/config'}, function (err, config) {
  // do stuff 
});

Example result

Config object will be something like:

{ core:
   { repositoryformatversion: '0',
     filemode: true,
     bare: false,
     logallrefupdates: true,
     ignorecase: true,
     precomposeunicode: true },
  'remote "origin"':
   { url: 'https://github.com/jonschlinkert/parse-git-config.git',
     fetch: '+refs/heads/*:refs/remotes/origin/*' },
  'branch "master"': { remote: 'origin', merge: 'refs/heads/master', ... } }

API

parse

Asynchronously parse a .git/config file. If only the callback is passed, the .git/config file relative to process.cwd() is used.

Example

parse(function(err, config) {
  if (err) throw err;
  // do stuff with config
});

Params

  • options {Object|String|Function}: Options with cwd or path, the cwd to use, or the callback function.
  • cb {Function}: callback function if the first argument is options or cwd.
  • returns {Object}

.sync

Synchronously parse a .git/config file. If no arguments are passed, the .git/config file relative to process.cwd() is used.

Example

var config = parse.sync();

Params

  • options {Object|String}: Options with cwd or path, or the cwd to use.
  • returns {Object}

.keys

Returns an object with only the properties that had ini-style keys converted to objects (example below).

Example

var config = parse.sync();
var obj = parse.keys(config);

Params

  • config {Object}: The parsed git config object.
  • returns {Object}

.keys examples

Converts ini-style keys into objects:

Example 1

var parse = require('parse-git-config');
var config = { 
  'foo "bar"': { doStuff: true },
  'foo "baz"': { doStuff: true } 
};

console.log(parse.keys(config));

Results in:

{ 
  foo: { 
    bar: { doStuff: true }, 
    baz: { doStuff: true } 
  } 
}

Example 2

var parse = require('parse-git-config');
var config = {
  'remote "origin"': { 
    url: 'https://github.com/jonschlinkert/normalize-pkg.git',
    fetch: '+refs/heads/*:refs/remotes/origin/*' 
  },
  'branch "master"': { 
    remote: 'origin', 
    merge: 'refs/heads/master' 
  },
  'branch "dev"': { 
    remote: 'origin', 
    merge: 'refs/heads/dev', 
    rebase: true 
  }
};

console.log(parse.keys(config));

Results in:

{
  remote: {
    origin: {
      url: 'https://github.com/jonschlinkert/normalize-pkg.git',
      fetch: '+refs/heads/*:refs/remotes/origin/*'
    }
  },
  branch: {
    master: {
      remote: 'origin',
      merge: 'refs/heads/master'
    },
    dev: {
      remote: 'origin',
      merge: 'refs/heads/dev',
      rebase: true
    }
  }
}

About

Related projects

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Contributors

Commits Contributor
48 jonschlinkert
1 sam3d
1 jsdnxx

Building docs

(This document was generated by verb-generate-readme (a verb generator), please don't edit the readme directly. Any changes to the readme must be made in .verb.md.)

To generate the readme and API documentation with verb:

$ npm install -g verb verb-generate-readme && verb

Running tests

Install dev dependencies:

$ npm install -d && npm test

Author

Jon Schlinkert

License

Copyright © 2016, Jon Schlinkert.
Released under the MIT license.


This file was generated by verb-generate-readme, v0.2.0, on December 14, 2016.

yarn why parse-git-config output

  • Has been hoisted to "parse-git-config"
  • This module exists because it's specified in "dependencies".
  • Disk size without dependencies: "20kB"
  • Disk size with unique dependencies: "88kB"
  • Disk size with transitive dependencies: "136kB"
  • Number of shared dependencies: 5

Generated by 🚫 dangerJS

@orta orta merged commit e7ca5f2 into master Dec 7, 2017
@orta orta deleted the init_2 branch January 28, 2018 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants