Merge pull request #1287 from wesbos/upgrade-dependencies

Upgrade dependencies
This commit is contained in:
Wes Bos 2022-01-12 09:56:40 -05:00 committed by GitHub
commit 23113a0f86
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 28413 additions and 12741 deletions

1
.node-version Normal file
View file

@ -0,0 +1 @@
16.13.1

3
.npmrc Normal file
View file

@ -0,0 +1,3 @@
fund=false
audit=false
legacy-peer-deps=true

View file

@ -1,5 +1,5 @@
import people from './src/data.js'; const { tags, countries, devices, normalizeTag } = require('./src/util/stats');
import { tags, countries, devices, normalizeTag } from './src/util/stats'; const people = require('./src/data.js');
function unique(arr) { function unique(arr) {
return Array.from(new Set(arr)); return Array.from(new Set(arr));
@ -14,12 +14,12 @@ function sourceNodes({ actions, createNodeId, createContentDigest }) {
// Add People to the GraphQL API, we randomize the data on each build so no one gets their feelings hurt // Add People to the GraphQL API, we randomize the data on each build so no one gets their feelings hurt
people people
.sort(() => Math.random() - 0.5) .sort(() => Math.random() - 0.5)
.forEach(person => { .forEach((person) => {
const normalizedPerson = { const normalizedPerson = {
...person, ...person,
// Clean out people that added basically the same tags twice // Clean out people that added basically the same tags twice
tags: unique( tags: unique(
person.tags.map(tag => normalizedTagMap[normalizeTag(tag)] || tag) person.tags.map((tag) => normalizedTagMap[normalizeTag(tag)] || tag)
), ),
}; };
const nodeMeta = { const nodeMeta = {
@ -38,7 +38,7 @@ function sourceNodes({ actions, createNodeId, createContentDigest }) {
}); });
// Add tags to GraphQL API // Add tags to GraphQL API
tags().forEach(tag => { tags().forEach((tag) => {
const nodeMeta = { const nodeMeta = {
id: createNodeId(`tag-${tag.name}`), id: createNodeId(`tag-${tag.name}`),
parent: null, parent: null,
@ -55,7 +55,7 @@ function sourceNodes({ actions, createNodeId, createContentDigest }) {
}); });
// Add Countries to GraphQL API // Add Countries to GraphQL API
countries().forEach(country => { countries().forEach((country) => {
const nodeMeta = { const nodeMeta = {
id: createNodeId(`country-${country.name}`), id: createNodeId(`country-${country.name}`),
parent: null, parent: null,
@ -72,7 +72,7 @@ function sourceNodes({ actions, createNodeId, createContentDigest }) {
}); });
// Add Devices to GraphQL API // Add Devices to GraphQL API
devices().forEach(device => { devices().forEach((device) => {
const nodeMeta = { const nodeMeta = {
id: createNodeId(`device-${device.name}`), id: createNodeId(`device-${device.name}`),
parent: null, parent: null,
@ -88,4 +88,4 @@ function sourceNodes({ actions, createNodeId, createContentDigest }) {
}); });
} }
export { sourceNodes }; exports.sourceNodes = sourceNodes;

40984
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -15,49 +15,54 @@
"@actions/core": "^1.2.1", "@actions/core": "^1.2.1",
"@actions/exec": "^1.0.3", "@actions/exec": "^1.0.3",
"@actions/github": "^2.0.1", "@actions/github": "^2.0.1",
"@hapi/joi": "^17.0.2", "@babel/core": "^7.16.7",
"country-emoji": "^1.5.0", "@babel/eslint-parser": "^7.16.5",
"esm": "^3.2.25", "@babel/preset-react": "^7.16.7",
"gatsby": "^2.18.12", "@types/node": "^16.11.19",
"gatsby-image": "^2.2.34", "@typescript-eslint/eslint-plugin": "^5.9.1",
"gatsby-plugin-manifest": "^2.2.31", "@typescript-eslint/parser": "^5.9.1",
"gatsby-plugin-offline": "^3.0.27", "country-emoji": "^1.5.6",
"gatsby-plugin-react-helmet": "^3.1.16", "eslint-config-airbnb-typescript": "^16.1.0",
"gatsby-plugin-sharp": "^2.3.5", "gatsby": "^4.5.0",
"gatsby-plugin-styled-components": "^3.1.16", "gatsby-image": "^3.11.0",
"gatsby-plugin-manifest": "^4.5.0",
"gatsby-plugin-offline": "^5.5.0",
"gatsby-plugin-react-helmet": "^5.5.0",
"gatsby-plugin-sharp": "^4.5.0",
"gatsby-plugin-styled-components": "^5.5.0",
"gatsby-plugin-web-font-loader": "^1.0.4", "gatsby-plugin-web-font-loader": "^1.0.4",
"gatsby-source-filesystem": "^2.1.40", "gatsby-source-filesystem": "^4.5.0",
"gatsby-transformer-sharp": "^2.3.7", "gatsby-transformer-sharp": "^4.5.0",
"joi": "^17.5.0",
"normalize.css": "^8.0.1", "normalize.css": "^8.0.1",
"prop-types": "^15.7.2", "prop-types": "^15.8.1",
"react": "^16.12.0", "react": "^17.0.2",
"react-dom": "^16.12.0", "react-dom": "^17.0.2",
"react-helmet": "^5.2.1", "react-helmet": "^6.1.0",
"styled-components": "5.0.0-rc.3" "styled-components": "5.3.3",
"typescript": "^4.5.4"
}, },
"scripts": { "scripts": {
"build": "npx --node-arg '-r esm' gatsby build", "build": "gatsby build",
"develop": "npx --node-arg '-r esm' gatsby develop", "develop": "gatsby develop",
"start": "npm run develop", "start": "npm run develop",
"serve": "npx --node-arg '-r esm' gatsby serve", "serve": "gatsby serve",
"clean": "gatsby clean" "clean": "gatsby clean"
}, },
"devDependencies": { "devDependencies": {
"@architect/sandbox": "^1.6.0", "eslint": "^8.6.0",
"babel-eslint": "^9.0.0", "eslint-config-airbnb": "^19.0.4",
"eslint": "^5.16.0", "eslint-config-prettier": "^8.3.0",
"eslint-config-airbnb": "^17.1.1", "eslint-config-wesbos": "^3.0.2",
"eslint-config-prettier": "^4.3.0", "eslint-plugin-html": "^6.2.0",
"eslint-config-wesbos": "0.0.19", "eslint-plugin-import": "^2.25.4",
"eslint-plugin-html": "^5.0.5", "eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-import": "^2.19.1", "eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-jsx-a11y": "^6.2.3", "eslint-plugin-react": "^7.28.0",
"eslint-plugin-prettier": "^3.1.2", "eslint-plugin-react-hooks": "^4.3.0",
"eslint-plugin-react": "^7.17.0",
"eslint-plugin-react-hooks": "^1.7.0",
"husky": "^4.0.10", "husky": "^4.0.10",
"lint-staged": "^9.5.0", "lint-staged": "^9.5.0",
"prettier": "^1.19.1" "prettier": "^2.5.1"
}, },
"husky": { "husky": {
"hooks": { "hooks": {

View file

@ -1,7 +1,7 @@
const exec = require('@actions/exec'); const exec = require('@actions/exec');
const core = require('@actions/core'); const core = require('@actions/core');
const github = require('@actions/github'); const github = require('@actions/github');
const Joi = require('@hapi/joi'); const Joi = require('joi');
const http = require('http'); const http = require('http');
const https = require('https'); const https = require('https');
const flags = require('./flags.js'); const flags = require('./flags.js');
@ -13,8 +13,8 @@ async function getCurrentBranchName() {
const options = { const options = {
silent: true, silent: true,
listeners: { listeners: {
stdout: data => (myOutput += data.toString()), stdout: (data) => (myOutput += data.toString()),
stderr: data => (myError += data.toString()), stderr: (data) => (myError += data.toString()),
}, },
}; };
@ -23,7 +23,7 @@ async function getCurrentBranchName() {
} }
/** on master branch will return an empty array */ /** on master branch will return an empty array */
module.exports.getMasterData = async function() { module.exports.getMasterData = async function () {
const options = { silent: true }; const options = { silent: true };
const curentBranchName = await getCurrentBranchName(); const curentBranchName = await getCurrentBranchName();
// when on a branch/PR different from master // when on a branch/PR different from master
@ -63,11 +63,11 @@ module.exports.Schema = Joi.object({
twitter: Joi.string().pattern(new RegExp(/^@?(\w){1,15}$/)), twitter: Joi.string().pattern(new RegExp(/^@?(\w){1,15}$/)),
emoji: Joi.string().allow(''), emoji: Joi.string().allow(''),
computer: Joi.string().valid('apple', 'windows', 'linux', 'bsd'), computer: Joi.string().valid('apple', 'windows', 'linux', 'bsd'),
phone: Joi.string().valid('iphone', 'android', 'windowsphone','flipphone'), phone: Joi.string().valid('iphone', 'android', 'windowsphone', 'flipphone'),
tags: Joi.array().items(Joi.string()), tags: Joi.array().items(Joi.string()),
}); });
module.exports.getStatusCode = function(url) { module.exports.getStatusCode = function (url) {
const client = url.startsWith('https') ? https : http; const client = url.startsWith('https') ? https : http;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const REQUEST_TIMEOUT = 10000; const REQUEST_TIMEOUT = 10000;
@ -78,17 +78,17 @@ module.exports.getStatusCode = function(url) {
); );
client client
.get(url, res => { .get(url, (res) => {
clearTimeout(timeoutId); clearTimeout(timeoutId);
resolve(res.statusCode); resolve(res.statusCode);
}) })
.on('error', err => reject(err)); .on('error', (err) => reject(err));
}); });
}; };
// If there are errors, will fail the action & add a comment detailing the issues // If there are errors, will fail the action & add a comment detailing the issues
// If there are no errors, will leave an "all-clear" comment with relevant URLs (to ease a potential manual check) // If there are no errors, will leave an "all-clear" comment with relevant URLs (to ease a potential manual check)
module.exports.communicateValidationOutcome = async function( module.exports.communicateValidationOutcome = async function (
errors, errors,
failedUrls, failedUrls,
changedData changedData
@ -99,8 +99,8 @@ module.exports.communicateValidationOutcome = async function(
comment += [ comment += [
'🚨 We have detected the following issues, let us (contributors) know if you need support or clarifications:', '🚨 We have detected the following issues, let us (contributors) know if you need support or clarifications:',
...errors.map(e => `- ${e.message}`), ...errors.map((e) => `- ${e.message}`),
...failedUrls.map(url => `- URL is invalid: ${url}`), ...failedUrls.map((url) => `- URL is invalid: ${url}`),
].join('\n'); ].join('\n');
} else { } else {
comment += [ comment += [

View file

@ -1,32 +0,0 @@
import React from 'react';
import { useStaticQuery, graphql } from 'gatsby';
import Img from 'gatsby-image';
/*
* This component is built using `gatsby-image` to automatically serve optimized
* images with lazy loading and reduced file sizes. The image is loaded using a
* `useStaticQuery`, which allows us to load the image from directly within this
* component, rather than having to pass the image data down from pages.
*
* For more information, see the docs:
* - `gatsby-image`: https://gatsby.dev/gatsby-image
* - `useStaticQuery`: https://www.gatsbyjs.org/docs/use-static-query/
*/
const Image = () => {
const data = useStaticQuery(graphql`
query {
placeholderImage: file(relativePath: { eq: "gatsby-astronaut.png" }) {
childImageSharp {
fluid(maxWidth: 300) {
...GatsbyImageSharpFluid
}
}
}
}
`);
return <Img fluid={data.placeholderImage.childImageSharp.fluid} />;
};
export default Image;

View file

@ -1,8 +1,8 @@
import { name } from 'country-emoji'; const { name } = require('country-emoji');
import people from '../data.js'; const people = require('../data.js');
function merge(prop) { function merge(prop) {
return function(acc, obj) { return function (acc, obj) {
// Remove duplicated values. // Remove duplicated values.
const values = [...new Set(obj[prop])]; const values = [...new Set(obj[prop])];
return [...values, ...acc]; return [...values, ...acc];
@ -14,7 +14,7 @@ function countInstances(acc, tag) {
return acc; return acc;
} }
export function normalizeTag(tag) { function normalizeTag(tag) {
return ( return (
tag tag
// Common mispellings currently seen in the data // Common mispellings currently seen in the data
@ -31,9 +31,9 @@ export function normalizeTag(tag) {
); );
} }
export function countries() { function countries() {
const data = people const data = people
.map(person => ({ .map((person) => ({
name: name(person.country), name: name(person.country),
emoji: person.country, emoji: person.country,
})) }))
@ -57,7 +57,7 @@ export function countries() {
return sorted; return sorted;
} }
export function tags() { function tags() {
const allTags = people.reduce(merge('tags'), []); const allTags = people.reduce(merge('tags'), []);
const counts = allTags.reduce(countInstances, {}); const counts = allTags.reduce(countInstances, {});
// sort and filter for any tags that only have 1 // sort and filter for any tags that only have 1
@ -88,13 +88,18 @@ export function tags() {
return [{ name: 'all', count: people.length }, ...normalizedTags]; return [{ name: 'all', count: people.length }, ...normalizedTags];
} }
export function devices() { function devices() {
const all = [ const all = [
...people.map(person => person.computer), ...people.map((person) => person.computer),
...people.map(person => person.phone), ...people.map((person) => person.phone),
]; ];
return Object.entries(all.reduce(countInstances, {})) return Object.entries(all.reduce(countInstances, {}))
.map(([device, count]) => ({ name: device, count })) .map(([device, count]) => ({ name: device, count }))
.sort((a, b) => b.count - a.count); .sort((a, b) => b.count - a.count);
} }
exports.normalizeTag = normalizeTag;
exports.countries = countries;
exports.tags = tags;
exports.devices = devices;