npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@jkga/opr

v0.2.0

Published

online profile reader

Downloads

2

Readme

OPR (Online Profile Reader)

Read your profile (json-resume) across various version control platforms such as :white_check_mark: Github :white_check_mark: Gitlab :white_check_mark: Bitbucket and more.

JavaScript Style Guide JSON RESUME

:bulb: If you are using this package for the first time, make sure you have a JSON Resume in your repository. Here is a short article to help you get started.

Installing Dependency

Installation via npm

  npm install @jkga/opr

Installation via yarn

  yarn add opr

Importing module

CommonJS

  const { Opr } = require ('opr')

ES Modules

  import { Opr } from 'opr'

Basic Usage

const { Opr } = require('./index')

// initialize Opr
const opr = new Opr({ username: 'yourUsername' })

// enable or disable debugging using the debug function
opr.debug(true)

// read profile from default platforms (github, gitlab, bitbucket)
opr.read()

// return the first successfull result in JSON format
// you can also link `getResponse` in the chain
// ex. opr.read().getResponse ()
opr.getResponse().then(res => {
  console.log(res)
}).catch(e => {
  console.log('No profile found in all servers')
})

Options

Parameters that you can use when defining your OPR

  // sample option with a new server
  const opr = new Opr({ 
    username: 'yourUsername',
    lang: 'ph',
    servers: [
      {
        name: 'github',
        url: 'https://raw.githubusercontent.com',
        head: 'master',
        repository: 'about.me' // optional
      },
    ],
  })
  // if there is no server specified, this will be the default value
  // excerpt from `./src/helpers/servers.js`
  {
    [{

      {
        name: 'github',
        url: 'https://raw.githubusercontent.com',
        head: 'HEAD'
      },
      {
        name: 'gitlab',
        url: 'https://gitlab.com',
        head: '-/raw/HEAD'
      },
      {
        name: 'bitbucket',
        url: 'https://bitbucket.com',
        head: 'raw/HEAD'
      }
    ],
    repository: 'about.me'
  }

Advanced Usage

Overriding and Writing Server Variables

:bulb: Allows to change different information for each repository

  // USAGE
  // !IMPORTANT: This will change the username for bitbucket server only.
  // Default username for github will remain unchanged
  const opr = new Opr({
    username: 'potvillage',
    default: {
      bitbucket: {
        username: 'potvillage2'
      },
    }
  })
  // SAMPLE
  {
    default: {
      github: {
        username: 'your_username',
        repository: 'your_repository'
      },
    }
  }

OPR methods in a glance

:bulb: List of available methods available

  const opr = new Opr({ ...options }) // initialize   
  opr.debug(true) // boolean: true | false   
  opr.getResponseFromRepository(repositoryName) // repositoryName: 'github' | 'bitbucket'   
  opr.getResponse () // return first successfull response
  opr.getResponses() // view responses from all servers [Promise { <pending> }]
  opr.getRawResponses() // raw response

Raw Response

  // view all raw responses from all the servers
  opr.getRawResponses()
  // SAMPLE RESPONSE
  [
    {
      name: 'github',
      url: 'https://raw.githubusercontent.com',
      head: 'master',
      repository: '',
      response: Promise { <pending> }
    },
    {
      name: 'bitbucket',
      url: 'https://bitbucket.com',
      head: 'raw/HEAD',
      response: Promise { <pending> }
    }
  ]

Individual Response

  // read result from github server
  // allowed value : github, gitlab, bitbucket
  opr.getResponseFromRepository('github').then(res => console.log(res)).catch(e => {})
  // SAMPLE RESPONSE
  // returns profile found in github server only
  {
    basics: {
      name: 'John Doe',
      label: 'Programmer',
      picture: 'https:...',
      ...
    }
  }

CLI

1.) Install via npm or yarn

  npm install @jkga/opr -g  

2.) Lookup

  // ex. opr potvillage
  opr <yourUsernameHere>

Local Testing

1.) Clone the repository

  git clone https://github.com/jkga/opr.git

2.) Go inside the directory

  cd opr

3.) Install Dependencies

  npm install

4.) Test lookup

  // ex. npm run lookup potvillage
  npm run lookup yourUsernameHere 

:bulb: You must have an existing account in github or bitbucket to make it work. For setting-up your own profile please follow this link