Skip to content

Commit

Permalink
Merge e9ed2b6 into d19099a
Browse files Browse the repository at this point in the history
  • Loading branch information
julienben committed Jul 12, 2020
2 parents d19099a + e9ed2b6 commit 823cb0d
Show file tree
Hide file tree
Showing 185 changed files with 11,049 additions and 8,885 deletions.
10 changes: 10 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,16 @@
"contributions": [
"code"
]
},
{
"login": "Can-Sahin",
"name": "Can Sahin",
"avatar_url": "https://avatars2.githubusercontent.com/u/33245689?v=4",
"profile": "https://github.com/Can-Sahin",
"contributions": [
"code",
"doc",
]
}
],
"contributorsPerLine": 8
Expand Down
10 changes: 9 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ module.exports = {
'import/imports-first': 0,
'import/newline-after-import': 0,
'import/no-dynamic-require': 0,
'import/no-extraneous-dependencies': 0,
'import/no-named-as-default': 0,
'import/no-unresolved': 2,
'import/no-webpack-loader-syntax': 0,
Expand Down Expand Up @@ -69,6 +68,7 @@ module.exports = {
'react/forbid-prop-types': 0,
'react/jsx-first-prop-new-line': [2, 'multiline'],
'react/jsx-filename-extension': 0,
'react/jsx-props-no-spreading': 0,
'react/jsx-no-target-blank': 0,
'react/jsx-uses-vars': 2,
'react/require-default-props': 0,
Expand All @@ -79,6 +79,14 @@ module.exports = {
'redux-saga/yield-effects': 2,
'require-yield': 0,
},
overrides: [
{
files: ['internals/**/*.*', 'server/**/*.*'],
rules: {
'import/no-extraneous-dependencies': 0,
},
},
],
settings: {
'import/resolver': {
webpack: {
Expand Down
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Global owners
* @julienben @gretzky @justingreenberg @jwinn @Mensae
4 changes: 4 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# These are supported funding model platforms

github: [julienben, gretzky]
open_collective: react-boilerplate
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
---
name: Bug report
about: Create a report to help us improve

---

Before opening a new issue, please take a moment to review our [**community guidelines**](https://github.com/react-boilerplate/react-boilerplate/blob/master/CONTRIBUTING.md) to make the contribution process easy and effective for everyone involved.

## Description

A clear and concise description of what the bug is.

## Steps to reproduce

Steps to reproduce the behavior:

(Add link to a demo on https://jsfiddle.net or similar if possible)
Expand Down
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
name: Feature request
about: Suggest an idea for this project

---

**Is your feature request related to a problem? Please describe.**
Expand Down
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on something that might not end up being merged into the project.
Before opening a pull request, please ensure:

- [ ] You have followed our [**contributing guidelines**](https://github.com/react-boilerplate/react-boilerplate/blob/master/CONTRIBUTING.md)
- [ ] Double-check your branch is based on `dev` and targets `dev`
- [ ] Double-check your branch is based on `dev` and targets `dev`
- [ ] Pull request has tests (we are going for 100% coverage!)
- [ ] Code is well-commented, linted and follows project conventions
- [ ] Documentation is updated (if necessary)
Expand Down
23 changes: 14 additions & 9 deletions .github/issue-close-app.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
comment: This issue was automatically closed because it does not follow either one of our templates. Please open a new issue and fill out the template that appears instead of deleting it. If you're reporting an issue, it's especially important that you provide detailed steps for how to reproduce it.
comment: "This issue was automatically closed because it does not follow either one of react-boilerplate's templates.
issueConfigs:
If your issue is indeed a bug report or a feature request, please open a new issue and fill out the relevant template instead of deleting it.
If you're reporting a bug, it's especially important that you provide detailed steps for how to reproduce it.
Please note that requests for help should go to [our Spectrum channel](https://spectrum.chat/react-boilerplate?tab=posts)."

issueConfigs:
- content:
- Description
- Steps to reproduce
- Versions
- Description
- Steps to reproduce
- Versions

- content:
- Is your feature request related to a problem
- Describe the solution you'd like
- Describe alternatives you've considered
- Additional context
- Is your feature request related to a problem
- Describe the solution you'd like
- Describe alternatives you've considered
- Additional context
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
save-exact = true
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ node_js:
- 'node'
- 'lts/*'

services:
- xvfb

script:
- node ./internals/scripts/generate-templates-for-linting
- npm test -- --maxWorkers=4
Expand All @@ -12,7 +15,6 @@ script:
before_install:
- export CHROME_BIN=chromium-browser
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start

notifications:
email:
Expand Down
20 changes: 10 additions & 10 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ appearance, race, religion, or sexual identity and orientation.
Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
- The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities
Expand Down
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ experience the problem? What would you expect to be the outcome? All these detai
Example:

> ## Description
>
> A clear and concise description of what the bug is.
>
> Any other information you want to share that is relevant to the issue being
Expand All @@ -43,6 +44,7 @@ Example:
> merits).
>
> ## Steps to reproduce
>
> Steps to reproduce the behavior:
>
> 1. This is the first step
Expand Down
2 changes: 1 addition & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ We hope you enjoy this release and welcome any feedback, bug reports or feature
- Fix setup script for Windows environments (**@mensae**)
- Generate passing tests for components/containers (**@mjhost**)
- Rewrite generators code (**@mensae**)
- Complete rewrite or `generate-templates-for-linting.js` (**@mensae**)
- Complete rewrite of `generate-templates-for-linting.js` (**@mensae**)
- `webpack.DefinePlugin` => `webpack.EnvironmentPlugin` (**@nshimiye**)
- New Webpack code splitting config (**@julienben**)
- Remove `process.noDeprecation = true` (**@spawnia**)
Expand Down
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ But wait... there's more!
- _Catch problems:_ AppVeyor and TravisCI setups included by default, so your
tests get run automatically on Windows and Unix.

There’s also a <a href="https://vimeo.com/168648012">fantastic video</a> on how to structure your React.js apps with scalability in mind. It provides rationale for the majority of boilerplate's design decisions.
There’s also a <a href="https://vimeo.com/168648012">fantastic video</a> on how to structure your React apps with scalability in mind. It provides rationale for the majority of boilerplate's design decisions.

<sub><i>Keywords: React.js, Redux, Hot Reloading, ESNext, Babel, react-router, Offline First, ServiceWorker, `styled-components`, redux-saga, FontFaceObserver</i></sub>

Expand Down Expand Up @@ -122,9 +122,18 @@ Now you're ready to rumble!
asynchronicity helpers, etc.
- [**Troubleshooting**](docs/general/gotchas.md): Solutions to common problems faced by developers.

## Ongoing Work

In between [releases](https://github.com/react-boilerplate/react-boilerplate/releases), we work on the `dev` branch and rarely ever update `master`. For that reason, it sometimes look like the repo isn't actively maintained. This isn't the case, React Boilerplate is alive and kicking.

Please feel free to check out:

- our [`dev` branch](https://github.com/react-boilerplate/react-boilerplate/tree/dev) for the latest updates. You are always welcome to use it as the basis for your project. We only merge to `dev` projects which are fully ready.
- our open [issues](https://github.com/react-boilerplate/react-boilerplate/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc) and [pull requests](https://github.com/react-boilerplate/react-boilerplate/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc) to see what we are currently working on. Suggestions and contributions are always welcome!

## Contributors

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
Thanks go to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore -->
Expand All @@ -134,7 +143,6 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!


## Supporters

This project would not be possible without the support of these amazing folks. [**Become a sponsor**](https://opencollective.com/react-boilerplate) to get your company in front of thousands of engaged react developers and help us out!
Expand Down
4 changes: 2 additions & 2 deletions app/.nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ server {
# To let nginx use its own DNS Resolver
# resolver <IP DNS resolver>;

# Set path
root /var/www/;

# Always serve index.html for any request
location / {
# Set path
root /var/www/;
try_files $uri /index.html;
}

Expand Down
40 changes: 24 additions & 16 deletions app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
* code.
*/

// Needed for redux-saga es6 generator support
import '@babel/polyfill';
import 'react-app-polyfill/ie11';
import 'react-app-polyfill/stable';

// Import all the third party stuff
import React from 'react';
import ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
import { Provider } from 'react-redux';
import { ConnectedRouter } from 'connected-react-router';
import FontFaceObserver from 'fontfaceobserver';
Expand All @@ -25,8 +25,9 @@ import LanguageProvider from 'containers/LanguageProvider';

// Load the favicon and the .htaccess file
import '!file-loader?name=[name].[ext]!./images/favicon.ico';
import 'file-loader?name=.htaccess!./.htaccess'; // eslint-disable-line import/extensions
import 'file-loader?name=.htaccess!./.htaccess';

import { HelmetProvider } from 'react-helmet-async';
import configureStore from './configureStore';

// Import i18n messages
Expand All @@ -46,24 +47,31 @@ const initialState = {};
const store = configureStore(initialState, history);
const MOUNT_NODE = document.getElementById('app');

const render = messages => {
ReactDOM.render(
<Provider store={store}>
<LanguageProvider messages={messages}>
<ConnectedRouter history={history}>
const ConnectedApp = props => (
<Provider store={store}>
<LanguageProvider messages={props.messages}>
<ConnectedRouter history={history}>
<HelmetProvider>
<App />
</ConnectedRouter>
</LanguageProvider>
</Provider>,
MOUNT_NODE,
);
</HelmetProvider>
</ConnectedRouter>
</LanguageProvider>
</Provider>
);

ConnectedApp.propTypes = {
messages: PropTypes.object,
};

const render = messages => {
ReactDOM.render(<ConnectedApp messages={messages} />, MOUNT_NODE);
};

if (module.hot) {
// Hot reloadable React components and translation json files
// Hot reloadable translation json files
// modules.hot.accept does not accept dynamic dependencies,
// have to be constants at compile-time
module.hot.accept(['./i18n', 'containers/App'], () => {
module.hot.accept(['./i18n'], () => {
ReactDOM.unmountComponentAtNode(MOUNT_NODE);
render(translationMessages);
});
Expand Down
33 changes: 18 additions & 15 deletions app/components/A/tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,53 @@
*/

import React from 'react';
import { render } from 'react-testing-library';
import { render } from '@testing-library/react';

import A from '../index';

const href = 'http://mxstbr.com/';
const children = <h1>Test</h1>;
const renderComponent = (props = {}) =>
render(
const renderComponent = (props = {}) => {
const utils = render(
<A href={href} {...props}>
{children}
</A>,
);
const link = utils.container.querySelector('a');
return { ...utils, link };
};

describe('<A />', () => {
it('should render an <a> tag', () => {
const { container } = renderComponent();
expect(container.querySelector('a')).not.toBeNull();
const { link } = renderComponent();
expect(link).toBeInTheDocument();
});

it('should have an href attribute', () => {
const { container } = renderComponent();
expect(container.querySelector('a').href).toEqual(href);
const { link } = renderComponent();
expect(link).toHaveAttribute('href', href);
});

it('should have children', () => {
const { container } = renderComponent();
expect(container.querySelector('a').children).toHaveLength(1);
const { link } = renderComponent();
expect(link.children).toHaveLength(1);
});

it('should have a class attribute', () => {
const className = 'test';
const { container } = renderComponent({ className });
expect(container.querySelector('a').classList).toContain(className);
const { link } = renderComponent({ className });
expect(link).toHaveClass(className);
});

it('should adopt a target attribute', () => {
const target = '_blank';
const { container } = renderComponent({ target });
expect(container.querySelector('a').target).toEqual(target);
const { link } = renderComponent({ target });
expect(link).toHaveAttribute('target', target);
});

it('should adopt a type attribute', () => {
const type = 'text/html';
const { container } = renderComponent({ type });
expect(container.querySelector('a').type).toEqual(type);
const { link } = renderComponent({ type });
expect(link).toHaveAttribute('type', type);
});
});

0 comments on commit 823cb0d

Please sign in to comment.