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

gitlab-projects-library

v2.8.3

Published

A library to get projects and install them from Gitlab using simple-git

Downloads

161

Readme

Table of Contents

  1. Description
  2. Pre-requisites
  3. Usage
  4. Installation
  5. Contributing
  6. Tests
  7. License

Description

This project is a library that is mainly used in the context of the application SI Manager.

Its goal is to be able to list and clone information systems that are stored in a Gitlab repository in a specific group.

Pre-requisites

The library uses two environment variables to authenticate to the Gitlab API.

The following environment variables need to be set:

  • GITLAB_TOKEN_NAME: The name of the token to use to authenticate to the Gitlab API.
  • GITLAB_TOKEN_VALUE: The value of the token to use to authenticate to the Gitlab API.

You can set the environment variables in the environment when you invoke the GitlabProjectsManager.

Usage

The module can be used like the following :

import { GitlabProjectsManager } from "gitlab-projects-library";

const credentials = {
  tokenName: "GITLAB_TOKEN_NAME",
  tokenValue: "GITLAB_TOKEN_VALUE",
};

const manager = new GitlabProjectsManager({
  outputDir: "projects",
  tokenName: credentials.tokenName,
  tokenValue: credentials.tokenValue,
});

And then use one of the methods of the class:

// List projects
const listResult = await manager.listProjects({
  "https://forgemia.inra.fr",
  18500,
});

// Clone project
const result = await manager.cloneProject({
  httpUrl: "https://forgemia.inra.fr/anaee-dev/si_projects/si_template.git",
});

Installation

As a library

The library can be imported in a Node.js project.

"dependencies": {
    "si-projects-library": "latest"
}

As a script

The library can also be used as a script. A pre-existing command is available to run the script in the package.json file. This pre-existing command can be executed directly with the following command:

yarn run start

Contributing

The project has been developped with

  • Node lts/iron (v20.9.0)
  • Yarn 1.22.19

To use nvm to manage your node versions, you can follow the instructions here.

You can then install the version of node you need with the following command:

nvm install lts/iron

And then install yarn with the following command:

npm install -g yarn

To install the dependencies, you then need to run the following command:

yarn install

or

npm install

Tests

Tests have been written with Jest and can be found in the tests folder.

They need a .env file to be able to run them, as they will try to call the Gitlab API.

The .env file should contain the following:

GITLAB_TOKEN_NAME=GITLAB_TOKEN_NAME
GITLAB_TOKEN_VALUE=GITLAB_TOKEN_VALUE

To run the tests, you can use the following command:

yarn run test

License

This project is licensed under the MIT License - see the LICENSE file for details.