Skip to content

Commit

Permalink
Chore/fix dependency issues (#22)
Browse files Browse the repository at this point in the history
* Typo sever->server

* Update npm modules

* Use babel-preset-node5 for npm scripts

- move `.babelrc` config to `package.json`
- enable `babel-loader` cache
- add [`resolve.root`](https://webpack.github.io/docs/configuration.html#resolve-root) option
- add [`context`](https://webpack.github.io/docs/configuration.html#context) to common config
- add `target` to client's config for consistency
- reorder options in accordance with [configuration docs](https://webpack.github.io/docs/configuration.html)
- update file formatting
- add more comments

* Improve long term caching by adding [chunkhash]

- Use `[chunkhash]` instead of `[hash]` in the names of bundles, it allows to save the bundle name if the content hasn't changed
- Deduplicate assets, use the same `output.path` for files, fix #362
- Use `path.resolve` everywhere in webpack config for consistency
- Use `OccurrenceOrderPlugin` in debug mode too for [hot reload needs](https://github.com/glenjamin/webpack-hot-middleware#installation--usage)
- Move generated (compiled) files from `public` to `public/assets` to not be mixed with other files like static html

* Move .eslintrc and .jscsrc in package.json to simplify directory layout

- .eslintrc -> package.json/eslintConfig ([ref](http://eslint.org/docs/user-guide/configuring#configuration-file-formats))
- .jscsrc -> package.json/jscsConfig ([ref](http://jscs.info/overview#-config-c))
- .babelrc -> package.json/babel ([ref](https://babeljs.io/docs/usage/babelrc/#use-via-package-json))

* Replace csscomb with stylelint

See [stylelint](https://github.com/stylelint/stylelint) and [stylelint-config-standard](https://github.com/stylelint/stylelint-config-standard)

- Update styles with new validation rules
- Remove unused `TextBox` component

* Add stylelint info to editor config doc

* Remove preprocessor.js from readme

This file has been removed in #484

* [AWS][EC2] Error: Cannot find module 'core-js/library/fn/get-iterator #505

* Adding core-js to unmockedModulePathPatterns

* Combining NotFoundPage into ErrorPage component, minor error CSS change for smaller media query

* Update tools/copy.js to clean up package.json before copying

* Adds a hint for a problem with autoreloading when Webstorm "safe write" feature is enabled

Autoreload functionality is not picking up file changes when Webstorm "safe write" feature is enabled

* Update npm modules

* Update tools/run.js to print options if present

* Introduce Sequelize as ORM. Facebook login works as espected.

* Remove redundant commas in SQL statement

* Update CHANGELOG.md

* [Babel] Improve the production build

* clean config.entry

This accomplishes the same thing, with fewer lines of code

* Correcting Typo

Found a small typo, corrected for you.

* Update routing library and the list of routes

* Update client.js, remove scrollTo behavior after the initial rendering

* Update npm modules: graphql, pg, styleint

* Rename the "server" variable to "app" in "src/server.js"

* Add Backers section to README.md

* Update Backers section in README.md

* chore(package): update express-graphql to version 0.5.1

http://greenkeeper.io/

* chore(package): update bluebird to version 3.3.5

http://greenkeeper.io/

* Renamed 'core/Location' to 'core/history'

npm history module v2.0.2

* removeLocationListener -> removeHistoryListener

* Update npm modules; replace Jest with Mocha

* Add missing dependencies - mocha and sinon

* Update .travis.yml (#577)

* Add missing peer dependencies - babe-core...

Add babel-core, babel-template and babel-types required by babel-plugin-rewire; remove estraverse-fb which is no longer in use

Fixes #581

* Fix ESLint: Local variable 'smth' is redundant (#589)

* Fix: AccessToken from facebook saved as String (#590)

* Update npm modules

* Fixes #614

* [fix] linter error

* Updated docs

Closes #623
Closes #612
Closes #610
Closes #595
Closes #173

Many thanks to @tobiasmuehl and @tomByrer and @bravo_kernel for reviewing.

* Add --static flag to build script which allows to generate static html for specific routes (#642)

* Update test scripts to fix an issue with glob arguments (#656)

- Add quotes to mocha glob
- Change watcher to extend from the regular test call

* Update npm modules; fix ESLint warnings; remove JSCS

* Add support for plain CSS (.css) files (#662)

* Update npm modules; tweak Stylelint settings

* Change db string length (#691)

* Update history module to v3 (#692)

- Update `history` dependency to v3.0.0 ([changelog](https://github.com/ReactJSTraining/history/blob/master/CHANGES.md))
- Add `windowScrollX` and `windowScrollY` helpers to `core/DOMUtils`
- Rename `match()` to `UniversalRouter.resolve()`
- Fix scroll issues ([see article](https://developers.google.com/web/updates/2015/09/history-api-scroll-restoration))

* fix(Isomorphic Style Loader): Add support to load multiple styles (#678)

* fix(Isomorphic Style Loader): Add support to load multiple styles

* fix(Isomorphic Style Loader): Add remove feature back

* Adds testing section (#687)

Integrates comments by @langpavel

* Fix npm warnings about graphql dependencies (#693)

fixes #661

* Fix OccurrenceOrderPlugin spelling (#683)

* fixed typo in passport.js (#696)

* Docs: use more expressive language (#701)

* Update stylelint-config-standard (#707)

* Update stylelint-config-standard

When I run 'npm run lint', this warning show up:

Deprecation Warning: 'number-zero-length-no-unit' has been deprecated, and will be removed in '7.0'. Use 'length-zero-no-unit' instead. See: http://stylelint.io/user-guide/rules/length-zero-no-unit/

update package to remove it.

* Update stylelint

to use length-zero-no-unit instead number-zero-length-no-unit.

* Fix spelling of "vice versa" (#710)

* Remove jade dependency

* Update react-style-guide.md (#718)

replace ../Nav with ../Navigation

* Update CHANGELOG.md

* Add boilerplate comparison table to README.md

...also add links explaining "isomorphic" and "single-page" apps. Closes #740

* Update tools/run.js to check if files are run directly from Node.js (#747)

* Update tools/run.js to check if files are run directly from Node.js

* Revert eslint rule comment

* Remove view folder from project structure (#743)

As jade is no longer used [#711](kriasoft/react-starter-kit#711), view folder is not present in src. Updating getting started doc for this change.

* Detect server exit while cb is pending, proper status code on cli-run failure (#742)

* Detect server exit while cb is pending, proper status code on cli-run failure

* Complying with linting from the 70s

* Allow callers of run to get resolution value

* Fix a broken link in README.md (#750)

* Update how-to-implement-routing.md

Deprecate the current descriptions, and sketch out how to use universal-router

* Update how-to-implement-routing.md

Add link to "You might not need React Router"

* Fix not updating title when navigating between two content pages (#758)

* Add comment for routes

* Fix webpack configuration, server side code splitting (#774)

* Update README.md

Add feature/bootstrap to Customization section

* Dont include same stule multiple times . Fix #780 (#781)

* Added postcss-flexbugs-fixes plugin... (#795)

* Add scrolling to element during navigation for links with hash

closes #812

* Remove outdated reference to react-routing from webpack config (#829)

fixes #770

* Update dependencies: Babel 6.14, React 15.3, ESLint 3 (#831)

* Update README.md

* Update postcss-selector-matches up to 2.0.3 (#835)

> ### [2.0.3 - 2016-09-06](https://github.com/postcss/postcss-selector-matches/blob/master/CHANGELOG.md)
> Fixed: regression of 2.0.2 due to a transpilation upgrade (@MoOx)

fixes #834

* Clean up eslint rules and update airbnb config (#842)

* Improve flexibility of routing logic (#849)

* It should be emailConfirmed instead of emailVerified. (#857)

* Update WebStorm CSSComb instructions. (#872)

It looks like the CSSComb author now prefers that WebStorm users simply use CSSComb as an external tool.

* Introduce the new App and Layout components. Upgrade `history` module. (#869)

* Introduce the new App and Layout components. Upgrade `history` module.

* Some clean up and farther improvements

* Simplify client.js, remove DOMUtils (#873)

- IE9+ support
- Remove redundant pagehide logic
- Remove Layout usage from ErrorPage
- Remove unnecessary DOMUtils

* Add full page reload during client-side navigation errors (#874)

* Prevent multiple page renders during the routing process (#878)

* How to Use Sass/SCSS (#880)

* Remove unused withViewport higher order component (#882)

* Added 'extends React.Component' to avoid error on export class' (#887)

* Use location.reload() when client-side routing error occur (#900)

* Add the Admin page with redirect example (#879)

- Add support of redirects at the routing level, e.g. { path: '/admin', action() { return { redirect: '/login' } } }
- Remove context.history as it's no longer used on the server in favor of core/history.js singleton
- Create /admin page example with a redirect to /login page

* Fix typo on changelog (#913)

* Fix Layout.test.js that was always passing (#928)

* Add code splitting example (#901)

* Improve build scripts; integrate react-hot-loader v3; remove react-transform-hmr (#918)

First part of #697

Changes:
- Replace [React Transform](https://github.com/gaearon/babel-plugin-react-transform) with [React Hot Loader](https://github.com/gaearon/react-hot-loader) v3, closes #588
- New `deployToGitHubPages` task which deploys static version to [GitHub Pages](https://pages.github.com/)
- Update `clean` task to ignore `build/.git` and `build/public/.git` folders during cleaning up
- Update `copy` task to process files in parallel, and watching for `added`, `renamed` and `removed` files
- Update `render` task to render pages in parallel, add info about render time in milliseconds
- Update `runServer` task to return promise when server is ready
- Update `start` task to prevent restarting the server in case of hot compilation errors which helps to avoid restarting the task manually
- Remove `react-transform-hmr`, `react-transform-catch-errors`, and `babel-plugin-react-transform` dependencies in favor of `react-hot-loader`
- Remove `tools/lib/fetch.js` with `http` dependency in favor of `node-fetch`
- Remove `del` dependency (wrapper for `rimraf`) in favor of `rimraf`
- Remove `ncp` dependency in favor of simple `copyFile` function, see `tools/lib/fs.js`

* Add ability to import external css (#920)

- Allows to import external css from node_modules (ref #510, #824)
- Allows to properly process `url()` statements (ref #825)
- Allows to import css without css-modules prefixing (close #771)

  ```css
  /* Example: MyTextEditorComponent.css */
  :global {
    @import 'draft-js/dist/Draft.css'; /* external style without prefixing */
  }
  .button { color: red; } /* keep the prefixes for your own style */
  ```

Also closes #375 and #423

* Update dependencies; migrate configs to node.js v6.5+ (#930)

babel-polyfill 6.13.0 => 6.16.0: https://github.com/babel/babel/blob/master/CHANGELOG.md
express-jwt 5.0.0 => 5.1.0: https://github.com/auth0/express-jwt/blob/master/CHANGELOG.md
fbjs 0.8.4 => 0.8.5: https://github.com/facebook/fbjs/blob/master/packages/fbjs/CHANGELOG.md
graphql 0.7.0 => 0.7.2: https://github.com/graphql/graphql-js/releases
history 4.2.0 => 4.3.0: https://github.com/mjackson/history/blob/master/CHANGES.md
markdown-it 8.0.0 => 8.0.1: https://github.com/markdown-it/markdown-it/blob/master/CHANGELOG.md
normalize.css 4.2.0 => 5.0.0: https://github.com/necolas/normalize.css/blob/master/CHANGELOG.md
pretty-error 2.0.1 => 2.0.2: https://github.com/AriaMinaei/pretty-error/commits/master
sequelize 3.24.3 => 3.24.5: https://github.com/sequelize/sequelize/blob/v3/changelog.md
source-map-support 0.4.2 => 0.4.5: https://github.com/evanw/node-source-map-support/commits/master
sqlite3 3.1.4 => 3.1.6: https://github.com/mapbox/node-sqlite3/blob/master/CHANGELOG.md
universal-router 1.2.2 => 2.0.0: https://github.com/kriasoft/universal-router/blob/master/CHANGELOG.md

assets-webpack-plugin ^3.4.0 => ^3.5.0: https://github.com/kossnocorp/assets-webpack-plugin/blob/master/CHANGELOG.md
autoprefixer ^6.4.1 => ^6.5.1: https://github.com/postcss/autoprefixer/blob/master/CHANGELOG.md
babel-cli ^6.14.0 => 6.16.0: https://github.com/babel/babel/blob/master/CHANGELOG.md
babel-core ^6.14.0 => ^6.17.0: https://github.com/babel/babel/blob/master/CHANGELOG.md
babel-eslint ^6.1.2 => ^7.0.0: https://github.com/babel/babel-eslint/commits/master
...

* Update Requirements: node.js v6.5+, npm v3.10+ (#940)

closes #939

* Improve Hot Updates (#938)

Improve Hot Updates

- Add support for hot update of [`PureComponent`](https://facebook.github.io/react/docs/react-api.html#react.purecomponent) and components with [`shouldComponentUpdate`](https://facebook.github.io/react/docs/react-component.html#shouldcomponentupdate)
- Display application errors at full-screen in development mode
- Display hot update errors at full-screen when hot module replacement is enabled

closes #932, #929, #907, #871, #772, #436

* fix lint

* Update npm modules

* Use class components everywhere and optimize React code automatically (#961)

Now you do not need to repeatedly rewrite your [class components to stateless functional components](https://facebook.github.io/react/docs/components-and-props.html#functional-and-class-components) and back. Just always use `class` inherited from `React.Component` or `React.PureComponent` and [transform-react-pure-class-to-function](https://github.com/thejameskyle/babel-react-optimize) plugin will automatically optimize React code by making pure classes into functions in release mode.

* Move Layout component to routes (#959)

Unfortunately, in the current version of React, changing the top-level route to another type (even if the child UI tree is almost the same) will result in React tearing down that tree and building a new one. With this fix, the type of the parent component for each page will stay the same as a user transitions from one page/screen to another. Fixes #960.

* Remove the graphiql module since express-graphql loads this via cdn, disable graphiql ide in for production servers (#977)

* Support multiple entry points out of the box (#963)

closes #811, #953

* Update dependencies

react 15.3.2 => 15.4.0: https://facebook.github.io/react/blog/2016/11/16/react-v15.4.0.html
whatwg-fetch 1.0.0 => 2.01: https://github.com/github/fetch/releases
graphql 0.7.2 => 0.8.2: https://github.com/graphql/graphql-js/releases
express-graphql 0.6.4 => 0.6.1: https://github.com/graphql/express-graphql/releases
browser-sync ^2.17.5 => ^2.18.2: https://github.com/BrowserSync/browser-sync/releases
css-loader: ^0.25.0 => ^0.26.0: https://github.com/webpack/css-loader/releases
eslint ^3.9.1 => ^3.10.2: https://github.com/eslint/eslint/releases
eslint-plugin-react ^6.6.0 => ^6.7.1: https://github.com/yannickcr/eslint-plugin-react/releases

* Use correct absolute callbackURL in passport with Browsersync (#980)

Configure Browsersync proxy to set X-Forwarded headers and Express to trust the X-Forwarded headers.

* Move vendors to separate bundle (#985)

* Improve hot reload speed (#989)

* Move the public folder to the root directory (#990)

* Update how-to-use-sass.md (#1023)

* Double dashes are required

* Better note: double dashes are required

* Add pre-commit hook that automatically formats staged files

* Use of chockidar instead of gaze (#1029)

* Add ignore initial flag for watcher in copy task

* Add linting for CSS class names (#1026)

* Add Dockerfile (#1038)

Update package.json/name, then: npm run build -- --release --docker

* Update working directory in Dockerfile (ref #1038)

* Add markdown-loader for static pages (#1043)

- Remove /src/content folder with .md files in favor of /src/routes/about, /src/routes/privacy etc.
- Remove "content" API endpoint (src/data/queries/content.js)
- Add markdown-loader for .md files that you can easily customize in tools/lib/markdown-loader.js

* Replace NPM with Yarn; add yarn.lock (#1044)

* Fix a bug when joining paths in tools/render (#1059)

* Change references to npm to reference yarn instead (#1060)

* Fix #1072: Images broken after Git commit

* UglifyJS2 should remove unused and dead_code (#1082)

* Docs typo with link not being generated correctly (#1089)

* Fix a typo in Dockerfile (#1090)

* Replace the deprecated Google Api feed RSS to JSON service (#1092)

* fix broken markdown link (#1075)

* Update how-to-configure-text-editors.md (#1105)

* Update Webpack to v2.2.1; update other npm modules (#1108)

continues #1093
also fixes #1047 #1021 #954

* Adds error handler to `window` object.

* Adds error listener on `window` only in development mode.

* Year-agnostic copyright message to prevent the need for yearly changes

* Remove node-gyp prerequisite from readme (#1117)

* Use autoprefixer for babel: compile less (#1115)

- Integrate autoprefixer for Babel that can automatically determine the Babel plugins to compile only for your supported environments: [`babel-preset-env`](https://github.com/babel/babel-preset-env)
- Move `browserslist` to `package.json` for `autprefixer`, `stylelint` and `babel-preset-env`
- Replace `babel-preset-stage-0` with `babel-preset-stage-2` to avoid using [unstable features](https://babeljs.io/docs/plugins/#presets-stage-x-experimental-presets-) in production
- Remove `babel-plugin-transform-runtime` dependency in favor of `babel-polyfills`
- Remove `extend` dependency

* Fix typos in react-intl integration docs (#1128)

* Reenable ESLint rules in accordance to Airbnb style guide (#1126)

* Combine deployment scripts into a single; remove git-repository dependency (#1127)

* Clean up tools folder

* Move head tag utlis from src/client.js to src/core/DOMUtlis.js

* Enable tree-shaking with Webpack 2 and Babel

* Generate stats.json for Webpack Analyser (http://webpack.github.io/analyse/)

[closes #790]

* Show message if stats will be generated for dev

* Revert "Show message if stats will be generated for dev"

This reverts commit 097c1a3.

* Revert "Generate stats.json for Webpack Analyser (http://webpack.github.io/analyse/)"

This reverts commit 4bd3f3f.

* Webpack-bundle-analyzer

* Free __DEV__ variable provided by webpack should be used across RSK (#1114)

Free __DEV__ variable provided by webpack should be used across RSK instead of NODE_ENV checks
Thanks @buildbreakdo

* Update README.md

* Improve deploy script (#1150)

* Remove unused fbjs dependency (#1151)

* Add global-import for third-party styles (#1153)

* Save Point

* Update README.md

Tracking PRs

* Fix jwt error signing recursive json when logging in from second browser

* Corrected shell script typo in how-to-configure-text-editors.md (#1197)

* Revert "Corrected shell script typo in how-to-configure-text-editors.md (#1197)"

This reverts commit 595d1f9.

* Upgrade Universal Router to v3.0.0; update other npm deps

* Introduces `prop-types` in place of React's PropTypes.

* Update yarn.lock

* Unused css class .nav removed

* Update Dockerfile to use the latest Node.js version

* Move ESLint config to .eslintrc.js; update no-console rule (#1210)

* Initialize a new HTTP client for each web request (#1237)

* Fix cookie issue when doing server rendering (#1243)

* Clear the auth cookie if it was tampered or JWT secret was changed (#1242)

* Fix a typo in docs/data-fetching.md: context => contextTypes (#1247)

* chore: Upgrade dependencies

* Exclude dev utils from production build (#1239)

* Move stylelint config to .stylelintrc.js; add comments (#1249)

* feat(test-coverage): with html report (#1213)

* Dockerfile: use cache for yarn install (#1236)

* Facebook: request displayName profile field (#1246)

* Update README.md

Added links to tracking PRs

* Update README.md

Removed feature/bootstrap3

* Fix: server does not respond in case of invalid jwt token

* Update packages (#1277)

* Pass node version as string to babel-preset-env
* Replace global-import with two CSS loaders
* Import external global CSS from JS

* Router receive whole react context (#1279)

* Update "How to Use Sass/SCSS" recipe (#1282)

* Fix a typo in docs/data-fetching.md (#1283)

* Update README.md

* Add code splitting for all pages (#1295)

- Add code splitting for all pages (support for optional `route.load` method)
- Add `<link rel='preload'>` for critical js
- Update node modules

* Remove fastclick dependency (#1305)

* Replace react-addons-test-utils in favor of react-test-renderer (#1297)

TestUtils have been moved to `react-dom/test-utils`
Shallow renderer has been moved to `react-test-renderer/shallow`

* Replace redbox-react with react-error-overlay (#1306)

* Add stylelint-order; remove stylefmt in favor of stylelint --fix (#1310)

* Support for absolute imports (#1312)

* Isomorphic Hot Module Replacement (#1317)

* Remove trailing spaces from docs (#1318)

* Updated broken link to WebStorm IDE setup guide (#1321)

* Update webpack to v3 (#1329)

* Add ability to use images from node modules (#1334)

* Upgrade sequelize (major) (#1335)

* Replace git hooks library: "pre-commit" to "husky" (#1336)

* Remove isomorphic-fetch in favor of node-fetch + whatwg-fetch (#1339)

* Add flowtype plugin to eslint with recommended configuration

* Use yarn.lock when building docker containers (#1348)

* Introduce Jest (#1347)

* dev-deps: jest, jscodeshift, jest-codemods
* jest configuration
* Example jest test
* Remove mocha and istanbul in favour of jest

* Update packages

* Integrate Prettier

* yarn run fix

* Add doc for How to Configure Facebook Login (#1333)

* Update how-to-configure-facebook-login.md

* Fix runServer script

* style: disable no-return-assign on line in tools/start

* Minor update (#1377)

* chore: update packages

* chore: upgrade jest-codemods, update others

* chore: upgrade query-string, updade others

* chore: upgrade packages, including eslint

* chore: upgrade

* chore: run jest-codemods

* Fixed lint issues

* Fixed dependency issues that were breaking local build
  • Loading branch information
Iain Raleigh authored Aug 28, 2017
1 parent 577d83c commit 84ba9a3
Show file tree
Hide file tree
Showing 76 changed files with 10,862 additions and 20 deletions.
95 changes: 95 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/**
* React Starter Kit (https://www.reactstarterkit.com/)
*
* Copyright © 2014-present Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/

// ESLint configuration
// http://eslint.org/docs/user-guide/configuring
module.exports = {
parser: 'babel-eslint',

extends: [
'airbnb',
'plugin:flowtype/recommended',
'plugin:css-modules/recommended',
'prettier',
'prettier/flowtype',
'prettier/react',
],

plugins: ['flowtype', 'css-modules', 'prettier'],

globals: {
__DEV__: true,
},

env: {
browser: true,
},

rules: {
// `js` and `jsx` are common extensions
// `mjs` is for `universal-router` only, for now
'import/extensions': [
'error',
'always',
{
js: 'never',
jsx: 'never',
mjs: 'never',
},
],

// Not supporting nested package.json yet
// https://github.com/benmosher/eslint-plugin-import/issues/458
'import/no-extraneous-dependencies': 'off',

// Recommend not to leave any console.log in your code
// Use console.error, console.warn and console.info instead
'no-console': [
'error',
{
allow: ['warn', 'error', 'info'],
},
],

// a11y removed rule, ignore them
'jsx-a11y/href-no-hash': 'off',

// https://github.com/evcohen/eslint-plugin-jsx-a11y/issues/308#issuecomment-322954274
'jsx-a11y/label-has-for': 'warn',

// Allow js files to use jsx syntax, too
'react/jsx-filename-extension': ['error', { extensions: ['.js', '.jsx'] }],

// Automatically convert pure class to function by
// babel-plugin-transform-react-pure-class-to-function
// https://github.com/kriasoft/react-starter-kit/pull/961
'react/prefer-stateless-function': 'off',

// ESLint plugin for prettier formatting
// https://github.com/prettier/eslint-plugin-prettier
'prettier/prettier': [
'error',
{
// https://github.com/prettier/prettier#options
singleQuote: true,
trailingComma: 'all',
},
],
},

settings: {
// Allow absolute paths in imports, e.g. import Button from 'components/Button'
// https://github.com/benmosher/eslint-plugin-import/tree/master/resolvers
'import/resolver': {
node: {
moduleDirectory: ['node_modules', 'src'],
},
},
},
};
14 changes: 14 additions & 0 deletions .nycrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"require": [
"babel-register"
],
"include": [
"src"
],
"reporter": [
"lcov",
"text"
],
"sourceMap": false,
"instrument": false
}
61 changes: 61 additions & 0 deletions .stylelintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/**
* React Starter Kit (https://www.reactstarterkit.com/)
*
* Copyright © 2014-present Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/

// stylelint configuration
// https://stylelint.io/user-guide/configuration/
module.exports = {
// The standard config based on a handful of CSS style guides
// https://github.com/stylelint/stylelint-config-standard
extends: 'stylelint-config-standard',

plugins: [
// stylelint plugin to sort CSS rules content with specified order
// https://github.com/hudochenkov/stylelint-order
'stylelint-order',
],

rules: {
'property-no-unknown': [
true,
{
ignoreProperties: [
// CSS Modules composition
// https://github.com/css-modules/css-modules#composition
'composes',
],
},
],

'selector-pseudo-class-no-unknown': [
true,
{
ignorePseudoClasses: [
// CSS Modules :global scope
// https://github.com/css-modules/css-modules#exceptions
'global',
],
},
],

// Opinionated rule, you can disable it if you want
'string-quotes': 'single',

// https://github.com/hudochenkov/stylelint-order/blob/master/rules/order/README.md
'order/order': [
'custom-properties',
'dollar-variables',
'declarations',
'at-rules',
'rules',
],

// https://github.com/hudochenkov/stylelint-order/blob/master/rules/properties-order/README.md
'order/properties-order': [],
},
};
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM node:7.9.0-alpine

# Set a working directory
WORKDIR /usr/src/app

COPY ./build/package.json .
COPY ./build/yarn.lock .

# Install Node.js dependencies
RUN yarn install --production --no-progress

# Copy application files
COPY ./build .

CMD [ "node", "server.js" ]
11 changes: 11 additions & 0 deletions docs/recipes/how-to-configure-facebook-login.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
How to configure Facebook Login

1. Navigate and Login to https://developers.facebook.com/apps
2. Click "Add New App"
3. Enter your app name and contact email
4. In App Dashboard, click `Set Up` in Facebook Login section
5. Chose "Web" as your Platform
6. Set Site URL to `http://localhost:3000/` for local testing. (Port of your Node server, not the port of the BrowserSync proxy)
7. Click Facebook Login on the left panel
8. Turn on Client OAuth Login and Web OAuth Login. Enter `http://localhost:3000/login/facebook/return` for Valid OAuth redirect URIs.
9. Get your App ID and Secret and copy it to [`src/config.js`](../src/config.js)
122 changes: 122 additions & 0 deletions docs/recipes/how-to-integrate-react-intl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
## How to Integrate [React Intl](https://github.com/yahoo/react-intl#react-intl)

1. Merge `feature/react-intl` branch with git.
Because react-intl integration is built on top of `feature/redux`, you'll also get all the features.

2. Adjust `INTL_REQUIRE_DESCRIPTIONS` constant in `tools/webpack.config.js` around line 17:
```js
const INTL_REQUIRE_DESCRIPTIONS = true;
```
When this boolean is set to true, the build will only succeed if a `description` is set for every message descriptor.

3. Adjust `locales` settings in `src/config.js`:
```js
// default locale is the first one
export const locales = ['en-GB', 'cs-CZ'];
```
Note that you should follow
[BCP 47](https://tools.ietf.org/html/bcp47)
([RFC 5646](https://tools.ietf.org/html/rfc5646)).

4. Add locale support in `src/client.js`:
```js
import en from 'react-intl/locale-data/en';
import cs from 'react-intl/locale-data/cs';
...
[en, cs].forEach(addLocaleData);
```

5. Execute `yarn run extractMessages` or `yarn start` to strip out messages.
Message files are created in `src/messages` directory.

6. Edit `src/messages/*.json` files, change only `message` property.

7. Execute `yarn run build`,
your translations should be copied to `build/messages/` directory.


### How to write localizable components

Just import the appropriate [component](https://github.com/yahoo/react-intl/wiki#the-react-intl-module) from `react-intl`

- For localizable text use
[`<FormattedMessage>`](https://github.com/yahoo/react-intl/wiki/Components#formattedmessage).
- You can also use it with
the [`defineMessages()`](https://github.com/yahoo/react-intl/wiki/API#definemessages) helper.

- For date and time:
[`<FormattedDate>`](https://github.com/yahoo/react-intl/wiki/Components#formatteddate)
[`<FormattedTime>`](https://github.com/yahoo/react-intl/wiki/Components#formattedtime)
[`<FormattedRelative>`](https://github.com/yahoo/react-intl/wiki/Components#formattedrelative)

- For numbers and currencies:
[`<FormattedNumber>`](https://github.com/yahoo/react-intl/wiki/Components#formattednumber)
[`<FormattedPlural>`](https://github.com/yahoo/react-intl/wiki/Components#formattedplural)

- If possible, do not use `<FormattedHTMLMessage>`, see how to use *Rich Text Formatting* with
[`<FormattedMessage>`](https://github.com/yahoo/react-intl/wiki/Components#formattedmessage)

- When you need an imperative formatting API, use the [`injectIntl`](https://github.com/yahoo/react-intl/wiki/API#injectintl) High-Order Component.

#### Example

```jsx
import { defineMessages, FormattedMessage, injectIntl, intlShape } from 'react-intl';
const messages = defineMessages({
text: {
id: 'example.text',
defaultMessage: 'Example text',
description: 'Hi Pavel',
},
textTemplate: {
id: 'example.text.template',
defaultMessage: 'Example text template',
description: 'Hi {name}',
},
});
function Example(props) {
const text = props.intl.formatMessage(messages.textTemplate, { name: 'Pavel'});
return (
<div>
<FormattedMessage
id="example.text.inlineDefinition"
defaultMessage="Hi Pavel"
description="Example of usage without defineMessages"
/>
<FormattedMessage {...messages.text} />
<FormattedMessage
{...messages.textTemplate}
values={{
name: <b>Pavel</b>
}}
/>
</div>
);
}
Example.propTypes = {
intl: intlShape,
}
export default injectIntl(Example);
```

### Updating translations

When running the development server, every source file is watched and parsed for changed messages.

Messages files are updated on the fly.
If a new definition is found, this definition is added to the end of every used `src/messages/xx-XX.json` file so when committing, new translations will be at the tail of file.

When an untranslated message is removed and its `message` field is empty as well, the message will be deleted from all translation files. This is why the `files` array is present.

When editing a translation file, it should be copied to `build/messages/` directory.

### Other References

* [`Intl documentation on MDN`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Intl)
* [express-request-language](https://github.com/tinganho/express-request-language#readme)
for more details how initial language negotiation works.
56 changes: 56 additions & 0 deletions docs/recipes/how-to-integrate-redux.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
## How to Integrate [Redux](http://redux.js.org/index.html)

Merge `feature/redux` branch with Git. If you are interested in `feature/react-intl`, merge that
branch instead as it also includes Redux.

**If you don't know Redux well, you should [read about it first](http://redux.js.org/docs/basics/index.html).**


### Creating Actions

1. Go to `src/constants/index.js` and define action name there.

2. Go to `src/actions/` and create file with appropriate name. You can copy
`src/actions/runtime.js` as a template.

3. If you need async actions, use [`redux-thunk`](https://github.com/gaearon/redux-thunk#readme).
For inspiration on how to create async actions you can look at
[`setLocale`](https://github.com/kriasoft/react-starter-kit/blob/feature/react-intl/src/actions/intl.js)
action from `feature/react-intl`.
See [Async Flow](http://redux.js.org/docs/advanced/AsyncFlow.html) for more information on this
topic.


### Creating Reducer (aka Store)

1. Go to [`src/reducers/`](https://github.com/kriasoft/react-starter-kit/tree/feature/redux/src/reducers) and create new file there.

You can copy [`src/reducers/runtime.js`](https://github.com/kriasoft/react-starter-kit/tree/feature/redux/src/reducers/runtime.js) as a template.

- Do not forget to always return `state`.
- Never mutate provided `state`.
If you mutate state, rendering of connected component will not be triggered because of `===` equality.
Always return new value if you perform state update.
You can use this construct: `{ ...state, updatedKey: action.payload.value, }`
- Keep in mind that store state *must* be repeatable by replaying actions on it.
For example, when you store timestamp, pass it into *action payload*.
If you call REST API, do it in action. *Never do this in reducer!*

2. Edit [`src/reducers/index.js`](https://github.com/kriasoft/react-starter-kit/tree/feature/redux/src/reducers/index.js), import your reducer and add it to root reducer created by
[`combineReducers`](http://redux.js.org/docs/api/combineReducers.html)


### Connecting Components

You can use [`connect()`](https://github.com/reactjs/react-redux/blob/master/docs/api.md#connectmapstatetoprops-mapdispatchtoprops-mergeprops-options) High-Order Component from [`react-redux`](https://github.com/reactjs/react-redux#readme) package.

See [Usage With React](http://redux.js.org/docs/basics/UsageWithReact.html) on redux.js.org.

For an example you can look at
[`<LanguageSwitcher>`](https://github.com/kriasoft/react-starter-kit/blob/feature/react-intl/src/components/LanguageSwitcher/LanguageSwitcher.js)
component from `feature/react-intl` branch. It demonstrates both subscribing to store and dispatching actions.


### Dispatching Actions On Server

See source of `src/server.js`
Loading

0 comments on commit 84ba9a3

Please sign in to comment.