1.0.1 • Published 2 years ago
gla v1.0.1
GitLab-API
ℹ️ ALPHA RELEASE AHEAD, works in progress ⏳
Some useful API for gitlab. Create, delete and list all ( owned ) projects. Javascript ESM module.
ℹ️ Javascript ESM module.
Index of Contents
Installation
- Install it as a global package.
npm i -g gla
- Install it as a devDependency module for your project.
npm i -D gla
- Install it as a dependency module for your project.
npm i gla
ℹ️ Saving the access token to global config file, will turn off the use of the
token
flag for both, shell and module.
ℹ️ It makes a folder in the home directory/HOME_DIR/.gla
, and it saves the fileconfig.json
inside it.
Shell Usage
Create a project with shell
gla create PROJECT_NAME visibility public token YOUR_ACCESS_TOKEN
Delete a project with shell
gla delete PROJECT_ID token YOUR_ACCESS_TOKEN
List all projects with shell
gla get projects token YOUR_ACCESS_TOKEN
Save access token to global config file with shell
gla config global token YOUR_ACCESS_TOKEN
Functions & Examples
Create a project
import { gla } from 'gla'
const response = await gla(
[ 'create', 'test', 'visibility', 'public', 'token', 'YOUR_ACCESS_TOKEN' ],
true // silence the std output when using gla as a devDependency|dependency in your project
)
console.log(response)
Delete a project
import { gla } from 'gla'
const response = gla(
[ 'delete', 'PROJECT_ID', 'token', 'YOUR_ACCESS_TOKEN' ],
true // silence the std output when using gla as a devDependency|dependency in your project
)
console.log(response)
List all projects
import { gla } from 'gla'
const response = gla(
[ 'get', 'projects', 'token', 'YOUR_ACCESS_TOKEN' ],
true // silence the std output when using gla as a devDependency|dependency in your project
)
console.log(response)
/**
* It returns an object with these values
* {
* 'PROJECT_ID': {
* name: 'PROJECT_NAME',
* description: 'PROJECT_DESCRIPTION'
* },
* }
*/
Save access token to global config file
import { gla } from 'gla'
const response = gla(
[ 'config', 'global', 'token', 'YOUR_ACCESS_TOKEN' ],
true // silence the std output when using gla as a devDependency|dependency in your project
)
console.log(response)