Skip to content

Commit

Permalink
replace parcel with create-react-app for the example website
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardo-forina committed Oct 11, 2019
1 parent 1708499 commit e6ec8ba
Show file tree
Hide file tree
Showing 41 changed files with 7,261 additions and 811 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ coverage
.rts2_cache_esm
.rts2_cache_umd
dist
build
.yalc
storybook-static
# Local Netlify folder
.netlify
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ yarn # to install dependencies
yarn start
```

The default example imports and live reloads whatever is in `/dist`, so if you are seeing an out of date component, make sure TSDX is running in watch mode like we recommend above. **No symlinking required**, [we use Parcel's aliasing](https://github.com/palmerhq/tsdx/pull/88/files).

To do a one-off build, use `yarn build`.

To run tests, use `yarn test`.
8 changes: 8 additions & 0 deletions build-netlify.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

yarn global add yalc
yarn run build
yalc publish
cd example
yalc add use-patternfly
yarn run build
23 changes: 23 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
3 changes: 0 additions & 3 deletions example/.npmignore

This file was deleted.

44 changes: 44 additions & 0 deletions example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `yarn start`

Runs the app in the development mode.<br />
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.<br />
You will also see any lint errors in the console.

### `yarn test`

Launches the test runner in the interactive watch mode.<br />
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `yarn build`

Builds the app for production to the `build` folder.<br />
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.<br />
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `yarn eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).
15 changes: 0 additions & 15 deletions example/index.html

This file was deleted.

14 changes: 0 additions & 14 deletions example/index.tsx

This file was deleted.

