Skip to content

Commit

Permalink
fix: convert CRLF line endings to LF
Browse files Browse the repository at this point in the history
  • Loading branch information
zetlen committed Nov 6, 2018
1 parent 137218c commit a403111
Show file tree
Hide file tree
Showing 27 changed files with 9,470 additions and 9,470 deletions.
94 changes: 47 additions & 47 deletions packages/peregrine/src/Peregrine/Peregrine.js
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
import React from 'react';
import { Provider as ReduxProvider } from 'react-redux';
import createStore from '../store';
import MagentoRouter from '../Router';

/**
*
* @param {string} apiBase Absolute URL pointing to the GraphQL endpoint
* @param {string} __tmp_webpack_public_path__ Temporary hack. Expects the `__webpack_public_path__` value
* @returns {{ store: Store, Provider: () => JSX.Element }}
*/
export default function bootstrap({
apiBase,
renderRoutes,
__tmp_webpack_public_path__
}) {
// Remove deprecation warning after 2 version bumps
if (process.env.NODE_ENV !== 'production' && this instanceof bootstrap) {
throw new Error(
'The API for Peregrine has changed. ' +
'Please see the Release Notes on Github ' +
'for instructions to update your application'
);
}

const store = createStore();
const routerProps = {
apiBase,
renderRoutes,
__tmp_webpack_public_path__: ensureDirURI(__tmp_webpack_public_path__)
};
const Provider = () => (
<ReduxProvider store={store}>
<MagentoRouter {...routerProps} />
</ReduxProvider>
);

return { store, Provider };
}

/**
* Given a URI, will always return the same URI with a trailing slash
* @param {string} uri
*/
function ensureDirURI(uri) {
return uri.endsWith('/') ? uri : uri + '/';
}
import React from 'react';
import { Provider as ReduxProvider } from 'react-redux';
import createStore from '../store';
import MagentoRouter from '../Router';

/**
*
* @param {string} apiBase Absolute URL pointing to the GraphQL endpoint
* @param {string} __tmp_webpack_public_path__ Temporary hack. Expects the `__webpack_public_path__` value
* @returns {{ store: Store, Provider: () => JSX.Element }}
*/
export default function bootstrap({
apiBase,
renderRoutes,
__tmp_webpack_public_path__
}) {
// Remove deprecation warning after 2 version bumps
if (process.env.NODE_ENV !== 'production' && this instanceof bootstrap) {
throw new Error(
'The API for Peregrine has changed. ' +
'Please see the Release Notes on Github ' +
'for instructions to update your application'
);
}

const store = createStore();
const routerProps = {
apiBase,
renderRoutes,
__tmp_webpack_public_path__: ensureDirURI(__tmp_webpack_public_path__)
};
const Provider = () => (
<ReduxProvider store={store}>
<MagentoRouter {...routerProps} />
</ReduxProvider>
);

return { store, Provider };
}

/**
* Given a URI, will always return the same URI with a trailing slash
* @param {string} uri
*/
function ensureDirURI(uri) {
return uri.endsWith('/') ? uri : uri + '/';
}
102 changes: 51 additions & 51 deletions packages/peregrine/src/Router/Router.js
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
import React, { Component } from 'react';
import { BrowserRouter, Route } from 'react-router-dom';
import { string, func, object } from 'prop-types';
import MagentoRouteHandler from './MagentoRouteHandler';

export default class MagentoRouter extends Component {
static propTypes = {
/* Can be BrowserRouter, MemoryRouter, HashRouter, etc */
using: func,
routerProps: object,
apiBase: string.isRequired,
renderRoutes: func,
__tmp_webpack_public_path__: string.isRequired
};

static defaultProps = {
using: BrowserRouter,
routerProps: {},
renderRoutes: ({ magentoRoute }) => magentoRoute
};

render() {
const {
using: Router,
routerProps,
apiBase,
renderRoutes,
__tmp_webpack_public_path__
} = this.props;

return (
<Router {...routerProps}>
{renderRoutes({
magentoRoute: (
<Route
render={({ location }) => (
<MagentoRouteHandler
location={location}
apiBase={apiBase}
__tmp_webpack_public_path__={
__tmp_webpack_public_path__
}
/>
)}
/>
)
})}
</Router>
);
}
}
import React, { Component } from 'react';
import { BrowserRouter, Route } from 'react-router-dom';
import { string, func, object } from 'prop-types';
import MagentoRouteHandler from './MagentoRouteHandler';

export default class MagentoRouter extends Component {
static propTypes = {
/* Can be BrowserRouter, MemoryRouter, HashRouter, etc */
using: func,
routerProps: object,
apiBase: string.isRequired,
renderRoutes: func,
__tmp_webpack_public_path__: string.isRequired
};

static defaultProps = {
using: BrowserRouter,
routerProps: {},
renderRoutes: ({ magentoRoute }) => magentoRoute
};

render() {
const {
using: Router,
routerProps,
apiBase,
renderRoutes,
__tmp_webpack_public_path__
} = this.props;

return (
<Router {...routerProps}>
{renderRoutes({
magentoRoute: (
<Route
render={({ location }) => (
<MagentoRouteHandler
location={location}
apiBase={apiBase}
__tmp_webpack_public_path__={
__tmp_webpack_public_path__
}
/>
)}
/>
)
})}
</Router>
);
}
}
20 changes: 10 additions & 10 deletions packages/peregrine/src/store/composeEnhancers.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { compose } from 'redux';

const composeEnhancers =
process.env.NODE_ENV !== 'production' &&
typeof window === 'object' &&
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({})
: compose;

export default composeEnhancers;
import { compose } from 'redux';

const composeEnhancers =
process.env.NODE_ENV !== 'production' &&
typeof window === 'object' &&
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({})
: compose;

export default composeEnhancers;
Loading

0 comments on commit a403111

Please sign in to comment.