From d2637cb9eae151e30d9ff5a0b8faf71edd8d7e5f Mon Sep 17 00:00:00 2001 From: Michael Jackson Date: Sat, 12 Jan 2019 20:30:15 -0800 Subject: [PATCH] Streamline home page --- docs/api.md | 140 ----------- docs/cloudflare-logo.png | Bin 9345 -> 0 bytes docs/heroku-logo.png | Bin 13448 -> 0 bytes docs/home.md | 48 ---- modules/actions/serveMainPage.js | 8 +- modules/client/main.js | 11 +- modules/client/main/About.js | 95 -------- modules/client/main/App.js | 352 ++++++++++++++++++++-------- modules/client/main/Home.js | 159 ------------- modules/client/main/Stats.js | 337 -------------------------- modules/client/main/WindowSize.js | 35 --- modules/client/main/Wrapper.js | 5 - modules/client/main/countries.json | 1 - modules/client/utils/dom.js | 15 -- modules/client/utils/parseNumber.js | 3 - package-lock.json | 94 +------- package.json | 2 - scripts/generate-countries-json.js | 12 - 18 files changed, 259 insertions(+), 1058 deletions(-) delete mode 100644 docs/api.md delete mode 100644 docs/cloudflare-logo.png delete mode 100644 docs/heroku-logo.png delete mode 100644 docs/home.md delete mode 100644 modules/client/main/About.js delete mode 100644 modules/client/main/Home.js delete mode 100644 modules/client/main/Stats.js delete mode 100644 modules/client/main/WindowSize.js delete mode 100644 modules/client/main/Wrapper.js delete mode 100644 modules/client/main/countries.json delete mode 100644 modules/client/utils/dom.js delete mode 100644 modules/client/utils/parseNumber.js delete mode 100644 scripts/generate-countries-json.js diff --git a/docs/api.md b/docs/api.md deleted file mode 100644 index 97c4c61..0000000 --- a/docs/api.md +++ /dev/null @@ -1,140 +0,0 @@ -# Authentication - -Some API methods require an authentication token. This token is a [JSON web token](https://en.wikipedia.org/wiki/JSON_Web_Token) that contains a list of "scopes" (i.e. permissions). - -Once you obtain an API token ([see below](#post-api-auth)) you simply include it in the `Authorization` header of your request as a base-64 encoded string, i.e. - -``` -Authorization: base64(token) -``` - -### GET /api/publicKey - -The [public key](https://en.wikipedia.org/wiki/Public-key_cryptography) unpkg uses to encrypt authentication tokens, as JSON. You can also find the key as plain text [on GitHub](https://github.com/unpkg/unpkg.com/blob/master/secret_key.pub). - -This can be useful to verify a token was issued by unpkg. - -Required scope: none - -Query parameters: none - -Example: - -```log -> curl "https://unpkg.com/api/publicKey" -{ - "publicKey": "..." -} -``` - -### POST /api/auth - -Creates and returns a new auth token. By default, auth tokens have the following scopes: - -```json -{ - "blacklist": { - "read": true - } -} -``` - -Required scope: none - -Body parameters: none - -Example: - -```log -> curl -X POST "https://unpkg.com/api/auth" -{ - "token": "..." -} -``` - -Please reach out to @mjackson if you need a token with additional scopes. - -### GET /api/auth - -Verifies and returns the payload contained in the given auth token. - -Required scope: none - -Query parameters: none - -Example: - -```log -> curl -H "Authorization: $BASE_64_ENCODED_TOKEN" "https://unpkg.com/api/auth" -{ - "jti": "...", - "iss": "https://unpkg.com", - "iat": ..., - "scopes": { ... } -} -``` - -# Blacklist - -To protect unpkg users and prevent abuse, unpkg manages a blacklist of npm packages that are known to contain harmful code. - -### GET /api/blacklist - -Returns a list of all packages that are currently blacklisted. - -Required scope: `blacklist.read` - -Query parameters: none - -Example: - -```log -> curl -H "Authorization: $BASE_64_ENCODED_TOKEN" "https://unpkg.com/api/blacklist" -{ - "blacklist": [ ... ] -} -``` - -### POST /api/blacklist - -Adds a package to the blacklist. - -Required scope: `blacklist.add` - -Body parameters: - -* `packageName` - The package to add to the blacklist (required) - -Example: - -```log -> curl -H "Authorization: $BASE_64_ENCODED_TOKEN" -d '{"packageName":"bad-package"}' "https://unpkg.com/api/blacklist" -{ - "ok": true -} -``` - -### DELETE /api/blacklist - -Removes a package from the blacklist. - -Required scope: `blacklist.remove` - -Body parameters: - -* `packageName` - The package to remove from the blacklist (required) - -Example: - -```log -> curl -X DELETE -H "Authorization: $BASE_64_ENCODED_TOKEN" -d '{"packageName":"bad-package"}' "https://unpkg.com/api/blacklist" -{ - "ok": true -} -``` - -# Stats - -### GET /api/stats - -TODO diff --git a/docs/cloudflare-logo.png b/docs/cloudflare-logo.png deleted file mode 100644 index 52f2820974908b9ceac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Fk@AoAQ zqtULRp6CEQ>tpThV!FAJM1jbhZ@Ex{QLzbqmnbe=ccQy+3b#t z{nnB@i2;|5l{dTmt0M5rLN45I0klHZ2oK8#0_lJ4K+zQ+)5Cc_b~8b;DX?#o{@X5( zI!$4!qt2+bv}p&6z*1bKFQTt3zMV;FmVWw87{q$5HjGS?REo#@b%gx+wExgdBLDYh zjcDGQS^vn_2w(URyk2cgR+UL)M}#*#{E4+i)^!y(z3Pa5#tR{8s6FfJ@EpIvCWx1J zfDn5gYMwzPQbb1mkEt$pOPBb?le^Kl#xW2J2#En=z84TkI3nmVRu% zr^$vWn%i4If&5IH>)WlznFAf_&jNCgrr7nsLul zHhkyL8%vkew~=4Bsb7_NTS%5{u}4*lG zdx_wpRs!n&GC`&CtA3(ieteuq)JIVN1SIvIMH7o%3-jH?{Lx(y=g;2i5$5oN4}P80hML!B02FS6KR7#X*BHK0)v=`8JDxv z3|+qvC`2+^Ay)Q`#6eI!4~X4!v~}^V0pfaks3+xK4f$AoTsyN>W{G#1Lq|BD97SGf z9Ix`L)QM#9fd7EE$204w7-kansZtZ#y0|a&F!@t17N>aVGv8RY$G!q7;WaC5A<*8! zmM$_ATc&q&)v>CAgHPEZE9}+yXjp)%nd@t&dedK82U_RVZ^yJmq^1H^HiMnC$sP(rq%dsM*`rywkHm?afVhp2xnP?5-9+E(xYdk|J HScLvR(Pg|8 diff --git a/docs/heroku-logo.png b/docs/heroku-logo.png deleted file mode 100644 index cdc5379422c5bf19e2c78293b271b15adcf704af..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13448 zcmeHtc{r3^*!VMcvKEnDicqxJmoW$-5n0Ppy|Tp+$}*TDDx#88bz3xg-6U~pfksdK13`by}Hi`Tp$ zqrcFXykso`E_!>}d0qS~BKV7!J_Mw@*@{xNxsyF!M(mxr8Fr_p`@-43uUhRFUphlvI%jRP zQt`!X^|b$V;-}%~qk#he2?%P*-!c(p{<6IViNimz``Jj$0bw~Tdm~!C| z@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2ASV^D2Ej?Q_@wv&?;7plNMAUOhFp{zkAe1=KYHTler(YmpcMP@ zh3P4v$&k0-Eh-x>+QWJlt6Pe&R=hT$9+)~n4}Na$X&bm$YskD`sL^t)0%#dxws|_5 znnaWRC>^0dg; uQ4sW6@Q)jFnC*|f`}gzz6Iphnun34PX}`VwC%iFCPYcsCCo7CSZ~Y&zunpkg.com/:package@:version/:file - -### Examples - -Using a fixed version: - - * [unpkg.com/react@16.0.0/umd/react.production.min.js](/react@16.0.0/umd/react.production.min.js) - * [unpkg.com/react-dom@16.0.0/umd/react-dom.production.min.js](/react-dom@16.0.0/umd/react-dom.production.min.js) - -You may also use a [semver range](https://docs.npmjs.com/misc/semver) or a [tag](https://docs.npmjs.com/cli/dist-tag) instead of a fixed version number, or omit the version/tag entirely to use the `latest` tag. - - * [unpkg.com/react@^16/umd/react.production.min.js](/react@^16/umd/react.production.min.js) - * [unpkg.com/react/umd/react.production.min.js](/react/umd/react.production.min.js) - -If you omit the file path (i.e. use a "bare" URL), unpkg will serve the file specified by the `unpkg` field in `package.json`, or fall back to `main`. - - * [unpkg.com/d3](/d3) - * [unpkg.com/jquery](/jquery) - * [unpkg.com/three](/three) - -Append a `/` at the end of a URL to view a listing of all the files in a package. - - * [unpkg.com/react/](/react/) - * [unpkg.com/lodash/](/lodash/) - -### Query Parameters - -
-
`?meta`
-
Return metadata about any file in a package as JSON (e.g. `/any/file?meta`)
- -
`?module`
-
Expands all ["bare" `import` specifiers](https://html.spec.whatwg.org/multipage/webappapis.html#resolve-a-module-specifier) in JavaScript modules to unpkg URLs. This feature is *very experimental*
-
- -### Workflow - -For npm package authors, unpkg relieves the burden of publishing your code to a CDN in addition to the npm registry. All you need to do is include your [UMD](https://github.com/umdjs/umd) build in your npm package (not your repo, that's different!). - -You can do this easily using the following setup: - - * Add the `umd` (or `dist`) directory to your `.gitignore` file - * Add the `umd` directory to your [files array](https://docs.npmjs.com/files/package.json#files) in `package.json` - * Use a build script to generate your UMD build in the `umd` directory when you publish - -That's it! Now when you `npm publish` you'll have a version available on unpkg as well. diff --git a/modules/actions/serveMainPage.js b/modules/actions/serveMainPage.js index b0c2ab1..f569ddd 100644 --- a/modules/actions/serveMainPage.js +++ b/modules/actions/serveMainPage.js @@ -1,6 +1,5 @@ import React from 'react'; import ReactDOMServer from 'react-dom/server'; -import { StaticRouter } from 'react-router-dom'; import MainTemplate from '../client/MainTemplate'; import MainApp from '../client/main/App'; @@ -9,12 +8,9 @@ import getEntryPoints from '../utils/getEntryPoints'; import renderTemplate from '../utils/renderTemplate'; export default function serveMainPage(req, res) { - const element = React.createElement( - StaticRouter, - { location: req.url }, - React.createElement(MainApp) + const content = createHTML( + ReactDOMServer.renderToString(React.createElement(MainApp)) ); - const content = createHTML(ReactDOMServer.renderToString(element)); const entryPoints = getEntryPoints('main', { es: 'module', diff --git a/modules/client/main.js b/modules/client/main.js index 34fcbc0..3f32a5d 100644 --- a/modules/client/main.js +++ b/modules/client/main.js @@ -1,6 +1,5 @@ import React from 'react'; import ReactDOM from 'react-dom'; -import { HashRouter } from 'react-router-dom'; import { Global, css } from '@emotion/core'; import App from './main/App'; @@ -72,11 +71,9 @@ const globalStyles = css` `; ReactDOM.render( - -
- - -
-
, +
+ + +
, document.getElementById('root') ); diff --git a/modules/client/main/About.js b/modules/client/main/About.js deleted file mode 100644 index d93aff2..0000000 --- a/modules/client/main/About.js +++ /dev/null @@ -1,95 +0,0 @@ -import React from 'react'; - -import Wrapper from './Wrapper'; - -import cloudflareLogo from './CloudflareLogo.png'; -import herokuLogo from './HerokuLogo.png'; - -const styles = { - logoList: { - margin: '2em 0', - display: 'flex', - justifyContent: 'center' - }, - logo: { - textAlign: 'center', - flex: '1', - maxWidth: '80%' - }, - logoImage: { - maxWidth: '60%' - } -}; - -function AboutLogo({ children }) { - return
{children}
; -} - -function AboutLogoImage(props) { - return ; -} - -export default function About() { - return ( - -

- unpkg is an open source project - built and maintained by{' '} - Michael Jackson. -

- -

Sponsors

-

- The fast, global infrastructure that powers unpkg is generously donated - by Cloudflare and{' '} - Heroku. -

- -
- - - - - - - - - - -
- -

Cache Behavior

-

- The CDN caches files based on their permanent URL, which includes the - npm package version. This works because npm does not allow package - authors to overwrite a package that has already been published with a - different one at the same version number. -

-

- URLs that do not specify a package version number redirect to one that - does. This is the latest version when no version is - specified, or the maxSatisfying version when a{' '} - semver version is - given. Redirects are cached for 5 minutes. -

-

- Browsers are instructed (via the Cache-Control header) to - cache assets for 1 year. -

- -

Abuse

-

- unpkg maintains a list of packages that are known to be malicious. If - you find such a package on npm, please let us know! -

- -

Support

-

- unpkg is not affiliated with or supported by npm, Inc. in any way. - Please do not contact npm for help with unpkg. Instead, please reach out - to @unpkg with any questions or - concerns. -

-
- ); -} diff --git a/modules/client/main/App.js b/modules/client/main/App.js index a5579f0..d608050 100644 --- a/modules/client/main/App.js +++ b/modules/client/main/App.js @@ -1,12 +1,14 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { Switch, Route, Link, withRouter } from 'react-router-dom'; -import { Motion, spring } from 'react-motion'; +import formatBytes from 'pretty-bytes'; +import formatDate from 'date-fns/format'; +import parseDate from 'date-fns/parse'; -import WindowSize from './WindowSize'; -import About from './About'; -import Stats from './Stats'; -import Home from './Home'; +import formatNumber from '../utils/formatNumber'; +import formatPercent from '../utils/formatPercent'; + +import cloudflareLogo from './CloudflareLogo.png'; +import herokuLogo from './HerokuLogo.png'; const styles = { title: { @@ -40,44 +42,60 @@ const styles = { backgroundColor: 'black', position: 'absolute', left: 0 + }, + example: { + textAlign: 'center', + backgroundColor: '#eee', + margin: '2em 0', + padding: '5px 0' + }, + logoList: { + margin: '2em 0', + display: 'flex', + justifyContent: 'center' + }, + logo: { + textAlign: 'center', + flex: '1', + maxWidth: '80%' + }, + logoImage: { + maxWidth: '60%' } }; -class Layout extends React.Component { - state = { - underlineLeft: 0, - underlineWidth: 0, - useSpring: false, - stats: null - }; +function AboutLogo({ children }) { + return
{children}
; +} - adjustUnderline = (useSpring = false) => { - let itemIndex; - switch (this.props.location.pathname) { - case '/stats': - itemIndex = 1; - break; - case '/about': - itemIndex = 2; - break; - case '/': - default: - itemIndex = 0; - } +function AboutLogoImage(props) { + return ; +} - const itemNodes = this.listNode.querySelectorAll('li'); - const currentNode = itemNodes[itemIndex]; +function Stats({ data }) { + const totals = data.totals; + const since = parseDate(totals.since); + const until = parseDate(totals.until); - this.setState({ - underlineLeft: currentNode.offsetLeft, - underlineWidth: currentNode.offsetWidth, - useSpring - }); - }; + return ( +

+ From {formatDate(since, 'MMM D')} to{' '} + {formatDate(until, 'MMM D')} unpkg served{' '} + {formatNumber(totals.requests.all)} requests and a total + of {formatBytes(totals.bandwidth.all)} of data to{' '} + {formatNumber(totals.uniques.all)} unique visitors,{' '} + + {formatPercent(totals.requests.cached / totals.requests.all, 0)}% + {' '} + of which were served from the cache. +

+ ); +} + +export default class App extends React.Component { + state = { stats: null }; componentDidMount() { - this.adjustUnderline(); - fetch('/api/stats?period=last-month') .then(res => res.json()) .then(stats => this.setState({ stats })); @@ -93,83 +111,217 @@ class Layout extends React.Component { } } - componentDidUpdate(prevProps) { - if (prevProps.location.pathname !== this.props.location.pathname) { - this.adjustUnderline(true); - } - } - render() { - const { underlineLeft, underlineWidth, useSpring } = this.state; - - const style = { - left: useSpring - ? spring(underlineLeft, { stiffness: 220 }) - : underlineLeft, - width: useSpring ? spring(underlineWidth) : underlineWidth - }; + const { stats } = this.state; return ( -
- +
+
+

unpkg

-
-
-

unpkg

- -
+

+ unpkg is a fast, global{' '} + + content delivery network + {' '} + for everything on npm. Use it + to quickly and easily load any file from any package using a URL + like: +

+ +
unpkg.com/:package@:version/:file
+ + {stats && } +
+ +

Examples

+ +

Using a fixed version:

+ + + +

+ You may also use a{' '} + semver range or a{' '} + tag instead of a + fixed version number, or omit the version/tag entirely to use the{' '} + latest tag. +

+ + + +

+ If you omit the file path (i.e. use a “bare” URL), unpkg + will serve the file specified by the unpkg field in{' '} + package.json, or fall back to + main. +

+ + + +

+ Append a / at the end of a URL to view a listing of all + the files in a package. +

+ + + +

Query Parameters

+ +
+
+ ?meta +
+
+ Return metadata about any file in a package as JSON (e.g. + /any/file?meta) +
+ +
+ ?module +
+
+ Expands all{' '} + + “bare” import specifiers + {' '} + in JavaScript modules to unpkg URLs. This feature is{' '} + very experimental +
+
+ +

Cache Behavior

+ +

+ The CDN caches files based on their permanent URL, which includes the + npm package version. This works because npm does not allow package + authors to overwrite a package that has already been published with a + different one at the same version number. +

+

+ URLs that do not specify a package version number redirect to one that + does. This is the latest version when no version is + specified, or the maxSatisfying version when a{' '} + semver version is + given. Redirects are cached for 5 minutes. +

+

+ Browsers are instructed (via the Cache-Control header) to + cache assets for 1 year. +

+ +

About

+ +

+ unpkg is an open source project + built and maintained by{' '} + Michael Jackson. unpkg is + not affiliated with or supported by npm, Inc. in any way. Please do + not contact npm for help with unpkg. Instead, please reach out to{' '} + @unpkg with any questions or + concerns. +

+ +

+ The fast, global infrastructure that powers unpkg is generously + donated by Cloudflare and{' '} + Heroku. +

+ +
+ + + + + + + + + +
- - } - /> - - - +

Workflow

+ +

+ For npm package authors, unpkg relieves the burden of publishing your + code to a CDN in addition to the npm registry. All you need to do is + include your UMD build in + your npm package (not your repo, that's different!). +

+ +

You can do this easily using the following setup:

+ +
    +
  • + Add the umd (or dist) directory to your{' '} + .gitignore file +
  • +
  • + Add the umd directory to your{' '} + + files array + {' '} + in + package.json +
  • +
  • + Use a build script to generate your UMD build in the{' '} + umd directory when you publish +
  • +
+ +

+ That's it! Now when you npm publish you'll have + a version available on unpkg as well. +

); } } if (process.env.NODE_ENV !== 'production') { - Layout.propTypes = { + App.propTypes = { location: PropTypes.object, children: PropTypes.node }; } - -export default withRouter(Layout); diff --git a/modules/client/main/Home.js b/modules/client/main/Home.js deleted file mode 100644 index 1917cdf..0000000 --- a/modules/client/main/Home.js +++ /dev/null @@ -1,159 +0,0 @@ -import React from 'react'; - -import Wrapper from './Wrapper'; - -const styles = { - homeExample: { - textAlign: 'center', - backgroundColor: '#eee', - margin: '2em 0', - padding: '5px 0' - } -}; - -export default function Home() { - return ( - -

- unpkg is a fast, global{' '} - - content delivery network - {' '} - for everything on npm. Use it to - quickly and easily load any file from any package using a URL like: -

- -
unpkg.com/:package@:version/:file
- -

Examples

- -

Using a fixed version:

- - - -

- You may also use a{' '} - semver range or a{' '} - tag instead of a fixed - version number, or omit the version/tag entirely to use the{' '} - latest tag. -

- - - -

- If you omit the file path (i.e. use a “bare” URL), unpkg - will serve the file specified by the unpkg field in{' '} - package.json, or fall back to - main. -

- - - -

- Append a / at the end of a URL to view a listing of all the - files in a package. -

- - - -

Query Parameters

- -
-
- ?meta -
-
- Return metadata about any file in a package as JSON (e.g. - /any/file?meta) -
- -
- ?module -
-
- Expands all{' '} - - “bare” import specifiers - - in JavaScript modules to unpkg URLs. This feature is{' '} - very experimental -
-
- -

Workflow

- -

- For npm package authors, unpkg relieves the burden of publishing your - code to a CDN in addition to the npm registry. All you need to do is - include your UMD build in - your npm package (not your repo, that's different!). -

- -

You can do this easily using the following setup:

- -
    -
  • - Add the umd (or dist) directory to your{' '} - .gitignore file -
  • -
  • - Add the umd directory to your{' '} - - files array - {' '} - in - package.json -
  • -
  • - Use a build script to generate your UMD build in the umd{' '} - directory when you publish -
  • -
- -

- That's it! Now when you npm publish you'll have a - version available on unpkg as well. -

-
- ); -} diff --git a/modules/client/main/Stats.js b/modules/client/main/Stats.js deleted file mode 100644 index fbfc6f1..0000000 --- a/modules/client/main/Stats.js +++ /dev/null @@ -1,337 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import formatBytes from 'pretty-bytes'; -import formatDate from 'date-fns/format'; -import parseDate from 'date-fns/parse'; - -import { continents, countries } from './countries.json'; - -import Wrapper from './Wrapper'; -import formatNumber from '../utils/formatNumber'; -import formatPercent from '../utils/formatPercent'; - -const styles = { - tableFilter: { - fontSize: '0.8em', - textAlign: 'right' - }, - countryName: { - paddingLeft: 20 - } -}; - -function getCountriesByContinent(continent) { - return Object.keys(countries).filter( - country => countries[country].continent === continent - ); -} - -function sumKeyValues(hash, keys) { - return keys.reduce((n, key) => n + (hash[key] || 0), 0); -} - -// function sumValues(hash) { -// return Object.keys(hash).reduce((memo, key) => memo + hash[key], 0); -// } - -export default class Stats extends React.Component { - state = { - // minPackageRequests: 1000000, - minCountryRequests: 1000000 - }; - - render() { - const { data } = this.props; - - if (data == null) return null; - - const totals = data.totals; - - // Summary data - const since = parseDate(totals.since); - const until = parseDate(totals.until); - - // Packages - // const packageRows = []; - - // Object.keys(totals.requests.package) - // .sort((a, b) => { - // return totals.requests.package[b] - totals.requests.package[a]; - // }) - // .forEach(packageName => { - // const requests = totals.requests.package[packageName]; - // const bandwidth = totals.bandwidth.package[packageName]; - - // if (requests >= this.state.minPackageRequests) { - // packageRows.push( - // - // - // - // {packageName} - // - // - // - // {formatNumber(requests)} ( - // {formatPercent(requests / totals.requests.all)} - // %) - // - // {bandwidth ? ( - // - // {formatBytes(bandwidth)} ( - // {formatPercent(bandwidth / totals.bandwidth.all)} - // %) - // - // ) : ( - // - - // )} - // - // ); - // } - // }); - - // Regions - const regionRows = []; - - const continentsData = Object.keys(continents).reduce((memo, continent) => { - const localCountries = getCountriesByContinent(continent); - - memo[continent] = { - countries: localCountries, - requests: sumKeyValues(totals.requests.country, localCountries), - bandwidth: sumKeyValues(totals.bandwidth.country, localCountries) - }; - - return memo; - }, {}); - - const topContinents = Object.keys(continentsData).sort((a, b) => { - return continentsData[b].requests - continentsData[a].requests; - }); - - topContinents.forEach(continent => { - const continentName = continents[continent]; - const continentData = continentsData[continent]; - - if ( - continentData.requests > this.state.minCountryRequests && - continentData.bandwidth !== 0 - ) { - regionRows.push( - - - {continentName} - - - - {formatNumber(continentData.requests)} ( - {formatPercent(continentData.requests / totals.requests.all)} - %) - - - - - {formatBytes(continentData.bandwidth)} ( - {formatPercent(continentData.bandwidth / totals.bandwidth.all)} - %) - - - - ); - - const topCountries = continentData.countries.sort((a, b) => { - return totals.requests.country[b] - totals.requests.country[a]; - }); - - topCountries.forEach(country => { - const countryRequests = totals.requests.country[country]; - const countryBandwidth = totals.bandwidth.country[country]; - - if (countryRequests > this.state.minCountryRequests) { - regionRows.push( - - {countries[country].name} - - {formatNumber(countryRequests)} ( - {formatPercent(countryRequests / totals.requests.all)} - %) - - - {formatBytes(countryBandwidth)} ( - {formatPercent(countryBandwidth / totals.bandwidth.all)} - %) - - - ); - } - }); - } - }); - - // Protocols - // const protocolRows = Object.keys(totals.requests.protocol) - // .sort((a, b) => { - // return totals.requests.protocol[b] - totals.requests.protocol[a]; - // }) - // .map(protocol => { - // const requests = totals.requests.protocol[protocol]; - - // return ( - // - // {protocol} - // - // {formatNumber(requests)} ( - // {formatPercent(requests / sumValues(totals.requests.protocol))} - // %) - // - // - // ); - // }); - - return ( - -

- From {formatDate(since, 'MMM D')} to{' '} - {formatDate(until, 'MMM D')} unpkg served{' '} - {formatNumber(totals.requests.all)} requests and a - total of {formatBytes(totals.bandwidth.all)} of data - to {formatNumber(totals.uniques.all)} unique - visitors,{' '} - - {formatPercent(totals.requests.cached / totals.requests.all, 0)}% - {' '} - of which were served from the cache. -

- -

Packages

- -

- We recently migrated unpkg to a new backend and are working on getting - package-specific data back on the site. -

- - {/* -

- The table below shows the most popular packages served by unpkg from{' '} - {formatDate(since, 'MMM D')} to{' '} - {formatDate(until, 'MMM D')}. Only the top{' '} - {Object.keys(totals.requests.package).length} packages are shown. -

- -

- Include only packages that received at least{' '} - {' '} - requests. -

- - - - - - - - - - {packageRows} -
- Package - - Requests (% of total) - - Bandwidth (% of total) -
- */} - -

Regions

- -

- The table below breaks down requests to unpkg from{' '} - {formatDate(since, 'MMM D')} to{' '} - {formatDate(until, 'MMM D')} by geographic region. -

- -

- Include only countries that made at least{' '} - {' '} - requests. -

- - - - - - - - - - {regionRows} -
- Region - - Requests (% of total) - - Bandwidth (% of total) -
- - {/* -

Protocols

- -

- The table below breaks down requests to unpkg from{' '} - {formatDate(since, 'MMM D')} to{' '} - {formatDate(until, 'MMM D')} by HTTP protocol. -

- - - - - - - - - {protocolRows} -
- Protocol - - Requests (% of total) -
- */} -
- ); - } -} - -if (process.env.NODE_ENV !== 'production') { - Stats.propTypes = { - data: PropTypes.object - }; -} diff --git a/modules/client/main/WindowSize.js b/modules/client/main/WindowSize.js deleted file mode 100644 index 1d74954..0000000 --- a/modules/client/main/WindowSize.js +++ /dev/null @@ -1,35 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; - -import { addEvent, removeEvent } from '../utils/dom'; - -const resizeEvent = 'resize'; - -export default class WindowSize extends React.Component { - handleWindowResize = () => { - if (this.props.onChange) { - this.props.onChange({ - width: window.innerWidth, - height: window.innerHeight - }); - } - }; - - componentDidMount() { - addEvent(window, resizeEvent, this.handleWindowResize); - } - - componentWillUnmount() { - removeEvent(window, resizeEvent, this.handleWindowResize); - } - - render() { - return null; - } -} - -if (process.env.NODE_ENV !== 'production') { - WindowSize.propTypes = { - onChange: PropTypes.func - }; -} diff --git a/modules/client/main/Wrapper.js b/modules/client/main/Wrapper.js deleted file mode 100644 index ed96a05..0000000 --- a/modules/client/main/Wrapper.js +++ /dev/null @@ -1,5 +0,0 @@ -import React from 'react'; - -export default function Wrapper({ children }) { - return
{children}
; -} diff --git a/modules/client/main/countries.json b/modules/client/main/countries.json deleted file mode 100644 index 1654211..0000000 --- a/modules/client/main/countries.json +++ /dev/null @@ -1 +0,0 @@ -{"continents":{"AF":"Africa","AN":"Antarctica","AS":"Asia","EU":"Europe","NA":"North America","OC":"Oceania","SA":"South America"},"countries":{"AD":{"name":"Andorra","continent":"EU"},"AE":{"name":"United Arab Emirates","continent":"AS"},"AF":{"name":"Afghanistan","continent":"AS"},"AG":{"name":"Antigua and Barbuda","continent":"NA"},"AI":{"name":"Anguilla","continent":"NA"},"AL":{"name":"Albania","continent":"EU"},"AM":{"name":"Armenia","continent":"AS"},"AO":{"name":"Angola","continent":"AF"},"AQ":{"name":"Antarctica","continent":"AN"},"AR":{"name":"Argentina","continent":"SA"},"AS":{"name":"American Samoa","continent":"OC"},"AT":{"name":"Austria","continent":"EU"},"AU":{"name":"Australia","continent":"OC"},"AW":{"name":"Aruba","continent":"NA"},"AX":{"name":"Åland","continent":"EU"},"AZ":{"name":"Azerbaijan","continent":"AS"},"BA":{"name":"Bosnia and Herzegovina","continent":"EU"},"BB":{"name":"Barbados","continent":"NA"},"BD":{"name":"Bangladesh","continent":"AS"},"BE":{"name":"Belgium","continent":"EU"},"BF":{"name":"Burkina Faso","continent":"AF"},"BG":{"name":"Bulgaria","continent":"EU"},"BH":{"name":"Bahrain","continent":"AS"},"BI":{"name":"Burundi","continent":"AF"},"BJ":{"name":"Benin","continent":"AF"},"BL":{"name":"Saint Barthélemy","continent":"NA"},"BM":{"name":"Bermuda","continent":"NA"},"BN":{"name":"Brunei","continent":"AS"},"BO":{"name":"Bolivia","continent":"SA"},"BQ":{"name":"Bonaire","continent":"NA"},"BR":{"name":"Brazil","continent":"SA"},"BS":{"name":"Bahamas","continent":"NA"},"BT":{"name":"Bhutan","continent":"AS"},"BV":{"name":"Bouvet Island","continent":"AN"},"BW":{"name":"Botswana","continent":"AF"},"BY":{"name":"Belarus","continent":"EU"},"BZ":{"name":"Belize","continent":"NA"},"CA":{"name":"Canada","continent":"NA"},"CC":{"name":"Cocos [Keeling] Islands","continent":"AS"},"CD":{"name":"Democratic Republic of the Congo","continent":"AF"},"CF":{"name":"Central African Republic","continent":"AF"},"CG":{"name":"Republic of the Congo","continent":"AF"},"CH":{"name":"Switzerland","continent":"EU"},"CI":{"name":"Ivory Coast","continent":"AF"},"CK":{"name":"Cook Islands","continent":"OC"},"CL":{"name":"Chile","continent":"SA"},"CM":{"name":"Cameroon","continent":"AF"},"CN":{"name":"China","continent":"AS"},"CO":{"name":"Colombia","continent":"SA"},"CR":{"name":"Costa Rica","continent":"NA"},"CU":{"name":"Cuba","continent":"NA"},"CV":{"name":"Cape Verde","continent":"AF"},"CW":{"name":"Curacao","continent":"NA"},"CX":{"name":"Christmas Island","continent":"AS"},"CY":{"name":"Cyprus","continent":"EU"},"CZ":{"name":"Czech Republic","continent":"EU"},"DE":{"name":"Germany","continent":"EU"},"DJ":{"name":"Djibouti","continent":"AF"},"DK":{"name":"Denmark","continent":"EU"},"DM":{"name":"Dominica","continent":"NA"},"DO":{"name":"Dominican Republic","continent":"NA"},"DZ":{"name":"Algeria","continent":"AF"},"EC":{"name":"Ecuador","continent":"SA"},"EE":{"name":"Estonia","continent":"EU"},"EG":{"name":"Egypt","continent":"AF"},"EH":{"name":"Western Sahara","continent":"AF"},"ER":{"name":"Eritrea","continent":"AF"},"ES":{"name":"Spain","continent":"EU"},"ET":{"name":"Ethiopia","continent":"AF"},"FI":{"name":"Finland","continent":"EU"},"FJ":{"name":"Fiji","continent":"OC"},"FK":{"name":"Falkland Islands","continent":"SA"},"FM":{"name":"Micronesia","continent":"OC"},"FO":{"name":"Faroe Islands","continent":"EU"},"FR":{"name":"France","continent":"EU"},"GA":{"name":"Gabon","continent":"AF"},"GB":{"name":"United Kingdom","continent":"EU"},"GD":{"name":"Grenada","continent":"NA"},"GE":{"name":"Georgia","continent":"AS"},"GF":{"name":"French Guiana","continent":"SA"},"GG":{"name":"Guernsey","continent":"EU"},"GH":{"name":"Ghana","continent":"AF"},"GI":{"name":"Gibraltar","continent":"EU"},"GL":{"name":"Greenland","continent":"NA"},"GM":{"name":"Gambia","continent":"AF"},"GN":{"name":"Guinea","continent":"AF"},"GP":{"name":"Guadeloupe","continent":"NA"},"GQ":{"name":"Equatorial Guinea","continent":"AF"},"GR":{"name":"Greece","continent":"EU"},"GS":{"name":"South Georgia and the South Sandwich Islands","continent":"AN"},"GT":{"name":"Guatemala","continent":"NA"},"GU":{"name":"Guam","continent":"OC"},"GW":{"name":"Guinea-Bissau","continent":"AF"},"GY":{"name":"Guyana","continent":"SA"},"HK":{"name":"Hong Kong","continent":"AS"},"HM":{"name":"Heard Island and McDonald Islands","continent":"AN"},"HN":{"name":"Honduras","continent":"NA"},"HR":{"name":"Croatia","continent":"EU"},"HT":{"name":"Haiti","continent":"NA"},"HU":{"name":"Hungary","continent":"EU"},"ID":{"name":"Indonesia","continent":"AS"},"IE":{"name":"Ireland","continent":"EU"},"IL":{"name":"Israel","continent":"AS"},"IM":{"name":"Isle of Man","continent":"EU"},"IN":{"name":"India","continent":"AS"},"IO":{"name":"British Indian Ocean Territory","continent":"AS"},"IQ":{"name":"Iraq","continent":"AS"},"IR":{"name":"Iran","continent":"AS"},"IS":{"name":"Iceland","continent":"EU"},"IT":{"name":"Italy","continent":"EU"},"JE":{"name":"Jersey","continent":"EU"},"JM":{"name":"Jamaica","continent":"NA"},"JO":{"name":"Jordan","continent":"AS"},"JP":{"name":"Japan","continent":"AS"},"KE":{"name":"Kenya","continent":"AF"},"KG":{"name":"Kyrgyzstan","continent":"AS"},"KH":{"name":"Cambodia","continent":"AS"},"KI":{"name":"Kiribati","continent":"OC"},"KM":{"name":"Comoros","continent":"AF"},"KN":{"name":"Saint Kitts and Nevis","continent":"NA"},"KP":{"name":"North Korea","continent":"AS"},"KR":{"name":"South Korea","continent":"AS"},"KW":{"name":"Kuwait","continent":"AS"},"KY":{"name":"Cayman Islands","continent":"NA"},"KZ":{"name":"Kazakhstan","continent":"AS"},"LA":{"name":"Laos","continent":"AS"},"LB":{"name":"Lebanon","continent":"AS"},"LC":{"name":"Saint Lucia","continent":"NA"},"LI":{"name":"Liechtenstein","continent":"EU"},"LK":{"name":"Sri Lanka","continent":"AS"},"LR":{"name":"Liberia","continent":"AF"},"LS":{"name":"Lesotho","continent":"AF"},"LT":{"name":"Lithuania","continent":"EU"},"LU":{"name":"Luxembourg","continent":"EU"},"LV":{"name":"Latvia","continent":"EU"},"LY":{"name":"Libya","continent":"AF"},"MA":{"name":"Morocco","continent":"AF"},"MC":{"name":"Monaco","continent":"EU"},"MD":{"name":"Moldova","continent":"EU"},"ME":{"name":"Montenegro","continent":"EU"},"MF":{"name":"Saint Martin","continent":"NA"},"MG":{"name":"Madagascar","continent":"AF"},"MH":{"name":"Marshall Islands","continent":"OC"},"MK":{"name":"Macedonia","continent":"EU"},"ML":{"name":"Mali","continent":"AF"},"MM":{"name":"Myanmar [Burma]","continent":"AS"},"MN":{"name":"Mongolia","continent":"AS"},"MO":{"name":"Macao","continent":"AS"},"MP":{"name":"Northern Mariana Islands","continent":"OC"},"MQ":{"name":"Martinique","continent":"NA"},"MR":{"name":"Mauritania","continent":"AF"},"MS":{"name":"Montserrat","continent":"NA"},"MT":{"name":"Malta","continent":"EU"},"MU":{"name":"Mauritius","continent":"AF"},"MV":{"name":"Maldives","continent":"AS"},"MW":{"name":"Malawi","continent":"AF"},"MX":{"name":"Mexico","continent":"NA"},"MY":{"name":"Malaysia","continent":"AS"},"MZ":{"name":"Mozambique","continent":"AF"},"NA":{"name":"Namibia","continent":"AF"},"NC":{"name":"New Caledonia","continent":"OC"},"NE":{"name":"Niger","continent":"AF"},"NF":{"name":"Norfolk Island","continent":"OC"},"NG":{"name":"Nigeria","continent":"AF"},"NI":{"name":"Nicaragua","continent":"NA"},"NL":{"name":"Netherlands","continent":"EU"},"NO":{"name":"Norway","continent":"EU"},"NP":{"name":"Nepal","continent":"AS"},"NR":{"name":"Nauru","continent":"OC"},"NU":{"name":"Niue","continent":"OC"},"NZ":{"name":"New Zealand","continent":"OC"},"OM":{"name":"Oman","continent":"AS"},"PA":{"name":"Panama","continent":"NA"},"PE":{"name":"Peru","continent":"SA"},"PF":{"name":"French Polynesia","continent":"OC"},"PG":{"name":"Papua New Guinea","continent":"OC"},"PH":{"name":"Philippines","continent":"AS"},"PK":{"name":"Pakistan","continent":"AS"},"PL":{"name":"Poland","continent":"EU"},"PM":{"name":"Saint Pierre and Miquelon","continent":"NA"},"PN":{"name":"Pitcairn Islands","continent":"OC"},"PR":{"name":"Puerto Rico","continent":"NA"},"PS":{"name":"Palestine","continent":"AS"},"PT":{"name":"Portugal","continent":"EU"},"PW":{"name":"Palau","continent":"OC"},"PY":{"name":"Paraguay","continent":"SA"},"QA":{"name":"Qatar","continent":"AS"},"RE":{"name":"Réunion","continent":"AF"},"RO":{"name":"Romania","continent":"EU"},"RS":{"name":"Serbia","continent":"EU"},"RU":{"name":"Russia","continent":"EU"},"RW":{"name":"Rwanda","continent":"AF"},"SA":{"name":"Saudi Arabia","continent":"AS"},"SB":{"name":"Solomon Islands","continent":"OC"},"SC":{"name":"Seychelles","continent":"AF"},"SD":{"name":"Sudan","continent":"AF"},"SE":{"name":"Sweden","continent":"EU"},"SG":{"name":"Singapore","continent":"AS"},"SH":{"name":"Saint Helena","continent":"AF"},"SI":{"name":"Slovenia","continent":"EU"},"SJ":{"name":"Svalbard and Jan Mayen","continent":"EU"},"SK":{"name":"Slovakia","continent":"EU"},"SL":{"name":"Sierra Leone","continent":"AF"},"SM":{"name":"San Marino","continent":"EU"},"SN":{"name":"Senegal","continent":"AF"},"SO":{"name":"Somalia","continent":"AF"},"SR":{"name":"Suriname","continent":"SA"},"SS":{"name":"South Sudan","continent":"AF"},"ST":{"name":"São Tomé and Príncipe","continent":"AF"},"SV":{"name":"El Salvador","continent":"NA"},"SX":{"name":"Sint Maarten","continent":"NA"},"SY":{"name":"Syria","continent":"AS"},"SZ":{"name":"Swaziland","continent":"AF"},"TC":{"name":"Turks and Caicos Islands","continent":"NA"},"TD":{"name":"Chad","continent":"AF"},"TF":{"name":"French Southern Territories","continent":"AN"},"TG":{"name":"Togo","continent":"AF"},"TH":{"name":"Thailand","continent":"AS"},"TJ":{"name":"Tajikistan","continent":"AS"},"TK":{"name":"Tokelau","continent":"OC"},"TL":{"name":"East Timor","continent":"OC"},"TM":{"name":"Turkmenistan","continent":"AS"},"TN":{"name":"Tunisia","continent":"AF"},"TO":{"name":"Tonga","continent":"OC"},"TR":{"name":"Turkey","continent":"AS"},"TT":{"name":"Trinidad and Tobago","continent":"NA"},"TV":{"name":"Tuvalu","continent":"OC"},"TW":{"name":"Taiwan","continent":"AS"},"TZ":{"name":"Tanzania","continent":"AF"},"UA":{"name":"Ukraine","continent":"EU"},"UG":{"name":"Uganda","continent":"AF"},"UM":{"name":"U.S. Minor Outlying Islands","continent":"OC"},"US":{"name":"United States","continent":"NA"},"UY":{"name":"Uruguay","continent":"SA"},"UZ":{"name":"Uzbekistan","continent":"AS"},"VA":{"name":"Vatican City","continent":"EU"},"VC":{"name":"Saint Vincent and the Grenadines","continent":"NA"},"VE":{"name":"Venezuela","continent":"SA"},"VG":{"name":"British Virgin Islands","continent":"NA"},"VI":{"name":"U.S. Virgin Islands","continent":"NA"},"VN":{"name":"Vietnam","continent":"AS"},"VU":{"name":"Vanuatu","continent":"OC"},"WF":{"name":"Wallis and Futuna","continent":"OC"},"WS":{"name":"Samoa","continent":"OC"},"XK":{"name":"Kosovo","continent":"EU"},"YE":{"name":"Yemen","continent":"AS"},"YT":{"name":"Mayotte","continent":"AF"},"ZA":{"name":"South Africa","continent":"AF"},"ZM":{"name":"Zambia","continent":"AF"},"ZW":{"name":"Zimbabwe","continent":"AF"}}} diff --git a/modules/client/utils/dom.js b/modules/client/utils/dom.js deleted file mode 100644 index e36fc3c..0000000 --- a/modules/client/utils/dom.js +++ /dev/null @@ -1,15 +0,0 @@ -export function addEvent(node, type, handler) { - if (node.addEventListener) { - node.addEventListener(type, handler, false); - } else if (node.attachEvent) { - node.attachEvent('on' + type, handler); - } -} - -export function removeEvent(node, type, handler) { - if (node.removeEventListener) { - node.removeEventListener(type, handler, false); - } else if (node.detachEvent) { - node.detachEvent('on' + type, handler); - } -} diff --git a/modules/client/utils/parseNumber.js b/modules/client/utils/parseNumber.js deleted file mode 100644 index cd8cd85..0000000 --- a/modules/client/utils/parseNumber.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function parseNumber(s) { - return parseInt(s.replace(/,/g, ''), 10) || 0; -} diff --git a/package-lock.json b/package-lock.json index 8089c77..00a8166 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2437,12 +2437,6 @@ } } }, - "countries-list": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/countries-list/-/countries-list-1.4.1.tgz", - "integrity": "sha1-R+JU/WD1NmDUstGUrhF/qTjqfCk=", - "dev": true - }, "cross-spawn": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", @@ -4232,33 +4226,6 @@ } } }, - "history": { - "version": "4.7.2", - "resolved": "https://registry.npmjs.org/history/-/history-4.7.2.tgz", - "integrity": "sha512-1zkBRWW6XweO0NBcjiphtVJVsIQ+SXF29z9DVkceeaSLVMFXHool+fdCZD4spDCfZJCILPILc3bm7Bc+HRi0nA==", - "requires": { - "invariant": "^2.2.1", - "loose-envify": "^1.2.0", - "resolve-pathname": "^2.2.0", - "value-equal": "^0.4.0", - "warning": "^3.0.0" - }, - "dependencies": { - "warning": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/warning/-/warning-3.0.0.tgz", - "integrity": "sha1-MuU3fLVy3kqwR1O9+IIcAe1gW3w=", - "requires": { - "loose-envify": "^1.0.0" - } - } - } - }, - "hoist-non-react-statics": { - "version": "2.5.5", - "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-2.5.5.tgz", - "integrity": "sha512-rqcy4pJo55FTTLWt+bU8ukscqHeE/e9KWvsOW2b/a3afxQZhwkQdT1rPPCJ0rYXdj4vNcasY8zHTH+jF/qStxw==" - }, "hosted-git-info": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.7.1.tgz", @@ -4399,6 +4366,7 @@ "version": "2.2.4", "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", + "dev": true, "requires": { "loose-envify": "^1.0.0" } @@ -6117,21 +6085,6 @@ "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==" }, - "path-to-regexp": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.7.0.tgz", - "integrity": "sha1-Wf3g9DW62suhA6hOnTvGTpa5k30=", - "requires": { - "isarray": "0.0.1" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" - } - } - }, "path-type": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", @@ -6356,33 +6309,6 @@ "raf": "^3.1.0" } }, - "react-router": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-4.3.1.tgz", - "integrity": "sha512-yrvL8AogDh2X42Dt9iknk4wF4V8bWREPirFfS9gLU1huk6qK41sg7Z/1S81jjTrGHxa3B8R3J6xIkDAA6CVarg==", - "requires": { - "history": "^4.7.2", - "hoist-non-react-statics": "^2.5.0", - "invariant": "^2.2.4", - "loose-envify": "^1.3.1", - "path-to-regexp": "^1.7.0", - "prop-types": "^15.6.1", - "warning": "^4.0.1" - } - }, - "react-router-dom": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-4.3.1.tgz", - "integrity": "sha512-c/MlywfxDdCp7EnB7YfPMOfMD3tOtIjrQlj/CKfNMBxdmpJP8xcz5P/UAFn3JbnQCNUxsHyVVqllF9LhgVyFCA==", - "requires": { - "history": "^4.7.2", - "invariant": "^2.2.4", - "loose-envify": "^1.3.1", - "prop-types": "^15.6.1", - "react-router": "^4.3.1", - "warning": "^4.0.1" - } - }, "read-pkg": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", @@ -6678,11 +6604,6 @@ "integrity": "sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY=", "dev": true }, - "resolve-pathname": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/resolve-pathname/-/resolve-pathname-2.2.0.tgz", - "integrity": "sha512-bAFz9ld18RzJfddgrO2e/0S2O81710++chRMUxHjXOYKF6jTAMrUNZrEZ1PvV0zlhfjidm08iRPdTLPno1FuRg==" - }, "resolve-url": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", @@ -8079,11 +8000,6 @@ "spdx-expression-parse": "^3.0.0" } }, - "value-equal": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/value-equal/-/value-equal-0.4.0.tgz", - "integrity": "sha512-x+cYdNnaA3CxvMaTX0INdTCN8m8aF2uY9BvEqmxuYp8bL09cs/kWVQPVGcA35fMktdOsP69IgU7wFj/61dJHEw==" - }, "verror": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", @@ -8113,14 +8029,6 @@ "makeerror": "1.0.x" } }, - "warning": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/warning/-/warning-4.0.2.tgz", - "integrity": "sha512-wbTp09q/9C+jJn4KKJfJfoS6VleK/Dti0yqWSm6KMvJ4MRCXFQNapHuJXutJIrWV0Cf4AhTdeIe4qdKHR1+Hug==", - "requires": { - "loose-envify": "^1.0.0" - } - }, "watch": { "version": "0.18.0", "resolved": "https://registry.npmjs.org/watch/-/watch-0.18.0.tgz", diff --git a/package.json b/package.json index ba3808f..181b7b0 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,6 @@ "react": "^16.7.0", "react-dom": "^16.7.0", "react-motion": "^0.5.2", - "react-router-dom": "^4.3.1", "sort-by": "^1.2.0" }, "devDependencies": { @@ -29,7 +28,6 @@ "babel-core": "^7.0.0-bridge.0", "babel-eslint": "^8.0.3", "babel-jest": "^23.4.2", - "countries-list": "^1.4.1", "dotenv": "^6.2.0", "eslint": "^4.13.1", "eslint-import-resolver-node": "^0.3.2", diff --git a/scripts/generate-countries-json.js b/scripts/generate-countries-json.js deleted file mode 100644 index 18e0359..0000000 --- a/scripts/generate-countries-json.js +++ /dev/null @@ -1,12 +0,0 @@ -const countriesList = require('countries-list'); - -const json = JSON.stringify({ - continents: countriesList.continents, - countries: Object.keys(countriesList.countries).reduce((memo, key) => { - const { name, continent } = countriesList.countries[key]; - memo[key] = { name, continent }; - return memo; - }, {}) -}); - -console.log(json);