Skip to content

Commit

Permalink
Merge pull request #6 from South-Paw/3.0.0
Browse files Browse the repository at this point in the history
Update starter
  • Loading branch information
South-Paw authored Jun 19, 2020
2 parents a9ace6f + 3f29382 commit 0b9971b
Show file tree
Hide file tree
Showing 46 changed files with 7,720 additions and 5,310 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
.git
node_modules
public
build
coverage
12 changes: 12 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"root": true,
"parser": "babel-eslint",
"extends": ["airbnb", "plugin:prettier/recommended", "plugin:jest/recommended"],
"rules": {
"import/prefer-default-export": "off",
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
"react/jsx-props-no-spreading": "off",
"react/jsx-one-expression-per-line": "off"
},
"overrides": []
}
42 changes: 0 additions & 42 deletions .eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
.git
node_modules
public
build
coverage
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"endOfLine": "lf",
"printWidth": 120,
"singleQuote": true,
"trailingComma": "all"
}
6 changes: 0 additions & 6 deletions .prettierrc.js

This file was deleted.

5 changes: 0 additions & 5 deletions .storybook/GlobalStyleDecorator.js

This file was deleted.

2 changes: 0 additions & 2 deletions .storybook/addons.js

This file was deleted.

31 changes: 0 additions & 31 deletions .storybook/config.js

This file was deleted.

29 changes: 29 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module.exports = {
stories: ['../src/**/*.stories.js'],
addons: ['@storybook/addon-actions', '@storybook/addon-links', '@storybook/addon-docs'],
webpackFinal: async (config) => {
// Transpile Gatsby module because Gatsby includes un-transpiled ES6 code.
config.module.rules[0].exclude = [/node_modules\/(?!(gatsby)\/)/];

// use installed babel-loader which is v8.0-beta (which is meant to work with @babel/core@7)
config.module.rules[0].use[0].loader = require.resolve('babel-loader');

// use @babel/preset-react for JSX and env (instead of staged presets)
config.module.rules[0].use[0].options.presets = [
require.resolve('@babel/preset-react'),
require.resolve('@babel/preset-env'),
];

config.module.rules[0].use[0].options.plugins = [
// use @babel/plugin-proposal-class-properties for class arrow functions
require.resolve('@babel/plugin-proposal-class-properties'),
// use babel-plugin-remove-graphql-queries to remove static queries from components when rendering in storybook
require.resolve('babel-plugin-remove-graphql-queries'),
];

// Prefer Gatsby ES6 entrypoint (module) over commonjs (main) entrypoint
config.resolve.mainFields = ['browser', 'module', 'main'];

return config;
},
};
25 changes: 25 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { action } from '@storybook/addon-actions';
import { addDecorator } from '@storybook/react';
import * as React from 'react';
import { Theme } from '../src/components/Theme';

addDecorator((storyFn) => <Theme>{storyFn()}</Theme>);

// Gatsby's Link overrides:
// Gatsby Link calls the `enqueue` & `hovering` methods on the global variable ___loader.
// This global object isn't set in storybook context, requiring you to override it to empty functions (no-op),
// so Gatsby Link doesn't throw any errors.
global.___loader = {
enqueue: () => {},
hovering: () => {},
};

// __PATH_PREFIX__ and __BASE_PATH__ are used inside gatsby-link an other various places. For storybook not to crash, you need to set it as well.
global.__PATH_PREFIX__ = '';
global.__BASE_PATH__ = '';

// Navigating through a gatsby app using gatsby-link or any other gatsby component will use the `___navigate` method.
// In Storybook it makes more sense to log an action than doing an actual navigate. Checkout the actions addon docs for more info: https://github.com/storybookjs/storybook/tree/master/addons/actions.
window.___navigate = (pathname) => {
action('NavigateTo:')(pathname);
};
52 changes: 0 additions & 52 deletions .storybook/webpack.config.js

This file was deleted.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# awesome-gatsby-starter
# @south-paw/awesome-gatsby-starter

👌 A starter for GatsbyJS with a preconfigured MDX, Storybook and ESLint environment

