githubauthreq
Advanced tools
Comparing version 5.2.0 to 5.3.0-next.1589165323.e3575fa633ee76666a38a8112988654c6dd5a255
/** | ||
* Check whether or not sufficient github credentials were supplied | ||
* @param credentials If no credentials were passed, then the environment variables are used if they exist. | ||
* @returns `true` if valid, otherwise throws if invalid | ||
*/ | ||
export function validate( | ||
credentials = process === null || process === void 0 ? void 0 : process.env | ||
) { | ||
if ( | ||
credentials.GITHUB_ACCESS_TOKEN || | ||
(credentials.GITHUB_CLIENT_ID && credentials.GITHUB_CLIENT_SECRET) | ||
) { | ||
return true | ||
} else { | ||
throw new Error( | ||
'missing github credentials; provide `GITHUB_ACCESS_TOKEN` or a combination of `GITHUB_CLIENT_ID` and `GITHUB_CLIENT_SECRET`' | ||
) | ||
} | ||
} | ||
/** | ||
* Fetch the GitHub Auth Query String. | ||
@@ -3,0 +22,0 @@ * @param credentials If no credentials were passed, then the environment variables are used if they exist. |
'use strict' | ||
Object.defineProperty(exports, '__esModule', { value: true }) | ||
/** | ||
* Check whether or not sufficient github credentials were supplied | ||
* @param credentials If no credentials were passed, then the environment variables are used if they exist. | ||
* @returns `true` if valid, otherwise throws if invalid | ||
*/ | ||
function validate( | ||
credentials = process === null || process === void 0 ? void 0 : process.env | ||
) { | ||
if ( | ||
credentials.GITHUB_ACCESS_TOKEN || | ||
(credentials.GITHUB_CLIENT_ID && credentials.GITHUB_CLIENT_SECRET) | ||
) { | ||
return true | ||
} else { | ||
throw new Error( | ||
'missing github credentials; provide `GITHUB_ACCESS_TOKEN` or a combination of `GITHUB_CLIENT_ID` and `GITHUB_CLIENT_SECRET`' | ||
) | ||
} | ||
} | ||
exports.validate = validate | ||
/** | ||
* Fetch the GitHub Auth Query String. | ||
@@ -5,0 +25,0 @@ * @param credentials If no credentials were passed, then the environment variables are used if they exist. |
'use strict' | ||
Object.defineProperty(exports, '__esModule', { value: true }) | ||
/** | ||
* Check whether or not sufficient github credentials were supplied | ||
* @param credentials If no credentials were passed, then the environment variables are used if they exist. | ||
* @returns `true` if valid, otherwise throws if invalid | ||
*/ | ||
function validate(credentials = process?.env) { | ||
if ( | ||
credentials.GITHUB_ACCESS_TOKEN || | ||
(credentials.GITHUB_CLIENT_ID && credentials.GITHUB_CLIENT_SECRET) | ||
) { | ||
return true | ||
} else { | ||
throw new Error( | ||
'missing github credentials; provide `GITHUB_ACCESS_TOKEN` or a combination of `GITHUB_CLIENT_ID` and `GITHUB_CLIENT_SECRET`' | ||
) | ||
} | ||
} | ||
exports.validate = validate | ||
/** | ||
* Fetch the GitHub Auth Query String. | ||
@@ -5,0 +23,0 @@ * @param credentials If no credentials were passed, then the environment variables are used if they exist. |
# History | ||
## v5.3.0 2020 May 11 | ||
- Add `validate` method | ||
- Updated dependencies, [base files](https://github.com/bevry/base), and [editions](https://editions.bevry.me) using [boundation](https://github.com/bevry/boundation) | ||
## v5.2.0 2020 May 6 | ||
@@ -4,0 +9,0 @@ |
@@ -7,3 +7,3 @@ <!-- LICENSEFILE/ --> | ||
<ul><li>Copyright © 2018+ Benjamin Lupton</li></ul> | ||
<ul><li>Copyright © 2018+ <a href="https://balupton.com">Benjamin Lupton</a></li></ul> | ||
@@ -10,0 +10,0 @@ and licensed under: |
{ | ||
"name": "githubauthreq", | ||
"version": "5.2.0", | ||
"version": "5.3.0-next.1589165323.e3575fa633ee76666a38a8112988654c6dd5a255", | ||
"description": "Authorise GitHub API requests with the appropriate environment variables", | ||
@@ -11,3 +11,2 @@ "homepage": "https://github.com/bevry/githubauthreq", | ||
"browser", | ||
"dom", | ||
"es2019", | ||
@@ -51,13 +50,16 @@ "export-default", | ||
"wishlistURL": "https://bevry.me/wishlist", | ||
"travisTLD": "com" | ||
"travisTLD": "com", | ||
"githubUsername": "bevry", | ||
"githubRepository": "githubauthreq", | ||
"githubSlug": "bevry/githubauthreq", | ||
"npmPackageName": "githubauthreq" | ||
} | ||
}, | ||
"funding": "https://bevry.me/fund", | ||
"author": "2018+ Benjamin Lupton <b@lupton.cc>", | ||
"author": "2018+ Benjamin Lupton <b@lupton.cc> (https://balupton.com)", | ||
"maintainers": [ | ||
"Benjamin Lupton <b@lupton.cc>" | ||
"Benjamin Lupton <b@lupton.cc> (https://github.com/balupton)" | ||
], | ||
"contributors": [ | ||
"Benjamin Lupton <b@lupton.cc>", | ||
"Benjamin Lupton (http://balupton.com)" | ||
"Benjamin Lupton <b@lupton.cc> (https://github.com/balupton)" | ||
], | ||
@@ -137,3 +139,3 @@ "bugs": { | ||
"devDependencies": { | ||
"@bevry/update-contributors": "^1.0.1", | ||
"@bevry/update-contributors": "^1.2.0", | ||
"@typescript-eslint/eslint-plugin": "^2.31.0", | ||
@@ -143,9 +145,9 @@ "@typescript-eslint/parser": "^2.31.0", | ||
"cross-fetch": "^3.0.4", | ||
"eslint": "^6.8.0", | ||
"eslint": "^7.0.0", | ||
"eslint-config-bevry": "^3.4.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-prettier": "^3.1.3", | ||
"kava": "^4.4.0", | ||
"kava": "^5.0.0", | ||
"prettier": "^2.0.5", | ||
"projectz": "^1.19.1", | ||
"projectz": "^2.0.0", | ||
"surge": "^0.21.3", | ||
@@ -182,4 +184,4 @@ "typedoc": "^0.17.6", | ||
"our:verify:module": "npx valid-module", | ||
"our:verify:prettier": "prettier --write .", | ||
"our:verify:typescript": "tsc --noEmit --project tsconfig.json", | ||
"our:verify:prettier": "npx prettier --write .", | ||
"our:verify:typescript": "npx tsc --noEmit --project tsconfig.json", | ||
"test": "node ./test.js" | ||
@@ -186,0 +188,0 @@ }, |
@@ -113,3 +113,3 @@ <!-- TITLE/ --> | ||
<script type="module"> | ||
import pkg from '//cdn.pika.dev/githubauthreq/^5.2.0' | ||
import pkg from '//cdn.pika.dev/githubauthreq/^5.3.0' | ||
</script> | ||
@@ -122,3 +122,3 @@ ``` | ||
<script type="module"> | ||
import pkg from '//unpkg.com/githubauthreq@^5.2.0' | ||
import pkg from '//unpkg.com/githubauthreq@^5.3.0' | ||
</script> | ||
@@ -131,3 +131,3 @@ ``` | ||
<script type="module"> | ||
import pkg from '//dev.jspm.io/githubauthreq@5.2.0' | ||
import pkg from '//dev.jspm.io/githubauthreq@5.3.0' | ||
</script> | ||
@@ -175,3 +175,3 @@ ``` | ||
<ul><li>Benjamin Lupton</li></ul> | ||
<ul><li><a href="https://balupton.com">Benjamin Lupton</a> — <a href="https://github.com/bevry/githubauthreq/commits?author=balupton" title="View the GitHub contributions of Benjamin Lupton on repository bevry/githubauthreq">view contributions</a></li></ul> | ||
@@ -196,5 +196,3 @@ <h3>Sponsors</h3> | ||
<ul><li>Benjamin Lupton</li> | ||
<li><a href="http://balupton.com">Benjamin Lupton</a> — <a href="https://github.com/bevry/githubauthreq/commits?author=balupton" title="View the GitHub contributions of Benjamin Lupton on repository bevry/githubauthreq">view contributions</a></li> | ||
<li><a href="http://github.com/apps/dependabot-preview">dependabot-preview[bot]</a> — <a href="https://github.com/bevry/githubauthreq/commits?author=dependabot-preview[bot]" title="View the GitHub contributions of dependabot-preview[bot] on repository bevry/githubauthreq">view contributions</a></li></ul> | ||
<ul><li><a href="https://balupton.com">Benjamin Lupton</a> — <a href="https://github.com/bevry/githubauthreq/commits?author=balupton" title="View the GitHub contributions of Benjamin Lupton on repository bevry/githubauthreq">view contributions</a></li></ul> | ||
@@ -212,3 +210,3 @@ <a href="https://github.com/bevry/githubauthreq/blob/master/CONTRIBUTING.md#files">Discover how you can contribute by heading on over to the <code>CONTRIBUTING.md</code> file.</a> | ||
<ul><li>Copyright © 2018+ Benjamin Lupton</li></ul> | ||
<ul><li>Copyright © 2018+ <a href="https://balupton.com">Benjamin Lupton</a></li></ul> | ||
@@ -215,0 +213,0 @@ and licensed under: |
@@ -21,3 +21,3 @@ import type { StrictUnion } from 'simplytyped' | ||
/** | ||
* Provide either `GITHUB_ACCESS_TOKEN` or a combination of `GITHUB_CLIENT_ID` and `GITHUB_CLIENT_SECRET` | ||
* Provide `GITHUB_ACCESS_TOKEN` or a combination of `GITHUB_CLIENT_ID` and `GITHUB_CLIENT_SECRET` | ||
* https://developer.github.com/v3/#authentication | ||
@@ -31,2 +31,22 @@ */ | ||
/** | ||
* Check whether or not sufficient github credentials were supplied | ||
* @param credentials If no credentials were passed, then the environment variables are used if they exist. | ||
* @returns `true` if valid, otherwise throws if invalid | ||
*/ | ||
export function validate( | ||
credentials: GitHubCredentials = process?.env as GitHubEnv | ||
) { | ||
if ( | ||
credentials.GITHUB_ACCESS_TOKEN || | ||
(credentials.GITHUB_CLIENT_ID && credentials.GITHUB_CLIENT_SECRET) | ||
) { | ||
return true | ||
} else { | ||
throw new Error( | ||
'missing github credentials; provide `GITHUB_ACCESS_TOKEN` or a combination of `GITHUB_CLIENT_ID` and `GITHUB_CLIENT_SECRET`' | ||
) | ||
} | ||
} | ||
/** | ||
* Fetch the GitHub Auth Query String. | ||
@@ -33,0 +53,0 @@ * @param credentials If no credentials were passed, then the environment variables are used if they exist. |
@@ -10,5 +10,5 @@ { | ||
"target": "ESNext", | ||
"lib": ["DOM", "DOM.Iterable"] | ||
"lib": [] | ||
}, | ||
"include": ["source"] | ||
} |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
38628
377
1
212