mirror of
https://github.com/kremalicious/portfolio.git
synced 2025-02-14 21:10:41 +01:00
Merge pull request #499 from kremalicious/fix/packages
dependencies cleanup
This commit is contained in:
commit
d50199ba30
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"parser": "babel-eslint",
|
"parser": "@babel/eslint-parser",
|
||||||
"extends": [
|
"extends": [
|
||||||
"eslint:recommended",
|
"eslint:recommended",
|
||||||
"plugin:react/recommended",
|
"plugin:react/recommended",
|
||||||
|
@ -189,7 +189,7 @@ To run all tests, including all linting tests:
|
|||||||
npm test
|
npm test
|
||||||
```
|
```
|
||||||
|
|
||||||
All test files live beside the respective component. Testing setup, fixtures, and mocks can be found in `./jest.config.js` and `./jest` folder.
|
Most test files live beside the respective component. Testing setup, fixtures, and mocks can be found in the `./tests/` folder.
|
||||||
|
|
||||||
### 🎈 Add a new project
|
### 🎈 Add a new project
|
||||||
|
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
const babelOptions = {
|
|
||||||
presets: ['babel-preset-gatsby']
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = require('babel-jest').createTransformer(babelOptions)
|
|
44925
package-lock.json
generated
44925
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
40
package.json
40
package.json
@ -14,19 +14,19 @@
|
|||||||
"lint:css": "stylelint ./src/**/*.{css,scss}",
|
"lint:css": "stylelint ./src/**/*.{css,scss}",
|
||||||
"lint": "npm run lint:js && npm run lint:css",
|
"lint": "npm run lint:js && npm run lint:css",
|
||||||
"format": "prettier --write 'src/**/*.{js,jsx,css,scss}'",
|
"format": "prettier --write 'src/**/*.{js,jsx,css,scss}'",
|
||||||
"test": "npm run lint && jest --coverage --silent",
|
"test": "NODE_ENV=test npm run lint && jest --coverage --silent -c tests/jest.config.js",
|
||||||
"test:watch": "npm run lint && jest --coverage --watch",
|
"test:watch": "NODE_ENV=test npm run lint && jest --coverage --watch -c tests/jest.config.js",
|
||||||
"deploy:s3": "./scripts/deploy-s3.sh",
|
"deploy:s3": "./scripts/deploy-s3.sh",
|
||||||
"new": "babel-node ./scripts/new.js"
|
"new": "babel-node ./scripts/new.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@loadable/component": "^5.14.1",
|
"@giphy/js-fetch-api": "^2.1.0",
|
||||||
"axios": "^0.21.1",
|
"axios": "^0.21.1",
|
||||||
"file-saver": "^2.0.5",
|
"file-saver": "^2.0.5",
|
||||||
"gatsby": "^2.31.1",
|
"gatsby": "^2.32.3",
|
||||||
"gatsby-image": "^2.10.0",
|
"gatsby-image": "^2.11.0",
|
||||||
"gatsby-plugin-manifest": "^2.11.0",
|
"gatsby-plugin-manifest": "^2.12.0",
|
||||||
"gatsby-plugin-matomo": "^0.8.3",
|
"gatsby-plugin-matomo": "^0.9.0",
|
||||||
"gatsby-plugin-offline": "^3.9.0",
|
"gatsby-plugin-offline": "^3.9.0",
|
||||||
"gatsby-plugin-postcss": "^3.6.0",
|
"gatsby-plugin-postcss": "^3.6.0",
|
||||||
"gatsby-plugin-react-helmet": "^3.9.0",
|
"gatsby-plugin-react-helmet": "^3.9.0",
|
||||||
@ -39,7 +39,6 @@
|
|||||||
"gatsby-transformer-json": "^2.10.0",
|
"gatsby-transformer-json": "^2.10.0",
|
||||||
"gatsby-transformer-sharp": "^2.11.0",
|
"gatsby-transformer-sharp": "^2.11.0",
|
||||||
"gatsby-transformer-yaml": "^2.10.0",
|
"gatsby-transformer-yaml": "^2.10.0",
|
||||||
"giphy-js-sdk-core": "^1.0.6",
|
|
||||||
"intersection-observer": "^0.12.0",
|
"intersection-observer": "^0.12.0",
|
||||||
"react": "^17.0.1",
|
"react": "^17.0.1",
|
||||||
"react-dom": "^17.0.1",
|
"react-dom": "^17.0.1",
|
||||||
@ -51,40 +50,39 @@
|
|||||||
"remark-html": "^13.0.1",
|
"remark-html": "^13.0.1",
|
||||||
"remark-parse": "^9.0.0",
|
"remark-parse": "^9.0.0",
|
||||||
"remark-react": "^8.0.0",
|
"remark-react": "^8.0.0",
|
||||||
"shortid": "^2.2.15",
|
"shortid": "^2.2.16",
|
||||||
"use-dark-mode": "^2.3.1",
|
"use-dark-mode": "^2.3.1",
|
||||||
"vcf": "^2.1.0"
|
"vcf": "^2.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.12.10",
|
"@babel/core": "^7.12.13",
|
||||||
"@babel/node": "^7.12.10",
|
"@babel/eslint-parser": "^7.12.13",
|
||||||
"@babel/preset-env": "^7.12.11",
|
"@babel/node": "^7.12.13",
|
||||||
|
"@babel/preset-env": "^7.12.13",
|
||||||
|
"@loadable/component": "^5.14.1",
|
||||||
"@svgr/webpack": "^5.5.0",
|
"@svgr/webpack": "^5.5.0",
|
||||||
"@testing-library/jest-dom": "^5.11.9",
|
"@testing-library/jest-dom": "^5.11.9",
|
||||||
"@testing-library/react": "^11.2.3",
|
"@testing-library/react": "^11.2.5",
|
||||||
"@welldone-software/why-did-you-render": "^6.0.5",
|
"@welldone-software/why-did-you-render": "^6.0.5",
|
||||||
"babel-eslint": "^10.1.0",
|
"babel-preset-gatsby": "^0.12.1",
|
||||||
"babel-jest": "^26.5.2",
|
|
||||||
"babel-preset-gatsby": "^0.11.0",
|
|
||||||
"chalk": "^4.1.0",
|
"chalk": "^4.1.0",
|
||||||
"eslint": "^7.18.0",
|
"eslint": "^7.19.0",
|
||||||
"eslint-config-prettier": "^7.2.0",
|
"eslint-config-prettier": "^7.2.0",
|
||||||
"eslint-loader": "^4.0.2",
|
|
||||||
"eslint-plugin-graphql": "^4.0.0",
|
"eslint-plugin-graphql": "^4.0.0",
|
||||||
"eslint-plugin-prettier": "^3.3.1",
|
"eslint-plugin-prettier": "^3.3.1",
|
||||||
"eslint-plugin-react": "^7.22.0",
|
"eslint-plugin-react": "^7.22.0",
|
||||||
"eslint-plugin-react-hooks": "^4.1.2",
|
"eslint-plugin-react-hooks": "^4.2.0",
|
||||||
"eslint-plugin-testing-library": "^3.10.1",
|
"eslint-plugin-testing-library": "^3.10.1",
|
||||||
"gatsby-plugin-webpack-bundle-analyser-v2": "^1.1.20",
|
"gatsby-plugin-webpack-bundle-analyser-v2": "^1.1.20",
|
||||||
"identity-obj-proxy": "^3.0.0",
|
"identity-obj-proxy": "^3.0.0",
|
||||||
"jest": "^26.5.3",
|
"jest": "^26.6.3",
|
||||||
"jest-canvas-mock": "^2.3.0",
|
"jest-canvas-mock": "^2.3.0",
|
||||||
"js-yaml": "^4.0.0",
|
"js-yaml": "^4.0.0",
|
||||||
"ora": "^5.3.0",
|
"ora": "^5.3.0",
|
||||||
"postcss-preset-env": "^6.7.0",
|
"postcss-preset-env": "^6.7.0",
|
||||||
"prepend": "^1.0.2",
|
"prepend": "^1.0.2",
|
||||||
"prettier": "^2.2.1",
|
"prettier": "^2.2.1",
|
||||||
"slugify": "^1.4.5",
|
"slugify": "^1.4.6",
|
||||||
"stylelint": "^13.9.0",
|
"stylelint": "^13.9.0",
|
||||||
"stylelint-config-prettier": "^8.0.2",
|
"stylelint-config-prettier": "^8.0.2",
|
||||||
"stylelint-prettier": "^1.1.2"
|
"stylelint-prettier": "^1.1.2"
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { render, fireEvent, waitForElement } from '@testing-library/react'
|
import { render, fireEvent, waitForElement } from '@testing-library/react'
|
||||||
import Vcard, { constructVcard, toDataURL, init } from './Vcard'
|
import Vcard, { constructVcard, toDataURL, init } from './Vcard'
|
||||||
import meta from '../../../jest/__fixtures__/meta.json'
|
import meta from '../../../tests/__fixtures__/meta.json'
|
||||||
import resume from '../../../jest/__fixtures__/resume.json'
|
import resume from '../../../tests/__fixtures__/resume.json'
|
||||||
|
|
||||||
const metaMock = {
|
const metaMock = {
|
||||||
...meta.metaYaml,
|
...meta.metaYaml,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { render } from '@testing-library/react'
|
import { render } from '@testing-library/react'
|
||||||
import LogoUnit from './LogoUnit'
|
import LogoUnit from './LogoUnit'
|
||||||
import data from '../../../jest/__fixtures__/meta.json'
|
import data from '../../../tests/__fixtures__/meta.json'
|
||||||
|
|
||||||
describe('LogoUnit', () => {
|
describe('LogoUnit', () => {
|
||||||
it('renders correctly from data file values', () => {
|
it('renders correctly from data file values', () => {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { render } from '@testing-library/react'
|
import { render } from '@testing-library/react'
|
||||||
import Repository from './Repository'
|
import Repository from './Repository'
|
||||||
import repos from '../../../jest/__fixtures__/repos.json'
|
import repos from '../../../tests/__fixtures__/repos.json'
|
||||||
|
|
||||||
describe('Repository', () => {
|
describe('Repository', () => {
|
||||||
it('renders correctly', () => {
|
it('renders correctly', () => {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { render } from '@testing-library/react'
|
import { render } from '@testing-library/react'
|
||||||
import Repositories from './Repositories'
|
import Repositories from './Repositories'
|
||||||
import repos from '../../../jest/__fixtures__/repos.json'
|
import repos from '../../../tests/__fixtures__/repos.json'
|
||||||
|
|
||||||
describe('Repositories', () => {
|
describe('Repositories', () => {
|
||||||
it('renders correctly', () => {
|
it('renders correctly', () => {
|
||||||
|
@ -1,43 +1,42 @@
|
|||||||
import React, { Component } from 'react'
|
import React, { useEffect, useState } from 'react'
|
||||||
import PropTypes from 'prop-types'
|
|
||||||
import { Link } from 'gatsby'
|
import { Link } from 'gatsby'
|
||||||
import giphyAPI from 'giphy-js-sdk-core'
|
import { GiphyFetch } from '@giphy/js-fetch-api'
|
||||||
import SEO from '../components/atoms/SEO'
|
import SEO from '../components/atoms/SEO'
|
||||||
import Button from '../components/atoms/Button'
|
import Button from '../components/atoms/Button'
|
||||||
import styles from './404.module.css'
|
import styles from './404.module.css'
|
||||||
|
|
||||||
// Famous last words:
|
// Famous last words:
|
||||||
// "It's just the 404 page so why not expose the dev API key"
|
// "It's just the 404 page so why not expose the dev API key"
|
||||||
const giphyClient = giphyAPI('LfXRwufRyt6PK414G2kKJBv3L8NdnxyR')
|
const giphyClient = new GiphyFetch('LfXRwufRyt6PK414G2kKJBv3L8NdnxyR')
|
||||||
const tag = 'fail-cat'
|
const tag = 'cat'
|
||||||
|
|
||||||
export default class NotFound extends Component {
|
async function getRandomGif() {
|
||||||
state = { gif: '' }
|
|
||||||
|
|
||||||
static propTypes = {
|
|
||||||
location: PropTypes.object
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidMount() {
|
|
||||||
this.getRandomGif()
|
|
||||||
}
|
|
||||||
|
|
||||||
async getRandomGif() {
|
|
||||||
try {
|
try {
|
||||||
let response = await giphyClient.random('gifs', { tag })
|
let response = await giphyClient.random({ tag })
|
||||||
const gif = response.data.images.original.mp4
|
const gif = response.data.images.original.mp4
|
||||||
this.setState({ gif })
|
return gif
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return error
|
console.error(error.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleClick = (e) => {
|
export default function NotFound() {
|
||||||
|
const [gif, setGif] = useState('')
|
||||||
|
|
||||||
|
async function handleClick(e) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
this.getRandomGif()
|
const gif = await getRandomGif()
|
||||||
|
setGif(gif)
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
useEffect(() => {
|
||||||
|
async function init() {
|
||||||
|
const gif = await getRandomGif()
|
||||||
|
setGif(gif)
|
||||||
|
}
|
||||||
|
init()
|
||||||
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<SEO />
|
<SEO />
|
||||||
@ -46,19 +45,16 @@ export default class NotFound extends Component {
|
|||||||
<h1>Shenanigans, page not found.</h1>
|
<h1>Shenanigans, page not found.</h1>
|
||||||
<p>
|
<p>
|
||||||
You might want to check the url, or{' '}
|
You might want to check the url, or{' '}
|
||||||
<Link to={'/'}>go back to the homepage</Link>. Or just check out
|
<Link to={'/'}>go back to the homepage</Link>. Or just check out some{' '}
|
||||||
some {tag} gifs, entirely your choice.
|
{tag} gifs, entirely your choice.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<video className="gif" src={this.state.gif} autoPlay loop />
|
<video className="gif" src={gif} autoPlay loop />
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<Button
|
<Button onClick={handleClick}>{`Get another '${tag}' gif`}</Button>
|
||||||
onClick={this.handleClick}
|
|
||||||
>{`Get another '${tag}' gif`}</Button>
|
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { render } from '@testing-library/react'
|
import { render } from '@testing-library/react'
|
||||||
import Home from '../index'
|
import Home from '../src/pages/index'
|
||||||
import projects from '../../../jest/__fixtures__/projects.json'
|
import projects from './__fixtures__/projects.json'
|
||||||
import projectImageFiles from '../../../jest/__fixtures__/projectImageFiles.json'
|
import projectImageFiles from './__fixtures__/projectImageFiles.json'
|
||||||
|
|
||||||
describe('Home', () => {
|
describe('Home', () => {
|
||||||
const data = {
|
const data = {
|
@ -1,8 +1,8 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { render } from '@testing-library/react'
|
import { render } from '@testing-library/react'
|
||||||
import { createHistory, createMemorySource } from '@reach/router'
|
import { createHistory, createMemorySource } from '@reach/router'
|
||||||
import Project from '../{ProjectsYaml.slug}'
|
import Project from '../src/pages/{ProjectsYaml.slug}'
|
||||||
import project from '../../../jest/__fixtures__/project.json'
|
import project from './__fixtures__/project.json'
|
||||||
|
|
||||||
describe('Project', () => {
|
describe('Project', () => {
|
||||||
const history = createHistory(createMemorySource('/oceanprotocol'))
|
const history = createHistory(createMemorySource('/oceanprotocol'))
|
@ -1,12 +1,10 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
transform: {
|
rootDir: '../',
|
||||||
'^.+\\.jsx?$': '<rootDir>/jest/jest-preprocess.js'
|
|
||||||
},
|
|
||||||
moduleNameMapper: {
|
moduleNameMapper: {
|
||||||
'.+\\.(css|styl|less|sass|scss)$': 'identity-obj-proxy',
|
'.+\\.(css|styl|less|sass|scss)$': 'identity-obj-proxy',
|
||||||
'.+\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
|
'.+\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
|
||||||
'<rootDir>/jest/__mocks__/file-mock.js',
|
'<rootDir>/tests/__mocks__/file-mock.js',
|
||||||
'\\.svg': '<rootDir>/jest/__mocks__/svgr-mock.js'
|
'\\.svg': '<rootDir>/tests/__mocks__/svgr-mock.js'
|
||||||
},
|
},
|
||||||
testPathIgnorePatterns: [
|
testPathIgnorePatterns: [
|
||||||
'node_modules',
|
'node_modules',
|
||||||
@ -18,6 +16,6 @@ module.exports = {
|
|||||||
globals: {
|
globals: {
|
||||||
__PATH_PREFIX__: ''
|
__PATH_PREFIX__: ''
|
||||||
},
|
},
|
||||||
setupFiles: ['<rootDir>/jest/loadershim.js'],
|
setupFiles: ['<rootDir>/tests/loadershim.js'],
|
||||||
setupFilesAfterEnv: ['<rootDir>/jest/setup-test-env.js']
|
setupFilesAfterEnv: ['<rootDir>/tests/setup-test-env.js']
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { render } from '@testing-library/react'
|
import { render } from '@testing-library/react'
|
||||||
import Resume from '../resume'
|
import Resume from '../src/pages/resume'
|
||||||
|
|
||||||
describe('Resume', () => {
|
describe('Resume', () => {
|
||||||
it('renders correctly from data file values', () => {
|
it('renders correctly from data file values', () => {
|
Loading…
Reference in New Issue
Block a user