Skip to content

Commit

Permalink
Merge pull request #596 from gregberge/upgrade-deps
Browse files Browse the repository at this point in the history
chore: upgrade website
  • Loading branch information
gregberge committed Sep 16, 2021
2 parents f18ea80 + 9a10e0a commit aaddbd1
Show file tree
Hide file tree
Showing 59 changed files with 6,457 additions and 7,894 deletions.
3 changes: 1 addition & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ __fixtures_build__/
coverage/
examples/
svgr.now.sh/
/website/.cache/
/website/public/
/website/
Binary file modified resources/svgr-logo.sketch
Binary file not shown.
6 changes: 6 additions & 0 deletions website/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
globals: {
__PATH_PREFIX__: true,
},
extends: `react-app`,
}
8 changes: 0 additions & 8 deletions website/.eslintrc.json

This file was deleted.

1 change: 1 addition & 0 deletions website/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
14
23 changes: 15 additions & 8 deletions website/gatsby-config.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
const path = require('path')

module.exports = {
plugins: [
{
resolve: 'smooth-doc',
options: {
name: 'SVGR',
slug: 'svgr',
author: 'Greg Bergé',
description: 'Transforms SVG into React Components.',
siteUrl: 'https://react-svgr.com',
github: 'https://github.com/gregberge/svgr',
menu: ['About', 'Usage', 'Configuring SVGR', 'Advanced'],
nav: [
githubRepositoryURL: 'https://github.com/gregberge/svgr',
baseDirectory: path.resolve(__dirname, '..'),
navItems: [
{ title: 'Playground', url: '/playground/' },
{ title: 'Usage', url: '/docs/getting-started/' },
{ title: 'Docs', url: '/docs/' },
],
carbonAdUrl:
sections: ['About', 'Usage', 'Configuring SVGR', 'Advanced'],
carbonAdsURL:
'//cdn.carbonads.com/carbon.js?serve=CE7I5K3N&placement=react-svgrcom',
googleAnalytics: 'UA-154496255-2',
algoliaDocSearch: {
docSearch: {
apiKey: '0c7343afd83c189413499c62c1df6853',
indexName: 'smooth-code-svgr',
},
},
},
{
resolve: `gatsby-plugin-google-analytics`,
options: {
trackingId: 'UA-154496255-2',
},
},
],
}
7 changes: 0 additions & 7 deletions website/gatsby-node.js

This file was deleted.

File renamed without changes
File renamed without changes
Binary file added website/images/logo-manifest.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions website/images/logo-nav-dark.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions website/images/logo-nav-light.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
33 changes: 15 additions & 18 deletions website/package.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
{
"private": true,
"dependencies": {
"@smooth-ui/core-sc": "^11.1.5",
"@xstyled/styled-components": "^1.17.1",
"@xstyled/styled-components": "^3.0.3",
"brace": "^0.11.1",
"final-form": "^4.20.1",
"gatsby": "^2.24.2",
"history": "^5.0.0",
"isomorphic-fetch": "^2.2.1",
"polished": "^3.6.5",
"prismjs": "^1.20.0",
"prop-types": "^15.7.2",
"react": "^16.13.1",
"react-ace": "^9.1.1",
"react-dom": "^16.13.1",
"react-final-form": "^6.5.0",
"react-helmet": "^6.1.0",
"react-icons": "^3.10.0",
"reakit": "^1.0.0-beta.14",
"smooth-doc": "^4.0.3",
"styled-components": "^5.1.1"
"final-form": "^4.20.2",
"gatsby": "^3.13.0",
"gatsby-plugin-google-analytics": "^3.13.0",
"history": "^5.0.1",
"isomorphic-fetch": "^3.0.0",
"react": "^17.0.2",
"react-ace": "^9.4.3",
"react-dom": "^17.0.2",
"react-final-form": "^6.5.3",
"react-icons": "^4.2.0",
"smooth-doc": "^8.0.0"
},
"scripts": {
"build": "gatsby build && cp _redirects public/",
"dev": "gatsby develop",
"serve": "gatsby serve"
},
"devDependencies": {
"eslint-config-react-app": "^6.0.0"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
menu: Usage
section: Usage
title: CLI
order: 10
---
Expand All @@ -8,6 +8,8 @@ order: 10

SVGR can be run from the CLI. Run it without argument to see the [options](/docs/options).

<carbon-ad />

## Install

```bash
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
menu: Configuring SVGR
section: Configuring SVGR
title: Configuration Files
order: 20
---
Expand All @@ -8,6 +8,8 @@ order: 20

SVGR supports project configuration files for SVGR, SVGO and Prettier.

<carbon-ad />

## SVGR

SVGR uses [cosmiconfig](https://github.com/davidtheclark/cosmiconfig) for configuration file support. This means you can configure SVGR via:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
menu: Advanced
section: Advanced
title: Custom Templates
order: 6
---
Expand All @@ -8,6 +8,8 @@ order: 6

Custom templates give you the opportunity to personalize the final generated component by SVGR. In most of case you don't need it, only advanced use-cases require templates.

<carbon-ad />

## Custom Component template

A custom template takes place in a file that exports a "template function".
Expand Down Expand Up @@ -116,7 +118,7 @@ The customization is the same, a file that exports a function:
const path = require('path')

function defaultIndexTemplate(filePaths) {
const exportEntries = filePaths.map(filePath => {
const exportEntries = filePaths.map((filePath) => {
const basename = path.basename(filePath, path.extname(filePath))
const exportName = /^\d/.test(basename) ? `Svg${basename}` : basename
return `export { default as ${exportName} } from './${basename}'`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
menu: Advanced
section: Advanced
title: Custom transformations
order: 10
---
Expand All @@ -8,6 +8,8 @@ order: 10

SVGR exposes a simple API but it is extendable, you can extend it to create complex SVG transformations.

<carbon-ad />

## Install

```bash
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
menu: About
section: About
title: Ecosystem
order: 30
---
Expand All @@ -8,6 +8,8 @@ order: 30

This is an incomplete list of awesome things built with svgr. If you have something to share, please submit a PR on [GitHub project](https://github.com/gregberge/svgr).

<carbon-ad />

## SVGR inside ✨

- [Create React App](https://facebook.github.io/create-react-app/)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
menu: Usage
section: Usage
title: Getting Started
order: 5
---
Expand All @@ -8,6 +8,8 @@ order: 5

Follow these steps to start with SVGR.

<carbon-ad />

**Take an icon.svg**:

```html
Expand Down Expand Up @@ -55,7 +57,7 @@ npx @svgr/cli --icon --replace-attr-values "#063855=currentColor" icon.svg
```js
import * as React from 'react'

const SvgComponent = props => (
const SvgComponent = (props) => (
<svg width="1em" height="1em" viewBox="0 0 48 1" {...props}>
<path d="M0 0h48v1H0z" fill="currentColor" fillRule="evenodd" />
</svg>
Expand Down
4 changes: 4 additions & 0 deletions website/pages/docs/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
slug: /docs/
redirect: /docs/getting-started/
---
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
menu: Advanced
section: Advanced
title: Testing with Jest
order: 4
---
Expand All @@ -8,6 +8,8 @@ order: 4

Create a simple mock for the svgr loader and map this in the jest config:

<carbon-ad />

## 1. Create a mock file

Create a mock file `__mocks__/svgrMock.js`:
Expand All @@ -20,13 +22,13 @@ export const ReactComponent = 'div'
```

The above mock would support the following import syntaxes:

```js
import logoURL from '../assets/logo.svg'
// and
import { ReactComponent as Logo } from '../assets/logo.svg'
```


## 2. Configure Jest

In your `package.json`
Expand All @@ -46,7 +48,7 @@ module.exports = {
moduleNameMapper: {
'\\.svg$': '<rootDir>/__mocks__/svgrMock.js',
},
};
}
```

Your snapshots will include all properties on the icon components, so they will be tested.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
menu: About
section: About
title: Motivation
order: 10
---
Expand All @@ -10,6 +10,8 @@ React supports SVG out of the box, it's simpler, easier and much more powerful
to have components instead of SVG files. Wrapped in a React component, your SVG
is inlined in the page and you can style it using CSS.

<carbon-ad />

SVGR differs from other library by its solid architecture. It uses [svg-parser](https://github.com/Rich-Harris/svg-parser) + [Babel](https://babeljs.io) to transform SVG code into JavaScript code.

SVGR is included in [create-react-app v2](https://github.com/facebook/create-react-app) and gives you the power to [import SVG directly as a React component](https://facebook.github.io/create-react-app/docs/adding-images-fonts-and-files#adding-svgs).
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
menu: Usage
section: Usage
title: Node API
order: 20
---
Expand All @@ -8,6 +8,8 @@ order: 20

SVGR exposes a Node API, you can create a custom script or build another tool based on SVGR.

<carbon-ad />

## Install

```bash
Expand All @@ -29,9 +31,11 @@ const svgCode = `
</svg>
`

svgr(svgCode, { icon: true }, { componentName: 'MyComponent' }).then(jsCode => {
console.log(jsCode)
})
svgr(svgCode, { icon: true }, { componentName: 'MyComponent' }).then(
(jsCode) => {
console.log(jsCode)
},
)
```

Use `svgr.sync(code, config, state)` if you would like to use sync version.
Expand All @@ -43,7 +47,7 @@ By default `@svgr/core` doesn't include `svgo` and `prettier` plugins, if you wa
```js
svgr(svgCode, {
plugins: ['@svgr/plugin-svgo', '@svgr/plugin-jsx', '@svgr/plugin-prettier'],
}).then(jsCode => {
}).then((jsCode) => {
console.log(jsCode)
})
```
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
menu: Configuring SVGR
section: Configuring SVGR
title: Options
order: 10
---
Expand All @@ -9,6 +9,8 @@ order: 10
SVGR ships with a handful of customizable options, usable in both the CLI and
API.

<carbon-ad />

## Config file

Specify a custom config file.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
menu: Usage
section: Usage
title: Parcel
order: 45
---
Expand All @@ -8,6 +8,8 @@ order: 45

SVGR can be used as a [parcel](https://parceljs.org/) plugin, this way you can import your SVG directly as a React Component.

<carbon-ad />

## Install

```bash
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
menu: Usage
section: Usage
title: Rollup
order: 40
---
Expand All @@ -8,6 +8,8 @@ order: 40

SVGR can be used as a [rollup](https://rollupjs.org) plugin, this way you can import your SVG directly as a React Component.

<carbon-ad />

## Install

```bash
Expand Down

1 comment on commit aaddbd1

@vercel
Copy link

@vercel vercel bot commented on aaddbd1 Sep 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.