61 changes: 38 additions & 23 deletions example/package.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,48 @@
{
"name": "example",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"start": "parcel index.html",
"build": "parcel build index.html"
},
"version": "0.1.0",
"private": true,
"dependencies": {
"@apollo/react-hooks": "^3.1.2",
"@patternfly/react-core": "^3.77.2",
"@patternfly/react-icons": "^3.10.15",
"@patternfly/react-styles": "^3.5.7",
"@types/jest": "24.0.18",
"@types/node": "12.7.12",
"@types/react": "16.9.5",
"@types/react-dom": "16.9.1",
"apollo-boost": "^0.4.4",
"date-fns": "^2.4.1",
"graphql": "^14.5.8",
"react-app-polyfill": "^1.0.4",
"react-async": "^9.0.0"
"react": "^16.10.2",
"react-async": "^9.0.0",
"react-dom": "^16.10.2",
"react-router": "^5.1.2",
"react-router-dom": "^5.1.2",
"react-router-last-location": "^2.0.1",
"react-scripts": "3.2.0",
"typescript": "3.6.4",
"use-patternfly": "file:.yalc/use-patternfly"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"alias": {
"use-patternfly": "../.",
"react": "../node_modules/react",
"react-dom": "../node_modules/react-dom/profiling",
"react-router": "../node_modules/react-router",
"react-router-dom": "../node_modules/react-router-dom",
"react-router-last-location": "../node_modules/react-router-last-location",
"scheduler/tracing": "../node_modules/scheduler/tracing-profiling",
"date-fns": "../node_modules/date-fns"
"eslintConfig": {
"extends": "react-app"
},
"devDependencies": {
"@types/react": "^16.8.15",
"@types/react-dom": "^16.8.4",
"parcel": "^1.12.3",
"typescript": "^3.4.5"
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Binary file added example/public/favicon.ico
Binary file not shown.
39 changes: 39 additions & 0 deletions example/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="logo192.png" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
<script async src="https://static.codepen.io/assets/embed/ei.js"></script>
</body>
</html>
2 changes: 2 additions & 0 deletions example/public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
File renamed without changes.
12 changes: 8 additions & 4 deletions example/app.tsx → example/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import 'react-app-polyfill/ie11';
import '@patternfly/react-core/dist/styles/base.css';
import { Brand } from '@patternfly/react-core';
import * as React from 'react';
import React from 'react';
import { Redirect, useHistory } from 'react-router-dom';
import { AppLayout, LazyRoute, SwitchWith404 } from 'use-patternfly';
import './app.css';
import './App.css';
import logo from './use-patternfly.png';

const Logo = <Brand src={logo} alt={'use-patternfly logo'} />;
Expand Down Expand Up @@ -44,7 +44,10 @@ const navItems = [
to: '/examples',
items: [
{ to: '/examples/async-data-list-rest', title: 'Async Data List (REST)' },
{ to: '/examples/async-data-list-graphql', title: 'Async Data List (Graphql)' },
{
to: '/examples/async-data-list-graphql',
title: 'Async Data List (Graphql)',
},
],
},
];
Expand All @@ -53,7 +56,8 @@ const getOverviewPage = () => import('./pages/OverviewPage');
const getInstallationPage = () => import('./pages/InstallationPage');
const getUsagePage = () => import('./pages/UsagePage');
const getAsyncDataListRest = () => import('./pages/AsyncDataListRestPage');
const getAsyncDataListGraphQL = () => import('./pages/AsyncDataListGraphQLPage');
const getAsyncDataListGraphQL = () =>
import('./pages/AsyncDataListGraphQLPage');

export const App = () => {
const history = useHistory();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'react';
import React from 'react';
import { PageSection, Text, TextContent, Title } from '@patternfly/react-core';
import { ExampleLink } from './ExampleLink';

Expand All @@ -9,9 +9,11 @@ export const AsyncDataListGraphQLHeader: React.FunctionComponent = () => (
Async Data List (GraphQL)
</Title>
<Text>
A common pattern is to query a GraphQL endpoint, wait for its results and show
the data in a data list. In this example we use <a href={'https://swapi.graph.cool'}>SWApi GraphQL</a> as a sample backend service
to show the list of characters in the Star Wars universe.
A common pattern is to query a GraphQL endpoint, wait for its results
and show the data in a data list. In this example we use{' '}
<a href={'https://swapi.graph.cool'}>SWApi GraphQL</a> as a sample
backend service to show the list of characters in the Star Wars
universe.
</Text>
<Text>
<ExampleLink filename={'AsyncDataListGraphQLPage.tsx'}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'react';
import React from 'react';
import { PageSection, Text, TextContent, Title } from '@patternfly/react-core';
import { ExampleLink } from './ExampleLink';

Expand All @@ -10,9 +10,9 @@ export const AsyncDataListRestHeader: React.FunctionComponent = () => (
</Title>
<Text>
A common pattern is to call a REST API, wait for its results and show
the data in a data list. In this example we use {' '}
<a href={'https://swapi.co'}>SWApi</a> as a sample backend service
to show the list of characters in the Star Wars universe.
the data in a data list. In this example we use{' '}
<a href={'https://swapi.co'}>SWApi</a> as a sample backend service to
show the list of characters in the Star Wars universe.
</Text>
<Text>
<ExampleLink filename={'AsyncDataListRestPage.tsx'}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'react';
import React from 'react';

export interface IExampleLinkProps
extends React.HTMLAttributes<HTMLAnchorElement> {
Expand All @@ -7,10 +7,13 @@ export interface IExampleLinkProps

export const ExampleLink: React.FunctionComponent<IExampleLinkProps> = ({
filename,
children,
...props
}) => (
<a
href={`https://github.com/riccardo-forina/use-patternfly/tree/master/example/pages/${filename}`}
{...props}
/>
>
{children}
</a>
);
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'react';
import React from 'react';
import {
PageSection,
Title,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
TextList,
TextListItem,
} from '@patternfly/react-core';
import * as React from 'react';
import React from 'react';
import { Link } from 'react-router-dom';
import { Keyword } from './Keyword';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'react';
import React from 'react';
import { css, StyleSheet } from '@patternfly/react-styles';

const styles = StyleSheet.create({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'react';
import React from 'react';
import {
PageSection,
TextContent,
Expand Down
Loading

0 comments on commit e6ec8ba

Please sign in to comment.