@uigstudio/gitlab-env
Version:
55 lines (43 loc) • 1.69 kB
Markdown
# Gitlab env
# Install
```
npm install @uig/gitlab-env --save-dev
```
or
```
yarn add -D @uig/gitlab-env
```
# Usage
Save gitlab Personal Access Token to `~/.glconfig` to use it in all projects.
1. Create PATH - https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html
- Needed scope: `api`, `read_api`, `read_repository`
2. Save token gitlab api url in `~/.glconfig` file
```sh
{
"token" : "<TOKEN>",
"url" : "<GITLAB_INSTANCE_URL>"
}
```
3. Edit `package.json > postinstall` script:
```json
{
"scripts": {
"postinstall": "gitlab-env -i <ID>"
}
}
```
4. Run it once
```sh
yarn postinstall
```
# Available props
| Name | Type | Default | Description |
|---------------------|-------------------------|----------------------|-----------------------------|
| `-i`, `--id` | `string` or `number` | **REQUIRED** | Gitlab project id |
| `-e`, `--env` | `string` | `local` | Enviroment |
| `-o`, `--output` | `string` | `.env.local` | Outout file |
| `-c`, `--glConfig` | `string` | `~/.glconfig` | File with gitlab auth token |
| `-t`, `--token` | `string` | `undefined` | Gitlab auth token |
| `-b`, `--blocklist` | `string` | `undefined` | Coma separated blocked keys |
| `-m`, `--mode` | `enum(replace, append)` | `replace` | Save mode |
| `-u`, `--url` | `string` | `https://gitlab.com` | Gitlab instance url |