[![Netlify Status][netlify-master-status-img]][netlify-master-status]
[![Dependencies](https://david-dm.org/South-Paw/awesome-gatsby-starter/status.svg)](https://david-dm.org/South-Paw/awesome-gatsby-starter)
[![Dev Dependencies](https://david-dm.org/South-Paw/awesome-gatsby-starter/dev-status.svg)](https://david-dm.org/South-Paw/awesome-gatsby-starter?type=dev)

> Prefer TypeScript? No worries, try [awesome-gatsby-starter-ts](https://github.com/South-Paw/awesome-gatsby-starter-ts)
## Features

Expand Down
6 changes: 3 additions & 3 deletions gatsby-config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module.exports = {
siteMetadata: {
name: 'Awesome Gatsby Starter',
basepath: 'https://awesome-gatsby-starter.netlify.com',
basepath: 'https://awesome-gatsby-starter.netlify.app',
description: 'A starter for GatsbyJS with a preconfigured MDX, Storybook and ESLint environment',
keywords: ['gatsby', 'gatsbyjs', 'gatsby starter', 'github'],
type: 'website',
image: 'https://awesome-gatsby-starter.netlify.com/ok.png',
image: 'https://awesome-gatsby-starter.netlify.app/ok.png',
},
plugins: [
'gatsby-plugin-react-helmet',
Expand All @@ -22,7 +22,7 @@ module.exports = {
options: {
extensions: ['.mdx', '.md'],
defaultLayouts: {
pages: require.resolve('./src/templates/Page/index.js'),
pages: require.resolve('./src/templates/Page.js'),
},
},
},
Expand Down
80 changes: 40 additions & 40 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "awesome-gatsby-starter",
"version": "2.0.0",
"name": "@south-paw/awesome-gatsby-starter",
"version": "3.0.0",
"description": "A starter for GatsbyJS with a preconfigured MDX, Storybook and ESLint environment",
"keywords": [
"gatsby",
Expand Down Expand Up @@ -28,46 +28,46 @@
"serve": "gatsby serve"
},
"dependencies": {
"@mdx-js/mdx": "^1.5.1",
"@mdx-js/react": "^1.5.1",
"gatsby": "^2.17.11",
"gatsby-image": "^2.2.31",
"gatsby-plugin-manifest": "^2.2.27",
"gatsby-plugin-mdx": "^1.0.56",
"gatsby-plugin-offline": "^3.0.19",
"gatsby-plugin-react-helmet": "^3.1.14",
"gatsby-plugin-sharp": "^2.2.37",
"gatsby-plugin-styled-components": "^3.1.12",
"gatsby-source-filesystem": "^2.1.36",
"gatsby-transformer-sharp": "^2.3.3",
"polished": "^3.4.2",
"@mdx-js/mdx": "^1.6.6",
"@mdx-js/react": "^1.6.6",
"gatsby": "^2.23.4",
"gatsby-image": "^2.4.7",
"gatsby-plugin-manifest": "^2.4.11",
"gatsby-plugin-mdx": "^1.2.15",
"gatsby-plugin-offline": "^3.2.10",
"gatsby-plugin-react-helmet": "^3.3.4",
"gatsby-plugin-sharp": "^2.6.11",
"gatsby-plugin-styled-components": "^3.3.4",
"gatsby-source-filesystem": "^2.3.11",
"gatsby-transformer-sharp": "^2.5.5",
"polished": "^3.6.5",
"prop-types": "^15.7.2",
"react": "^16.11.0",
"react-dom": "^16.11.0",
"react-helmet": "^5.2.1",
"react-uid": "^2.2.0",
"styled-components": "^4.4.1",
"styled-normalize": "^8.0.6"
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-helmet": "^6.1.0",
"react-uid": "^2.3.0",
"styled-components": "^5.1.1",
"styled-normalize": "^8.0.7"
},
"devDependencies": {
"@babel/core": "^7.7.2",
"@storybook/addon-actions": "^5.2.6",
"@storybook/addon-docs": "^5.2.6",
"@storybook/react": "^5.2.6",
"babel-eslint": "^10.0.3",
"babel-loader": "^8.0.6",
"cross-env": "^6.0.3",
"eslint": "^6.6.0",
"eslint-config-airbnb": "^18.0.1",
"eslint-config-prettier": "^6.5.0",
"eslint-plugin-compat": "^3.3.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jest": "^23.0.3",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-prefer-object-spread": "^1.2.1",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-react": "^7.16.0",
"prettier": "^1.19.1",
"react-markdown": "^4.2.2"
"@babel/core": "^7.10.2",
"@storybook/addon-actions": "^6.0.0-beta.31",
"@storybook/addon-docs": "^6.0.0-beta.31",
"@storybook/addon-links": "^6.0.0-beta.31",
"@storybook/react": "^6.0.0-beta.31",
"babel-eslint": "^10.1.0",
"cross-env": "^7.0.2",
"eslint": "^7.2.0",
"eslint-config-airbnb": "^18.2.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.21.2",
"eslint-plugin-jest": "^23.13.2",
"eslint-plugin-jsx-a11y": "^6.3.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.20.0",
"eslint-plugin-react-hooks": "^4.0.4",
"prettier": "^2.0.5",
"react-is": "^16.13.1",
"rimraf": "^3.0.2"
}
}
9 changes: 9 additions & 0 deletions src/components/Button/Button.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react';
import { Button } from '.';

export default {
title: 'Button',
component: Button,
};

export const Simple = () => <Button>button</Button>;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import styled from 'styled-components';

export const StyledButton = styled.button`
const Button = styled('button')`
padding: 4px 12px;
margin: 0;
background: none;
Expand All @@ -22,3 +22,9 @@ export const StyledButton = styled.button`
background-color: #663399;
}
`;

Button.defaultProps = {
type: 'button',
};

export { Button };
Loading

0 comments on commit 0b9971b

Please sign in to comment.