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

glt

v1.2.3

Published

A command-line interface for GitLab tasks.

Downloads

3

Readme

glt

pipeline status coverage report npm Commitizen friendly semantic-release Renovate enabled

https://gitlab.com/nickshine/glt

A command-line interface for GitLab tasks.


Install

npm install -g glt

# or
npx glt

Usage

glt

Usage: glt [options] [command]

A cli for GitLab tasks

Options:
  -V, --version  output the version number
  -h, --help     output usage information

Commands:
  ci             perform GitLab CI tasks
  env            perform tasks on GitLab environments
  help [cmd]     display help for [cmd]

glt ci

Usage: glt-ci [options] [command]

perform GitLab CI tasks

Options:
  -h, --help  output usage information

Commands:
  cancel      cancel pipelines
  help [cmd]  display help for [cmd]

glt env

Usage: glt-env [options] [command]

perform tasks on GitLab Environments

Options:
  -h, --help  output usage information

Commands:
  clean       clean environments
  stop        stop environments
  help [cmd]  display help for [cmd]

Tasks

glt ci cancel

➜  glt ci cancel --help

Usage: glt-ci-cancel [options]

cancel pipelines

Options:
  -u, --url <url>         GitLab instance (default: '$GITLAB_URL' || 'https://gitlab.com')
  -t, --token <token>     GitLab Personal Access Token used to authenticate with the API (default: '$GITLAB_TOKEN'|| '$CI_JOB_TOKEN')
  -v, --verbose           make the operation more talkative
  -p, --project-id <id>   GitLab project id (default: '$CI_PROJECT_ID')
  -i, --pipeline-id <id>  cancel pipelines before pipeline id <id> (default: '$CI_PIPELINE_ID')
  -b, --ref <ref>         only look at pipelines on branch <ref> (default: '$CI_COMMIT_REF_NAME' || 'master')
  -h, --help              output usage information

Description: cancel any previously-running pipelines on the given branch. This task is intended to be run in a GitLab CI pipeline to reference CI_PIPELINE_ID as the currently running pipeline.

Use Case: GitLab CI currently (as of 11.x) only has the option to auto-cancel pending non-HEAD pipelines on a branch. This task is useful for controlling runner availability for redundant running pipelines on a branch.

glt env clean

Usage: glt-env-clean [options]

clean environments (delete environments with zero deployments)

Options:
  -u, --url <url>        GitLab instance (default: '$GITLAB_URL' || 'https://gitlab.com')
  -t, --token <token>    GitLab Personal Access Token used to authenticate with the API (default: '$GITLAB_TOKEN'|| '$CI_JOB_TOKEN')
  -v, --verbose          make the operation more talkative
  -p, --project-id <id>  GitLab project id (default: '$CI_PROJECT_ID')
  -h, --help             output usage information

Description: remove any existing environments that are "empty" (environments with zero deployments).

Use Case: Projects that have optional pipelines configured (with a manual play button trigger) will generate empty environments for each commit pushed that is not executed/deployed, creating lots of "empty" environments that need to be deleted.

glt env stop

Usage: glt-env-stop [options]

stop environments with deployments older than a specified age

Options:
  -u, --url <url>        GitLab instance (default: '$GITLAB_URL' || 'https://gitlab.com')
  -t, --token <token>    GitLab Personal Access Token used to authenticate with the API (default: '$GITLAB_TOKEN'|| '$CI_JOB_TOKEN')
  -v, --verbose          make the operation more talkative
  -p, --project-id <id>  GitLab project id (default: '$CI_PROJECT_ID')
  -a, --age <age>        stop environmments with deployments older than <age> (default: "1w")
  -h, --help             output usage information

Description: stop environments that only have deployments older than a specified age.

Use Case: Projects utilizing dynamic environments via the Gitlab Review Apps feature may need to control environment quotas by forcing an environment of a certain age to be stopped and cleaned up.

Examples

Cancel Redundant Pipelines From GitLab CI

In a GitLab CI pipeline, the following example will use GitLab Predefined environment variables to cancel any redundant running pipelines before executing tests. Running pipelines older than CI_PIPELINE_ID on project CI_PROJECT_ID for the the current branch CI_COMMIT_REF_NAME will be canceled using a provided Personal Access Token set on environment variable GITLAB_TOKEN.

image: node:10

stages:
  - test

variables:
  GITLAB_TOKEN: $ACCESS_TOKEN       # ACCESS_TOKEN stored in project env vars

test:
  stage: test
  script:
    - npx glt ci cancel -v
    - npm install
    - npm run test
Cancel Running Pipelines

This example cancels all running pipelines on a branch my-branch for a project at https://gitlab.com. This is run outside of a GitLab CI pipeline, using the command-line flags:


TOKEN=<personal access token>
PROJECT_ID=<project id from gitlab.com>


npm install -g glt

glt ci cancel -t $TOKEN -p $PROJECT_ID -b my-branch -v
Stop Environments Older than One Week From GitLab CI

In a GitLab CI pipeline, the following example will stop environments with no deployments younger than 1 week old on project CI_PROJECT_ID using a provided Personal Access Token set on environment variable GITLAB_TOKEN.

image: node:10

stages:
  - test

variables:
  GITLAB_TOKEN: $ACCESS_TOKEN       # ACCESS_TOKEN stored in project env vars

deploy:
  stage: deploy
  script:
    - npx glt env stop -a 1w
    - kubectl apply -f deployment.yaml

Contributing

Contributions are welcome! Help add tasks to glt! See the Contributing Guide.