From 3116b365aa69a0f4040ec90f6a063c6aa753be1c Mon Sep 17 00:00:00 2001 From: Justin Dalrymple Date: Sat, 1 Feb 2020 09:11:44 +0100 Subject: [PATCH 01/25] =?UTF-8?q?chore:=20=F0=9F=A4=96=20Fixing=20codecov?= =?UTF-8?q?=20configuration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Needed to remove the '.' prefix from the config file name --- .codecov.yml | 21 --------------------- codecov.yml | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 21 deletions(-) delete mode 100644 .codecov.yml create mode 100644 codecov.yml diff --git a/.codecov.yml b/.codecov.yml deleted file mode 100644 index 0d83b0b1..00000000 --- a/.codecov.yml +++ /dev/null @@ -1,21 +0,0 @@ -codecov: - max_report_age: off - -comment: false - -coverage: - precision: 2 - round: down - status: - project: - default: - threshold: 0.2 - if_not_found: success - patch: - default: - enabled: no - if_not_found: success - changes: - default: - enabled: no - if_not_found: success diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 00000000..c919d700 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,43 @@ +codecov: + max_report_age: off + +comment: false + +coverage: + precision: 2 + round: down + status: + project: + default: off + cli: + target: 60% + flags: cli + core: + target: 60% + flags: core + browser: + target: 60% + flags: browser + node: + target: 60% + flags: node + utils: + target: 60% + flags: utils + +flags: + cli: + paths: + - packages/gitbeaker-cli/src + core: + paths: + - packages/gitbeaker-core/src + browser: + paths: + - packages/gitbeaker-browser/src + node: + paths: + - packages/gitbeaker-node/src + utils: + paths: + - packages/gitbeaker-requester-utils/src From d88f87652a3e18828646175a6a40eb95ee501a09 Mon Sep 17 00:00:00 2001 From: Justin Dalrymple Date: Sat, 1 Feb 2020 09:13:23 +0100 Subject: [PATCH 02/25] =?UTF-8?q?docs:=20=E2=9C=8F=EF=B8=8F=20Updating=20R?= =?UTF-8?q?EADME=20to=20match=20new=20functionality?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/ASSETS/header.svg | 11 +++ .github/ASSETS/logo.svg | 10 +++ .github/ASSETS/thumbnail.png | Bin 0 -> 6478 bytes README.md | 145 +++++++++++++++++++++++------------ 4 files changed, 119 insertions(+), 47 deletions(-) create mode 100644 .github/ASSETS/header.svg create mode 100644 .github/ASSETS/logo.svg create mode 100644 .github/ASSETS/thumbnail.png diff --git a/.github/ASSETS/header.svg b/.github/ASSETS/header.svg new file mode 100644 index 00000000..b7fd2339 --- /dev/null +++ b/.github/ASSETS/header.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/.github/ASSETS/logo.svg b/.github/ASSETS/logo.svg new file mode 100644 index 00000000..12b441e4 --- /dev/null +++ b/.github/ASSETS/logo.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/.github/ASSETS/thumbnail.png b/.github/ASSETS/thumbnail.png new file mode 100644 index 0000000000000000000000000000000000000000..c884d72071452b66fd77bb90130bed409cd6b3dd GIT binary patch literal 6478 zcmeHMXH-*Jw7v-~Lsu*`0d*7w1r#YlfQS@D1uPUPf*{hQcSuN(5i2kb0*;hWEC>Q3 zNDM77bV64;Nq{6&AwXz>ly`C7`~TKk@5lS`e&nom_dR!?z0dx>z4tkJYHevQCM+uq z0D#!#OC~n}0Ez(s2m&SuN=|ik?Y{Ue@Y3xN01%Pd{Xu{?nbM#T5^}@b7%1tMp93HG zJuh6l003plBJ8^Y03c1hY;xgNBxI4~_ack__wb5uOR1(i^RH1pe!nKkCwZf{AKtoj zY$CqM;&9nfzbiwQsy0nr>yN@Fqp#dvNm$3I?!A#`!H=6i7{lr<4ooXl{0Xxyesb%^ zNz1Py5Jn!o>#&U51DI>ii`LTe8NH2q*JRHYDia>kjYk{JwMoTjY>3M6P?Vl9ia}#z zBWN<>Of(;W$%7#P%s>Cz!zppVp=9&Nr8Um<-}c)L&&%%7)@QxhjPJzKL@7Je`Igch zpUiLDM963B=!D0Qm7$ol+p){|Z&Qry2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Ml952=duC7(gXjeK6pbtX| z!Jd7KoQQQ|9_Q*gD)ceGlBG1s<4`3aH}L#g&_c(}E?l!qMB8tZMt6eYb#?P5z*Td= zxMB4Tu01smzK^vG+UR(XpSxg64GQ7S0lHY=4`aGkKuXUu4|Xj&hqFYWubz^9y0uAc znR?S~SXTexH^d2RaTGk--{BTJ3|C}%wdp9zy^lg|vzw3t>&3aK)&Me2m0LwAY*E&= zgF=qug~f$mt>}Q%nr=GbVPD=>j;UAXSK4<%8D;gNi+9Hb(90ljFUB<~B1ZmO7a{v* z>t%RD>WMw)HBw7q);U7S#ZR!=4zjN%JwK#1p`{gJn9C&(xHm&Ikuv@l>|-iYh`bJy2>U^e{&T&Dly2KLSm zCzk#xTHNg|6$tVaR)}rYx|0#l7n)Z4A+4oyB~IEGDGs?$E#0mcIR3%x8Z1IErLO+n zZm4Zb?;Lt8p_ruSVNIKCkcs0QNF5!#nb`AP{h;e`K7n9_=^prX^guZ3ht68V*~^Vz z&6Tby^NhcM{g|}8yl9SQl%S*@f_otYJwXm^6oZJICcbWGsMSuuENOX=zxFKFEP1)e(%O57<~e*Sf3Q#xmplQ0L#3wV1gaxQd{f zjd;u_7lI*X$rCJzy^aC3`;!eeUQbF+|IX`Q?!73{{6@ou@rMC*lEKsR#t3|AnEG!e`uZ{4+a> StO)-70bDk +
+ gitbeaker + +
+

