Bump actions/github to 2.2.0 to support GHES (#72)

* Bumping actions/github to 2.2.0

* Husky commit correct node modules
This commit is contained in:
PJ Quirk
2020-05-15 09:52:23 -04:00
committed by GitHub
parent 04aa5dbc72
commit c5c9bd0f54
7791 changed files with 2209804 additions and 49075 deletions

View File

@@ -3,7 +3,7 @@
> Send parameterized requests to GitHubs APIs with sensible defaults in browsers and Node
[![@latest](https://img.shields.io/npm/v/@octokit/request.svg)](https://www.npmjs.com/package/@octokit/request)
[![Build Status](https://travis-ci.org/octokit/request.js.svg?branch=master)](https://travis-ci.org/octokit/request.js)
[![Build Status](https://github.com/octokit/request.js/workflows/Test/badge.svg)](https://github.com/octokit/request.js/actions?query=workflow%3ATest)
[![Greenkeeper](https://badges.greenkeeper.io/octokit/request.js.svg)](https://greenkeeper.io/)
`@octokit/request` is a request library for browsers & node that makes it easier
@@ -23,6 +23,7 @@ the passed options and sends the request using [fetch](https://developer.mozilla
- [REST API example](#rest-api-example)
- [GraphQL example](#graphql-example)
- [Alternative: pass `method` & `url` as part of options](#alternative-pass-method--url-as-part-of-options)
- [Authentication](#authentication)
- [request()](#request)
- [`request.defaults()`](#requestdefaults)
- [`request.endpoint`](#requestendpoint)
@@ -40,15 +41,19 @@ the passed options and sends the request using [fetch](https://developer.mozilla
```js
request("POST /repos/:owner/:repo/issues/:number/labels", {
mediaType: {
previews: ["symmetra"]
previews: ["symmetra"],
},
owner: "ocotkit",
owner: "octokit",
repo: "request.js",
number: 1,
labels: ["🐛 bug"]
labels: ["🐛 bug"],
});
```
👶 [Small bundle size](https://bundlephobia.com/result?p=@octokit/request@5.0.3) (\<4kb minified + gzipped)
😎 [Authenticate](#authentication) with any of [GitHubs Authentication Strategies](https://github.com/octokit/auth.js).
👍 Sensible defaults
- `baseUrl`: `https://api.github.com`
@@ -59,8 +64,6 @@ request("POST /repos/:owner/:repo/issues/:number/labels", {
🧐 Simple to debug: Sets `error.request` to request options causing the error (with redacted credentials).
👶 Small bundle size (\<5kb minified + gzipped)
## Usage
<table>
@@ -99,10 +102,10 @@ const { request } = require("@octokit/request");
// https://developer.github.com/v3/repos/#list-organization-repositories
const result = await request("GET /orgs/:org/repos", {
headers: {
authorization: "token 0000000000000000000000000000000000000001"
authorization: "token 0000000000000000000000000000000000000001",
},
org: "octokit",
type: "private"
type: "private",
});
console.log(`${result.data.length} repos found.`);
@@ -110,10 +113,12 @@ console.log(`${result.data.length} repos found.`);
### GraphQL example
For GraphQL request we recommend using [`@octokit/graphql`](https://github.com/octokit/graphql.js#readme)
```js
const result = await request("POST /graphql", {
headers: {
authorization: "token 0000000000000000000000000000000000000001"
authorization: "token 0000000000000000000000000000000000000001",
},
query: `query ($login: String!) {
organization(login: $login) {
@@ -123,8 +128,8 @@ const result = await request("POST /graphql", {
}
}`,
variables: {
login: "octokit"
}
login: "octokit",
},
});
```
@@ -137,10 +142,49 @@ const result = await request({
method: "GET",
url: "/orgs/:org/repos",
headers: {
authorization: "token 0000000000000000000000000000000000000001"
authorization: "token 0000000000000000000000000000000000000001",
},
org: "octokit",
type: "private"
type: "private",
});
```
## Authentication
The simplest way to authenticate a request is to set the `Authorization` header directly, e.g. to a [personal access token](https://github.com/settings/tokens/).
```js
const requestWithAuth = request.defaults({
headers: {
authorization: "token 0000000000000000000000000000000000000001",
},
});
const result = await request("GET /user");
```
For more complex authentication strategies such as GitHub Apps or Basic, we recommend the according authentication library exported by [`@octokit/auth`](https://github.com/octokit/auth.js).
```js
const { createAppAuth } = require("@octokit/auth-app");
const auth = createAppAuth({
id: process.env.APP_ID,
privateKey: process.env.PRIVATE_KEY,
installationId: 123,
});
const requestWithAuth = request.defaults({
request: {
hook: auth.hook,
},
mediaType: {
previews: ["machine-man"],
},
});
const { data: app } = await requestWithAuth("GET /app");
const { data: app } = await requestWithAuth("POST /repos/:owner/:repo/issues", {
owner: "octocat",
repo: "hello-world",
title: "Hello from the engine room",
});
```
@@ -372,10 +416,10 @@ const myrequest = require("@octokit/request").defaults({
baseUrl: "https://github-enterprise.acme-inc.com/api/v3",
headers: {
"user-agent": "myApp/1.2.3",
authorization: `token 0000000000000000000000000000000000000001`
authorization: `token 0000000000000000000000000000000000000001`,
},
org: "my-project",
per_page: 100
per_page: 100,
});
myrequest(`GET /orgs/:org/repos`);
@@ -387,14 +431,14 @@ You can call `.defaults()` again on the returned method, the defaults will casca
const myProjectRequest = request.defaults({
baseUrl: "https://github-enterprise.acme-inc.com/api/v3",
headers: {
"user-agent": "myApp/1.2.3"
"user-agent": "myApp/1.2.3",
},
org: "my-project"
org: "my-project",
});
const myProjectRequestWithAuth = myProjectRequest.defaults({
headers: {
authorization: `token 0000000000000000000000000000000000000001`
}
authorization: `token 0000000000000000000000000000000000000001`,
},
});
```
@@ -409,7 +453,7 @@ See https://github.com/octokit/endpoint.js. Example
```js
const options = request.endpoint("GET /orgs/:org/repos", {
org: "my-project",
type: "private"
type: "private",
});
// {
@@ -425,10 +469,10 @@ const options = request.endpoint("GET /orgs/:org/repos", {
All of the [`@octokit/endpoint`](https://github.com/octokit/endpoint.js) API can be used:
- [`ocotkitRequest.endpoint()`](#endpoint)
- [`ocotkitRequest.endpoint.defaults()`](#endpointdefaults)
- [`ocotkitRequest.endpoint.merge()`](#endpointdefaults)
- [`ocotkitRequest.endpoint.parse()`](#endpointmerge)
- [`octokitRequest.endpoint()`](#endpoint)
- [`octokitRequest.endpoint.defaults()`](#endpointdefaults)
- [`octokitRequest.endpoint.merge()`](#endpointdefaults)
- [`octokitRequest.endpoint.parse()`](#endpointmerge)
## Special cases
@@ -443,8 +487,8 @@ const response = await request("POST /markdown/raw", {
data: "Hello world github/linguist#1 **cool**, and #1!",
headers: {
accept: "text/html;charset=utf-8",
"content-type": "text/plain"
}
"content-type": "text/plain",
},
});
// Request is sent as
@@ -483,9 +527,9 @@ request(
headers: {
"content-type": "text/plain",
"content-length": 14,
authorization: `token 0000000000000000000000000000000000000001`
authorization: `token 0000000000000000000000000000000000000001`,
},
data: "Hello, world!"
data: "Hello, world!",
}
);
```

View File

@@ -5,12 +5,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var endpoint = require('@octokit/endpoint');
var getUserAgent = _interopDefault(require('universal-user-agent'));
var universalUserAgent = require('universal-user-agent');
var isPlainObject = _interopDefault(require('is-plain-object'));
var nodeFetch = _interopDefault(require('node-fetch'));
var requestError = require('@octokit/request-error');
const VERSION = "0.0.0-development";
const VERSION = "5.4.2";
function getBufferResponse(response) {
return response.arrayBuffer();
@@ -40,7 +40,7 @@ function fetchWrapper(requestOptions) {
if (status === 204 || status === 205) {
return;
} // GitHub API returns 200 for HEAD requsets
} // GitHub API returns 200 for HEAD requests
if (requestOptions.method === "HEAD") {
@@ -69,7 +69,11 @@ function fetchWrapper(requestOptions) {
});
try {
Object.assign(error, JSON.parse(error.message));
let responseBody = JSON.parse(error.message);
Object.assign(error, responseBody);
let errors = responseBody.errors; // Assumption `errors` would always be in Array format
error.message = error.message + ": " + errors.map(JSON.stringify).join(", ");
} catch (e) {// ignore, see octokit/rest.js#684
}
@@ -136,8 +140,9 @@ function withDefaults(oldEndpoint, newDefaults) {
const request = withDefaults(endpoint.endpoint, {
headers: {
"user-agent": `octokit-request.js/${VERSION} ${getUserAgent()}`
"user-agent": `octokit-request.js/${VERSION} ${universalUserAgent.getUserAgent()}`
}
});
exports.request = request;
//# sourceMappingURL=index.js.map

1
node_modules/@octokit/request/dist-node/index.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -15,9 +15,9 @@ export default function fetchWrapper(requestOptions) {
method: requestOptions.method,
body: requestOptions.body,
headers: requestOptions.headers,
redirect: requestOptions.redirect
redirect: requestOptions.redirect,
}, requestOptions.request))
.then(response => {
.then((response) => {
url = response.url;
status = response.status;
for (const keyAndValue of response.headers) {
@@ -26,32 +26,37 @@ export default function fetchWrapper(requestOptions) {
if (status === 204 || status === 205) {
return;
}
// GitHub API returns 200 for HEAD requsets
// GitHub API returns 200 for HEAD requests
if (requestOptions.method === "HEAD") {
if (status < 400) {
return;
}
throw new RequestError(response.statusText, status, {
headers,
request: requestOptions
request: requestOptions,
});
}
if (status === 304) {
throw new RequestError("Not modified", status, {
headers,
request: requestOptions
request: requestOptions,
});
}
if (status >= 400) {
return response
.text()
.then(message => {
.then((message) => {
const error = new RequestError(message, status, {
headers,
request: requestOptions
request: requestOptions,
});
try {
Object.assign(error, JSON.parse(error.message));
let responseBody = JSON.parse(error.message);
Object.assign(error, responseBody);
let errors = responseBody.errors;
// Assumption `errors` would always be in Array format
error.message =
error.message + ": " + errors.map(JSON.stringify).join(", ");
}
catch (e) {
// ignore, see octokit/rest.js#684
@@ -68,21 +73,21 @@ export default function fetchWrapper(requestOptions) {
}
return getBuffer(response);
})
.then(data => {
.then((data) => {
return {
status,
url,
headers,
data
data,
};
})
.catch(error => {
.catch((error) => {
if (error instanceof RequestError) {
throw error;
}
throw new RequestError(error.message, 500, {
headers,
request: requestOptions
request: requestOptions,
});
});
}

View File

@@ -1,9 +1,9 @@
import { endpoint } from "@octokit/endpoint";
import getUserAgent from "universal-user-agent";
import { getUserAgent } from "universal-user-agent";
import { VERSION } from "./version";
import withDefaults from "./with-defaults";
export const request = withDefaults(endpoint, {
headers: {
"user-agent": `octokit-request.js/${VERSION} ${getUserAgent()}`
}
"user-agent": `octokit-request.js/${VERSION} ${getUserAgent()}`,
},
});

View File

View File

@@ -1 +1 @@
export const VERSION = "0.0.0-development";
export const VERSION = "5.4.2";

View File

@@ -11,12 +11,12 @@ export default function withDefaults(oldEndpoint, newDefaults) {
};
Object.assign(request, {
endpoint,
defaults: withDefaults.bind(null, endpoint)
defaults: withDefaults.bind(null, endpoint),
});
return endpointOptions.request.hook(request, endpointOptions);
};
return Object.assign(newApi, {
endpoint,
defaults: withDefaults.bind(null, endpoint)
defaults: withDefaults.bind(null, endpoint),
});
}

View File

@@ -1,5 +1,5 @@
import { endpoint } from "./types";
export default function fetchWrapper(requestOptions: ReturnType<endpoint> & {
import { EndpointInterface } from "@octokit/types";
export default function fetchWrapper(requestOptions: ReturnType<EndpointInterface> & {
redirect?: string;
}): Promise<{
status: number;

View File

@@ -1 +1 @@
export declare const request: import("./types").request;
export declare const request: import("@octokit/types").RequestInterface<object>;

View File

@@ -1,152 +0,0 @@
/// <reference types="node" />
import { Agent } from "http";
import { endpoint } from "@octokit/endpoint";
export interface request {
/**
* Sends a request based on endpoint options
*
* @param {object} endpoint Must set `method` and `url`. Plus URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
*/
<T = any>(options: Endpoint): Promise<OctokitResponse<T>>;
/**
* Sends a request based on endpoint options
*
* @param {string} route Request method + URL. Example: `'GET /orgs/:org'`
* @param {object} [parameters] URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
*/
<T = any>(route: Route, parameters?: Parameters): Promise<OctokitResponse<T>>;
/**
* Returns a new `endpoint` with updated route and parameters
*/
defaults: (newDefaults: Parameters) => request;
/**
* Octokit endpoint API, see {@link https://github.com/octokit/endpoint.js|@octokit/endpoint}
*/
endpoint: typeof endpoint;
}
export declare type endpoint = typeof endpoint;
/**
* Request method + URL. Example: `'GET /orgs/:org'`
*/
export declare type Route = string;
/**
* Relative or absolute URL. Examples: `'/orgs/:org'`, `https://example.com/foo/bar`
*/
export declare type Url = string;
/**
* Request method
*/
export declare type Method = "DELETE" | "GET" | "HEAD" | "PATCH" | "POST" | "PUT";
/**
* Endpoint parameters
*/
export declare type Parameters = {
/**
* Base URL to be used when a relative URL is passed, such as `/orgs/:org`.
* If `baseUrl` is `https://enterprise.acme-inc.com/api/v3`, then the request
* will be sent to `https://enterprise.acme-inc.com/api/v3/orgs/:org`.
*/
baseUrl?: string;
/**
* HTTP headers. Use lowercase keys.
*/
headers?: RequestHeaders;
/**
* Media type options, see {@link https://developer.github.com/v3/media/|GitHub Developer Guide}
*/
mediaType?: {
/**
* `json` by default. Can be `raw`, `text`, `html`, `full`, `diff`, `patch`, `sha`, `base64`. Depending on endpoint
*/
format?: string;
/**
* Custom media type names of {@link https://developer.github.com/v3/media/|API Previews} without the `-preview` suffix.
* Example for single preview: `['squirrel-girl']`.
* Example for multiple previews: `['squirrel-girl', 'mister-fantastic']`.
*/
previews?: string[];
};
/**
* Pass custom meta information for the request. The `request` object will be returned as is.
*/
request?: OctokitRequestOptions;
/**
* Any additional parameter will be passed as follows
* 1. URL parameter if `':parameter'` or `{parameter}` is part of `url`
* 2. Query parameter if `method` is `'GET'` or `'HEAD'`
* 3. Request body if `parameter` is `'data'`
* 4. JSON in the request body in the form of `body[parameter]` unless `parameter` key is `'data'`
*/
[parameter: string]: any;
};
export declare type Endpoint = Parameters & {
method: Method;
url: Url;
};
export declare type Defaults = Parameters & {
method: Method;
baseUrl: string;
headers: RequestHeaders & {
accept: string;
"user-agent": string;
};
mediaType: {
format: string;
previews: string[];
};
};
export declare type OctokitResponse<T> = {
headers: ResponseHeaders;
/**
* http response code
*/
status: number;
/**
* URL of response after all redirects
*/
url: string;
/**
* This is the data you would see in https://developer.Octokit.com/v3/
*/
data: T;
};
export declare type AnyResponse = OctokitResponse<any>;
export declare type RequestHeaders = {
/**
* Avoid setting `accept`, use `mediaFormat.{format|previews}` instead.
*/
accept?: string;
/**
* Use `authorization` to send authenticated request, remember `token ` / `bearer ` prefixes. Example: `token 1234567890abcdef1234567890abcdef12345678`
*/
authorization?: string;
/**
* `user-agent` is set do a default and can be overwritten as needed.
*/
"user-agent"?: string;
[header: string]: string | number | undefined;
};
export declare type ResponseHeaders = {
[header: string]: string;
};
export declare type Fetch = any;
export declare type Signal = any;
export declare type OctokitRequestOptions = {
/**
* Node only. Useful for custom proxy, certificate, or dns lookup.
*/
agent?: Agent;
/**
* Custom replacement for built-in fetch method. Useful for testing or request hooks.
*/
fetch?: Fetch;
/**
* Use an `AbortController` instance to cancel a request. In node you can only cancel streamed requests.
*/
signal?: Signal;
/**
* Node only. Request/response timeout in ms, it resets on redirect. 0 to disable (OS limit applies). `options.request.signal` is recommended instead.
*/
timeout?: number;
[option: string]: any;
};

View File

@@ -1 +1 @@
export declare const VERSION = "0.0.0-development";
export declare const VERSION = "5.4.2";

View File

@@ -1,2 +1,2 @@
import { request, endpoint, Parameters } from "./types";
export default function withDefaults(oldEndpoint: endpoint, newDefaults: Parameters): request;
import { EndpointInterface, RequestInterface, RequestParameters } from "@octokit/types";
export default function withDefaults(oldEndpoint: EndpointInterface, newDefaults: RequestParameters): RequestInterface;

View File

@@ -1,10 +1,10 @@
import { endpoint } from '@octokit/endpoint';
import getUserAgent from 'universal-user-agent';
import { getUserAgent } from 'universal-user-agent';
import isPlainObject from 'is-plain-object';
import nodeFetch from 'node-fetch';
import { RequestError } from '@octokit/request-error';
const VERSION = "0.0.0-development";
const VERSION = "5.4.2";
function getBufferResponse(response) {
return response.arrayBuffer();
@@ -23,9 +23,9 @@ function fetchWrapper(requestOptions) {
method: requestOptions.method,
body: requestOptions.body,
headers: requestOptions.headers,
redirect: requestOptions.redirect
redirect: requestOptions.redirect,
}, requestOptions.request))
.then(response => {
.then((response) => {
url = response.url;
status = response.status;
for (const keyAndValue of response.headers) {
@@ -34,32 +34,37 @@ function fetchWrapper(requestOptions) {
if (status === 204 || status === 205) {
return;
}
// GitHub API returns 200 for HEAD requsets
// GitHub API returns 200 for HEAD requests
if (requestOptions.method === "HEAD") {
if (status < 400) {
return;
}
throw new RequestError(response.statusText, status, {
headers,
request: requestOptions
request: requestOptions,
});
}
if (status === 304) {
throw new RequestError("Not modified", status, {
headers,
request: requestOptions
request: requestOptions,
});
}
if (status >= 400) {
return response
.text()
.then(message => {
.then((message) => {
const error = new RequestError(message, status, {
headers,
request: requestOptions
request: requestOptions,
});
try {
Object.assign(error, JSON.parse(error.message));
let responseBody = JSON.parse(error.message);
Object.assign(error, responseBody);
let errors = responseBody.errors;
// Assumption `errors` would always be in Array format
error.message =
error.message + ": " + errors.map(JSON.stringify).join(", ");
}
catch (e) {
// ignore, see octokit/rest.js#684
@@ -76,21 +81,21 @@ function fetchWrapper(requestOptions) {
}
return getBufferResponse(response);
})
.then(data => {
.then((data) => {
return {
status,
url,
headers,
data
data,
};
})
.catch(error => {
.catch((error) => {
if (error instanceof RequestError) {
throw error;
}
throw new RequestError(error.message, 500, {
headers,
request: requestOptions
request: requestOptions,
});
});
}
@@ -107,20 +112,21 @@ function withDefaults(oldEndpoint, newDefaults) {
};
Object.assign(request, {
endpoint,
defaults: withDefaults.bind(null, endpoint)
defaults: withDefaults.bind(null, endpoint),
});
return endpointOptions.request.hook(request, endpointOptions);
};
return Object.assign(newApi, {
endpoint,
defaults: withDefaults.bind(null, endpoint)
defaults: withDefaults.bind(null, endpoint),
});
}
const request = withDefaults(endpoint, {
headers: {
"user-agent": `octokit-request.js/${VERSION} ${getUserAgent()}`
}
"user-agent": `octokit-request.js/${VERSION} ${getUserAgent()}`,
},
});
export { request };
//# sourceMappingURL=index.js.map

1
node_modules/@octokit/request/dist-web/index.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -1,35 +0,0 @@
language: node_js
cache: npm
# Trigger a push build on master and greenkeeper branches + PRs build on every branches
# Avoid double build on PRs (See https://github.com/travis-ci/travis-ci/issues/1147)
branches:
only:
- master
- /^greenkeeper.*$/
stages:
- test
- name: release
if: branch = master AND type IN (push)
jobs:
include:
- stage: test
node_js: 12
script: npm run test
- node_js: 8
script: npm run test
- node_js: 10
env: Node 10 & coverage upload
script:
- npm run test
- npm run coverage:upload
- node_js: lts/*
env: browser tests
script: npm run test:browser
- stage: release
node_js: lts/*
env: semantic-release
script: npm run semantic-release

View File

@@ -1,7 +0,0 @@
# [ISC License](https://spdx.org/licenses/ISC)
Copyright (c) 2018, Gregor Martynus (https://github.com/gr2m)
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

View File

@@ -1,25 +0,0 @@
# universal-user-agent
> Get a user agent string in both browser and node
[![@latest](https://img.shields.io/npm/v/universal-user-agent.svg)](https://www.npmjs.com/package/universal-user-agent)
[![Build Status](https://travis-ci.com/gr2m/universal-user-agent.svg?branch=master)](https://travis-ci.com/gr2m/universal-user-agent)
[![Coverage Status](https://coveralls.io/repos/github/gr2m/universal-user-agent/badge.svg)](https://coveralls.io/github/gr2m/universal-user-agent)
[![Greenkeeper](https://badges.greenkeeper.io/gr2m/universal-user-agent.svg)](https://greenkeeper.io/)
```js
const getUserAgent = require('universal-user-agent')
const userAgent = getUserAgent()
// userAgent will look like this
// in browser: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:61.0) Gecko/20100101 Firefox/61.0"
// in node: Node.js/v8.9.4 (macOS High Sierra; x64)
```
## Credits
The Node implementation was originally inspired by [default-user-agent](https://www.npmjs.com/package/default-user-agent).
## License
[ISC](LICENSE.md)

View File

@@ -1,6 +0,0 @@
module.exports = getUserAgentBrowser
function getUserAgentBrowser () {
/* global navigator */
return navigator.userAgent
}

View File

@@ -1,4 +0,0 @@
{
"integrationFolder": "test",
"video": false
}

View File

@@ -1 +0,0 @@
export default function getUserAgentNode(): string;

View File

@@ -1,15 +0,0 @@
module.exports = getUserAgentNode
const osName = require('os-name')
function getUserAgentNode () {
try {
return `Node.js/${process.version.substr(1)} (${osName()}; ${process.arch})`
} catch (error) {
if (/wmic os get Caption/.test(error.message)) {
return 'Windows <version undetectable>'
}
throw error
}
}

View File

@@ -1,85 +0,0 @@
{
"_args": [
[
"universal-user-agent@3.0.0",
"C:\\Users\\damccorm\\Documents\\labeler"
]
],
"_from": "universal-user-agent@3.0.0",
"_id": "universal-user-agent@3.0.0",
"_inBundle": false,
"_integrity": "sha512-T3siHThqoj5X0benA5H0qcDnrKGXzU8TKoX15x/tQHw1hQBvIEBHjxQ2klizYsqBOO/Q+WuxoQUihadeeqDnoA==",
"_location": "/@octokit/request/universal-user-agent",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "universal-user-agent@3.0.0",
"name": "universal-user-agent",
"escapedName": "universal-user-agent",
"rawSpec": "3.0.0",
"saveSpec": null,
"fetchSpec": "3.0.0"
},
"_requiredBy": [
"/@octokit/request"
],
"_resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-3.0.0.tgz",
"_spec": "3.0.0",
"_where": "C:\\Users\\damccorm\\Documents\\labeler",
"author": {
"name": "Gregor Martynus",
"url": "https://github.com/gr2m"
},
"browser": "browser.js",
"bugs": {
"url": "https://github.com/gr2m/universal-user-agent/issues"
},
"dependencies": {
"os-name": "^3.0.0"
},
"description": "Get a user agent string in both browser and node",
"devDependencies": {
"chai": "^4.1.2",
"coveralls": "^3.0.2",
"cypress": "^3.1.0",
"mocha": "^6.0.0",
"nyc": "^14.0.0",
"proxyquire": "^2.1.0",
"semantic-release": "^15.9.15",
"sinon": "^7.2.4",
"sinon-chai": "^3.2.0",
"standard": "^13.0.1",
"test": "^0.6.0",
"travis-deploy-once": "^5.0.7"
},
"homepage": "https://github.com/gr2m/universal-user-agent#readme",
"keywords": [],
"license": "ISC",
"main": "index.js",
"name": "universal-user-agent",
"repository": {
"type": "git",
"url": "git+https://github.com/gr2m/universal-user-agent.git"
},
"scripts": {
"coverage": "nyc report --reporter=html && open coverage/index.html",
"coverage:upload": "nyc report --reporter=text-lcov | coveralls",
"pretest": "standard",
"semantic-release": "semantic-release",
"test": "nyc mocha \"test/*-test.js\"",
"test:browser": "cypress run --browser chrome",
"travis-deploy-once": "travis-deploy-once"
},
"standard": {
"globals": [
"describe",
"it",
"beforeEach",
"afterEach",
"expect"
]
},
"types": "index.d.ts",
"version": "3.0.0"
}

View File

@@ -1,57 +0,0 @@
// make tests run in both Node & Express
if (!global.cy) {
const chai = require('chai')
const sinon = require('sinon')
const sinonChai = require('sinon-chai')
chai.use(sinonChai)
global.expect = chai.expect
let sandbox
beforeEach(() => {
sandbox = sinon.createSandbox()
global.cy = {
stub: function () {
return sandbox.stub.apply(sandbox, arguments)
},
log () {
console.log.apply(console, arguments)
}
}
})
afterEach(() => {
sandbox.restore()
})
}
const getUserAgent = require('..')
describe('smoke', () => {
it('works', () => {
expect(getUserAgent()).to.be.a('string')
expect(getUserAgent().length).to.be.above(10)
})
if (!process.browser) { // test on node only
const proxyquire = require('proxyquire').noCallThru()
it('works around wmic error on Windows (#5)', () => {
const getUserAgent = proxyquire('..', {
'os-name': () => {
throw new Error('Command failed: wmic os get Caption')
}
})
expect(getUserAgent()).to.equal('Windows <version undetectable>')
})
it('does not swallow unexpected errors', () => {
const getUserAgent = proxyquire('..', {
'os-name': () => {
throw new Error('oops')
}
})
expect(getUserAgent).to.throw('oops')
})
}
})

View File

@@ -1,65 +1,64 @@
{
"_args": [
[
"@octokit/request@5.0.2",
"C:\\Users\\damccorm\\Documents\\labeler"
]
],
"_from": "@octokit/request@5.0.2",
"_id": "@octokit/request@5.0.2",
"_from": "@octokit/request@^5.3.0",
"_id": "@octokit/request@5.4.2",
"_inBundle": false,
"_integrity": "sha512-z1BQr43g4kOL4ZrIVBMHwi68Yg9VbkRUyuAgqCp1rU3vbYa69+2gIld/+gHclw15bJWQnhqqyEb7h5a5EqgZ0A==",
"_integrity": "sha512-zKdnGuQ2TQ2vFk9VU8awFT4+EYf92Z/v3OlzRaSh4RIP0H6cvW1BFPXq4XYvNez+TPQjqN+0uSkCYnMFFhcFrw==",
"_location": "/@octokit/request",
"_phantomChildren": {
"os-name": "3.1.0"
},
"_phantomChildren": {},
"_requested": {
"type": "version",
"type": "range",
"registry": true,
"raw": "@octokit/request@5.0.2",
"raw": "@octokit/request@^5.3.0",
"name": "@octokit/request",
"escapedName": "@octokit%2frequest",
"scope": "@octokit",
"rawSpec": "5.0.2",
"rawSpec": "^5.3.0",
"saveSpec": null,
"fetchSpec": "5.0.2"
"fetchSpec": "^5.3.0"
},
"_requiredBy": [
"/@octokit/graphql",
"/@octokit/rest"
],
"_resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.0.2.tgz",
"_spec": "5.0.2",
"_where": "C:\\Users\\damccorm\\Documents\\labeler",
"_resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.4.2.tgz",
"_shasum": "74f8e5bbd39dc738a1b127629791f8ad1b3193ee",
"_spec": "@octokit/request@^5.3.0",
"_where": "/Users/pjquirk/Source/GitHub/actions/labeler/node_modules/@octokit/graphql",
"bugs": {
"url": "https://github.com/octokit/request.js/issues"
},
"bundleDependencies": false,
"dependencies": {
"@octokit/endpoint": "^5.1.0",
"@octokit/request-error": "^1.0.1",
"@octokit/endpoint": "^6.0.1",
"@octokit/request-error": "^2.0.0",
"@octokit/types": "^2.11.1",
"deprecation": "^2.0.0",
"is-plain-object": "^3.0.0",
"node-fetch": "^2.3.0",
"once": "^1.4.0",
"universal-user-agent": "^3.0.0"
"universal-user-agent": "^5.0.0"
},
"deprecated": false,
"description": "Send parameterized requests to GitHubs APIs with sensible defaults in browsers and Node",
"devDependencies": {
"@pika/pack": "^0.4.0",
"@pika/plugin-build-node": "^0.5.1",
"@pika/plugin-build-web": "^0.5.1",
"@pika/plugin-ts-standard-pkg": "^0.5.1",
"@octokit/auth-app": "^2.1.2",
"@pika/pack": "^0.5.0",
"@pika/plugin-build-node": "^0.9.0",
"@pika/plugin-build-web": "^0.9.0",
"@pika/plugin-ts-standard-pkg": "^0.9.0",
"@types/fetch-mock": "^7.2.4",
"@types/jest": "^24.0.12",
"@types/node": "^12.0.3",
"@types/jest": "^25.1.0",
"@types/lolex": "^5.1.0",
"@types/node": "^13.1.0",
"@types/node-fetch": "^2.3.3",
"@types/once": "^1.4.0",
"fetch-mock": "^7.2.0",
"fetch-mock": "^9.3.1",
"jest": "^24.7.1",
"prettier": "^1.17.0",
"semantic-release": "^15.10.5",
"lolex": "^6.0.0",
"prettier": "^2.0.1",
"semantic-release": "^17.0.0",
"semantic-release-plugin-update-version-in-files": "^1.0.0",
"ts-jest": "^24.0.2",
"ts-jest": "^25.1.0",
"typescript": "^3.4.5"
},
"files": [
@@ -88,5 +87,5 @@
"sideEffects": false,
"source": "dist-src/index.js",
"types": "dist-types/index.d.ts",
"version": "5.0.2"
"version": "5.4.2"
}