Skip to content

Commit

Permalink
[docs] Switch to cross-fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Feb 10, 2020
1 parent 3f823dc commit f0cd898
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 11 deletions.
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"clsx": "^1.0.2",
"core-js": "^2.6.11",
"cross-env": "^7.0.0",
"cross-fetch": "^3.0.4",
"css-loader": "^3.1.0",
"css-mediaquery": "^0.1.2",
"date-fns": "2.9.0",
Expand All @@ -73,7 +74,6 @@
"final-form": "^4.18.5",
"flexsearch": "^0.6.30",
"fs-extra": "^8.1.0",
"isomorphic-fetch": "^2.2.1",
"json2mq": "^0.2.0",
"jss": "^10.0.3",
"jss-plugin-template": "^10.0.3",
Expand Down
6 changes: 4 additions & 2 deletions docs/pages/versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import orderBy from 'lodash/orderBy';
import sortedUniqBy from 'lodash/sortedUniqBy';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';
import fetch from 'cross-fetch';

const req = require.context('docs/src/pages/versions', false, /\.(md|js|tsx)$/);
const reqSource = require.context('!raw-loader!../src/pages/versions', false, /\.(js|tsx)$/);
Expand All @@ -12,12 +13,13 @@ export default function Page() {
}

async function getBranches() {
const githubAuthorizationToken = process.env.GITHUB_AUTH || '';

const result = await fetch('https://api.github.com/repos/mui-org/material-ui-docs/branches', {
headers: {
Authorization: `Basic ${Buffer.from(process.env.GITHUB_AUTH).toString('base64')}`,
Authorization: `Basic ${Buffer.from(githubAuthorizationToken).toString('base64')}`,
},
});
// console.log('headers', result.headers);
const branches = await result.json();
return branches;
}
Expand Down
2 changes: 1 addition & 1 deletion docs/scripts/updateIconSynonyms.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-console */
import 'isomorphic-fetch';
import fetch from 'cross-fetch';
import fse from 'fs-extra';
import path from 'path';
import synonyms from 'docs/src/pages/components/material-icons/synonyms';
Expand Down
2 changes: 1 addition & 1 deletion docs/src/modules/components/Notifications.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable react/no-danger, react-hooks/exhaustive-deps */
import 'isomorphic-fetch';
import fetch from 'cross-fetch';
import React from 'react';
import { useSelector } from 'react-redux';
import Button from '@material-ui/core/Button';
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/autocomplete/Asynchronous.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// *https://www.registers.service.gov.uk/registers/country/use-the-api*
import 'isomorphic-fetch';
import fetch from 'cross-fetch';
import React from 'react';
import TextField from '@material-ui/core/TextField';
import Autocomplete from '@material-ui/lab/Autocomplete';
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/autocomplete/Asynchronous.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// *https://www.registers.service.gov.uk/registers/country/use-the-api*
import 'isomorphic-fetch';
import 'cross-fetch';
import React from 'react';
import TextField from '@material-ui/core/TextField';
import Autocomplete from '@material-ui/lab/Autocomplete';
Expand Down
2 changes: 1 addition & 1 deletion packages/material-ui-icons/scripts/download.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-console */
import 'isomorphic-fetch';
import fetch from 'cross-fetch';
import fse from 'fs-extra';
import path from 'path';
import yargs from 'yargs';
Expand Down
14 changes: 11 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5040,6 +5040,14 @@ cross-env@^7.0.0:
dependencies:
cross-spawn "^7.0.1"

cross-fetch@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.0.4.tgz#7bef7020207e684a7638ef5f2f698e24d9eb283c"
integrity sha512-MSHgpjQqgbT/94D4CyADeNoYh52zMkCX4pcJvPP5WqPsLFMKjr2TCMg381ox5qI0ii2dPwaLx/00477knXqXVw==
dependencies:
node-fetch "2.6.0"
whatwg-fetch "3.0.0"

cross-spawn-async@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/cross-spawn-async/-/cross-spawn-async-1.0.1.tgz#bb525c1e420d9942552e04791a3eb2d9887a105f"
Expand Down Expand Up @@ -8690,7 +8698,7 @@ isobject@^4.0.0:
resolved "https://registry.yarnpkg.com/isobject/-/isobject-4.0.0.tgz#3f1c9155e73b192022a80819bacd0343711697b0"
integrity sha512-S/2fF5wH8SJA/kmwr6HYhK/RI/OkhD84k8ntalo0iJjZikgq1XFvR5M8NPT1x5F7fBwCG3qHfnzeP/Vh/ZxCUA==

isomorphic-fetch@^2.1.1, isomorphic-fetch@^2.2.1:
isomorphic-fetch@^2.1.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9"
integrity sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk=
Expand Down Expand Up @@ -10568,7 +10576,7 @@ node-fetch@2.3.0:
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.3.0.tgz#1a1d940bbfb916a1d3e0219f037e89e71f8c5fa5"
integrity sha512-MOd8pV3fxENbryESLgVIeaGKrdl+uaYhCSSVkjeOb/31/njTpcis5aWfdqgNlHIrKOLRbMnfPINPOML2CIFeXA==

"node-fetch@^ 2.6.0", node-fetch@^2.3.0, node-fetch@^2.5.0, node-fetch@^2.6.0:
node-fetch@2.6.0, "node-fetch@^ 2.6.0", node-fetch@^2.3.0, node-fetch@^2.5.0, node-fetch@^2.6.0:
version "2.6.0"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd"
integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==
Expand Down Expand Up @@ -15458,7 +15466,7 @@ whatwg-encoding@^1.0.5:
dependencies:
iconv-lite "0.4.24"

whatwg-fetch@>=0.10.0:
whatwg-fetch@3.0.0, whatwg-fetch@>=0.10.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz#fc804e458cc460009b1a2b966bc8817d2578aefb"
integrity sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q==
Expand Down

0 comments on commit f0cd898

Please sign in to comment.