@benjifs/gitlab-store
v0.2.0
Published
Interact with a GitLab repository using the API
Readme
GitLab Store
This project was designed to work with @benjifs/micropub but it should be usable with other projects that need to interact with the GitLab API to add, delete, and list files.
There is also a compatible version to work with a GitHub repository: @benjifs/github-store.
Install
npm install @benjifs/gitlab-store
Setup
You will need a Personal access token with the api scope to allow read-write access to the repository files.
Usage
import GitLabStore from '@benjifs/gitlab-store'
const {
GITLAB_TOKEN,
GITLAB_USER,
GITLAB_REPO,
} = process.env
const store = new GitLabStore({
token: GITLAB_TOKEN, // required
user: GITLAB_USER, // required
repo: GITLAB_REPO, // required
// branch: 'main', // default: default branch for repo
// committer: { // default: the authenticated user
// name: 'committer name',
// email: '[email protected]'
// },
})
// ...
const uploaded = await store.createFile('src/example.txt', 'this is a test')