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 🙏

© 2026 – Pkg Stats / Ryan Hefner

ganjiang-gitlab-test

v1.0.0

Published

ganjiang gitlab test

Readme

Ganjiang-GitLab

Debug the output

set the DEBUG = gitlab:* by export DEBUG = gitlab:*, ganjiang will log out debug info

create gitlab client

  const GitLab = require('ganjiang-gitlab')
  const gitlab = new GitLab({
    host: '127.0.0.1', // gitlab host
    token: 'xxxxx', // access token
    version: 'v3',
    groupId: 123456 //usually a number
  })

Get all projects in group

parameters

  • archived (optional) - if passed, limit by archived status
  • order_by (optional) - Return requests ordered by id, name, path, created_at, updated_at or last_activity_at fields. Default is created_at
  • sort (optional) - Return requests sorted in asc or desc order. Default is desc
  • search (optional) - Return list of authorized projects according to a search criteria
  • ci_enabled_first - Return projects ordered by ci_enabled flag. Projects with enabled GitLab CI go first
  const projects = await gitlab.getAllProjects() //must set groudId in gitlab client
  console.log(projects) // show the following data

Get projects

parameters

  • id (required) - The ID or NAMESPACE/PROJECT_NAME of a project, id usually a number
  const projects = await gitlab.getProjects({id: 123})
  console.log(projects) // show the following data

Create project

parameters

  • name (required) - new project name
  • path (optional) - custom repository name for new project. By default generated based on name
  • namespace_id (optional) - namespace for the new project (defaults to user)
  • description (optional) - short project description
  • issues_enabled (optional)
  • merge_requests_enabled (optional)
  • builds_enabled (optional)
  • wiki_enabled (optional)
  • snippets_enabled (optional)
  • public (optional) - if true same as setting visibility_level = 20
  • visibility_level (optional)
  • import_url (optional)
  const projects = await gitlab.createProjects({name: 'new project'})
  console.log(projects) // show the following data

Edit project

parameters

  • id (required) - The ID of a project
  • name (optional) - project name
  • path (optional) - custom repository name for new project. By default generated based on name
  • description (optional) - short project description
  • default_branch (optional)
  • issues_enabled (optional)
  • merge_requests_enabled (optional)
  • builds_enabled (optional)
  • wiki_enabled (optional)
  • snippets_enabled (optional)
  • public (optional) - if true same as setting visibility_level = 20
  • visibility_level (optional)
  const projects = await gitlab.editProjects({id: 123})
  console.log(projects) // show the following data

delete project

parameters

  • id (required) - The ID of a project
  const projects = await gitlab.deleteProjects({id: 123})
  console.log(projects) // show the following data

get File

parameters

  • projectId (required) - The ID of a project
  • file_path (required) - Full path to new file. Ex. lib/class.js
  • ref (required) - The name of branch, tag or commit
  const data = await gitlab.getFile({
    projectId: 123, 
    file_path: 'app/test1.js', 
    ref: 'master',
  })
  console.log(data) // show the following data, data.content should be base64 decode

create File

parameters

  • projectId (required) - The ID of a project
  • file_path (required) - Full path to new file. Ex. lib/class.js
  • branch_name (required) - The name of branch
  • encoding (optional) - 'text' or 'base64'. Text is default.
  • content (required) - File content
  • commit_message (required) - Commit message
  const data = await gitlab.createFile({
    projectId: 123, 
    file_path: 'app/test1.js', 
    branch_name: 'master',
    content:`const test = 'This is another test file!'`,
    commit_message: 'create file'
  })
  console.log(data) // show the following data

update File

parameters

  • projectId (required) - The ID of a project
  • file_path (required) - Full path to new file. Ex. lib/class.js
  • branch_name (required) - The name of branch
  • encoding (optional) - 'text' or 'base64'. Text is default.
  • content (required) - File content
  • commit_message (required) - Commit message
  const data = await gitlab.updateFile({
    projectId: 123, 
    file_path: 'app/test1.js', 
    branch_name: 'master',
    content:`const test = 'This is another test file!'`,
    commit_message: 'update file'
  })
  console.log(data) // show the following data

delete File

parameters

  • projectId (required) - The ID of a project
  • file_path (required) - Full path to new file. Ex. lib/class.js
  • branch_name (required) - The name of branch
  • commit_message (required) - Commit message
  const data = await gitlab.deleteFile({
    projectId: 123, 
    file_path: 'app/test1.js', 
    branch_name: 'master',
    commit_message: 'delete file'
  })
  console.log(data) // show the following data, data.content should be base64 decode

Run Tests

  • set your access token in test folder utils.js, and run
npm test