1.2.2 • Published 1 year ago

package-json-from-git v1.2.2

Weekly downloads
-
License
GPL-3.0
Repository
github
Last release
1 year ago

package-json-from-git

Generate package.json information from Git data. Useful for create-xxx tools.

Install

npm i package-json-from-git

Usage

import { getPackageJsonFromGit } from 'package-json-from-git';

getPackageJsonFromGit().then((data) => {
  console.log(data);
});
{
  "author": {
    "email": "i@guoyunhe.me",
    "name": "Guo Yunhe"
  },
  "bugs": {
    "url": "https://github.com/guoyunhe/package-json-from-git/issues"
  },
  "homepage": "https://github.com/guoyunhe/package-json-from-git#readme",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/guoyunhe/package-json-from-git.git"
  },
  "funding": "https://github.com/sponsors/guoyunhe"
}

By default, the function read process.cwd(), if your git repo is in other position, use:

import { getPackageJsonFromGit } from 'package-json-from-git';

getPackageJsonFromGit('path/to/git/repo').then((data) => {
  console.log(data);
});