+ + Gitlab Pipeline Status + + + Code Climate maintainability + + + CodeCov test coverage + + + Dependency Status + + + Dev Dependency Status + + Dependabot Badge + + Semantic Release + + + Commitizen + + Prettier + + Install Size: Core + + + Install Size: Node + + + Install Size: Browser + + + Install Size: CLI + + + Licence: MIT + +

🤖 [GitLab](https://gitlab.com/gitlab-org/gitlab/) API NodeJS library with full support of all the [Gitlab API](https://gitlab.com/gitlab-org/gitlab/tree/master/doc/api) services. @@ -40,23 +70,42 @@ ```bash # Install from npm -npm install gitlab +npm install @gitbeaker/node # NodeJS default, index.es.js for esm + +npm install @gitbeaker/browser # UMD default + +npm install @gitbeaker/cli # CLI + ``` ## Getting Started -Instantiate the library using a basic token created in your [Gitlab Profile](https://docs.gitlab.com/ce/user/profile/personal_access_tokens.html) +**NodeJS** ```javascript // ES6 (>=node 10.16.0 LTS) -import { Gitlab } from 'gitlab'; // All Resources -import { Projects } from 'gitlab'; // Just the Project Resource +import { Gitlab } from '@gitbeaker/node'; // All Resources +import { Projects } from '@gitbeaker/node'; // Just the Project Resource //...etc // ES5, assuming native or polyfilled Promise is available -const { Gitlab } = require('gitlab'); +const { Gitlab } = require('@gitbeaker/node'); ``` +**Browser** + +```javascript +// ES6 (>=node 10.16.0 LTS) +import { Gitlab } from '@gitbeaker/browser'; // All Resources +import { Projects } from '@gitbeaker/browser'; // Just the Project Resource +//...etc + +// ES5, assuming native or polyfilled Promise is available +const { Gitlab } = require('@gitbeaker/browser'); +``` + +Instantiate the library using a basic token created in your [Gitlab Profile](https://docs.gitlab.com/ce/user/profile/personal_access_tokens.html) + ```javascript const api = new Gitlab({ token: 'personaltoken', @@ -65,20 +114,20 @@ const api = new Gitlab({ Available instantiating options: -| Name | Optional | Default | Description | -| -------------------- | -------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | -| `host` | Yes | `https://gitlab.com` | Gitlab Instance Host URL | -| `token` | No\* | N/A | Personal Token. Required (one of the three tokens are required) | -| `oauthToken` | No\* | N/A | OAuth Token. Required (one of the three tokens are required) | -| `jobToken` | No\* | N/A | CI Job Token. Required (one of the three tokens are required) | -| `rejectUnauthorized` | Yes | `true` | Http Certificate setting, Only applies to HTTPS hosts urls | -| `sudo` | Yes | `false` | [Sudo](https://docs.gitlab.com/ee/api/#sudo) query parameter | -| `version` | Yes | `4` | API Version ID | -| `camelize` | Yes | `false` | Camelizes all response body keys | -| `requester` | Yes | [KyRequester.ts](./src/infrastructure/KyRequester.ts) | Request Library Wrapper. Currently wraps Ky. | -| `requestTimeout` | Yes | `300000` | Request Library Timeout in ms | -| `profileToken` | Yes | N/A | [Requests Profiles Token](https://docs.gitlab.com/ee/administration/monitoring/performance/request_profiling.html) | -| `profileMode` | Yes | `execution` | [Requests Profiles Token](https://docs.gitlab.com/ee/administration/monitoring/performance/request_profiling.html) | +| Name | Optional | Default | Description | +| -------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | +| `host` | Yes | `https://gitlab.com` | Gitlab Instance Host URL | +| `token` | No\* | N/A | Personal Token. Required (one of the three tokens are required) | +| `oauthToken` | No\* | N/A | OAuth Token. Required (one of the three tokens are required) | +| `jobToken` | No\* | N/A | CI Job Token. Required (one of the three tokens are required) | +| `rejectUnauthorized` | Yes | `true` | Http Certificate setting, Only applies to HTTPS hosts urls | +| `sudo` | Yes | `false` | [Sudo](https://docs.gitlab.com/ee/api/#sudo) query parameter | +| `version` | Yes | `4` | API Version ID | +| `camelize` | Yes | `false` | Camelizes all response body keys | +| `requester` | Yes\* | For @gitbeaker/node and @gitbeaker/cli, it uses a Got based requester, for @gitbeaker/browser, it uses a ky based requester. The @gitbeaker/core package **does not** have a default and thus must be set explicitly | Request Library Wrapper | +| `requestTimeout` | Yes | `300000` | Request Library Timeout in ms | +| `profileToken` | Yes | N/A | [Requests Profiles Token](https://docs.gitlab.com/ee/administration/monitoring/performance/request_profiling.html) | +| `profileMode` | Yes | `execution` | [Requests Profiles Token](https://docs.gitlab.com/ee/administration/monitoring/performance/request_profiling.html) | ### CLI Support @@ -90,21 +139,22 @@ gitlab [service name] [method name] --arg1 --arg2 --arg3 Where `service name` is any of the supported API names, `method name` is any of the supported commands on that API service (See source for exceptions, but generally all, show, remove, update) and `--arg1...--arg3` are any of the arguments you would normally supply to the function. The names of the args should match the names in the method headers **EXCEPT** all the optional arguments whose names should match what the GitLab API docs request. -There is one small exception with the instantiating arguments, however, which must be supplied using a `gl` prefix. ie. +There is one small exception with the instantiating arguments, however, which must be supplied using a `gb` or `gl` prefix. ie. ```bash # To get all the projects -gitlab projects all --gl-token="personaltoken" +gitlab projects all --gb-token="personaltoken" # To get a project with id = 2 gitlab projects show --gl-token="personaltoken" --projectId=2 ``` -To reduce the annoyance of having to pass those configuration properties each time, it is also possible to pass the token and host information through environment variables in the form of `GITLAB_[option name]` ie: +To reduce the annoyance of having to pass those configuration properties each time, it is also possible to pass the token and host information through environment variables in the form of `GITLAB_[option name]` or `GITBEAKER_[option name]` ie: ```bash GITLAB_HOST=http://example.com GITLAB_TOKEN=personaltoken +GITBEAKER_CAMELIZE=true ``` This could be set globally or using a [.env](https://github.com/motdotla/dotenv#readme) file in the project folder. @@ -114,7 +164,7 @@ This could be set globally or using a [.env](https://github.com/motdotla/dotenv# The library is exported as `gitlab` and can be used by simply adding this script to your html file: ```html -