Coder Social home page Coder Social logo

patternfly / patternfly-react-seed Goto Github PK

View Code? Open in Web Editor NEW
87.0 16.0 247.0 4.37 MB

A PatternFly 5 seed for React web applications

Home Page: http://patternfly-react-seed.surge.sh/

License: MIT License

JavaScript 35.47% HTML 1.49% CSS 1.70% TypeScript 61.34%
patternfly react seed webpack hacktoberfest

patternfly-react-seed's Introduction

Patternfly Seed

Patternfly Seed is an open source build scaffolding utility for web apps. The primary purpose of this project is to give developers a jump start when creating new projects that will use patternfly. A secondary purpose of this project is to serve as a reference for how to configure various aspects of an application that uses patternfly, webpack, react, typescript, etc.

Out of the box you'll get an app layout with chrome (header/sidebar), routing, build pipeline, test suite, and some code quality tools. Basically, all the essentials.

Out of box dashboard view of patternfly seed

Quick-start

git clone https://github.com/patternfly/patternfly-react-seed
cd patternfly-react-seed
npm install && npm run start:dev

Development scripts

# Install development/build dependencies
npm install

# Start the development server
npm run start:dev

# Run a production build (outputs to "dist" dir)
npm run build

# Run the test suite
npm run test

# Run the test suite with coverage
npm run test:coverage

# Run the linter
npm run lint

# Run the code formatter
npm run format

# Launch a tool to inspect the bundle size
npm run bundle-profile:analyze

# Start the express server (run a production build first)
npm run start

Configurations

Raster image support

To use an image asset that's shipped with PatternFly core, you'll prefix the paths with "@assets". @assets is an alias for the PatternFly assets directory in node_modules.

For example:

import imgSrc from '@assets/images/g_sizing.png';
<img src={imgSrc} alt="Some image" />

You can use a similar technique to import assets from your local app, just prefix the paths with "@app". @app is an alias for the main src/app directory.

import loader from '@app/assets/images/loader.gif';
<img src={loader} alt="Content loading" />

Vector image support

Inlining SVG in the app's markup is also possible.

import logo from '@app/assets/images/logo.svg';
<span dangerouslySetInnerHTML={{__html: logo}} />

You can also use SVG when applying background images with CSS. To do this, your SVG's must live under a bgimages directory (this directory name is configurable in webpack.common.js). This is necessary because you may need to use SVG's in several other context (inline images, fonts, icons, etc.) and so we need to be able to differentiate between these usages so the appropriate loader is invoked.

body {
  background: url(./assets/bgimages/img_avatar.svg);
}

Adding custom CSS

When importing CSS from a third-party package for the first time, you may encounter the error Module parse failed: Unexpected token... You may need an appropriate loader to handle this file typ.... You need to register the path to the stylesheet directory in stylePaths.js. We specify these explicitly for performance reasons to avoid webpack needing to crawl through the entire node_modules directory when parsing CSS modules.

Code quality tools

  • For accessibility compliance, we use react-axe
  • To keep our bundle size in check, we use webpack-bundle-analyzer
  • To keep our code formatting in check, we use prettier
  • To keep our code logic and test coverage in check, we use jest
  • To ensure code styles remain consistent, we use eslint

Multi environment configuration

This project uses dotenv-webpack for exposing environment variables to your code. Either export them at the system level like export MY_ENV_VAR=http://dev.myendpoint.com && npm run start:dev or simply drop a .env file in the root that contains your key-value pairs like below:

ENV_1=http://1.myendpoint.com
ENV_2=http://2.myendpoint.com

With that in place, you can use the values in your code like console.log(process.env.ENV_1);

patternfly-react-seed's People

Contributors

ajaypratap003 avatar aladjadj avatar cdcabrera avatar computerscienceiscool avatar dependabot[bot] avatar dgutride avatar dlabaj avatar evwilkin avatar gitdallas avatar hardrese7 avatar harikrishnanbalagopal avatar ibolton336 avatar indraraj avatar janwright73 avatar jenny-s51 avatar jennydaman avatar jkupferer avatar mfrances17 avatar mturley avatar nicolethoen avatar redallen avatar riccardo-forina avatar safarcik avatar seanforyou23 avatar snyk-bot avatar venefilyn avatar wise-king-sullyman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

patternfly-react-seed's Issues

Nextjs example?

Hi there,

First off: Congrats on Pf4. Looks pretty well thought over :)

I have done a project in Patternfly 3, years back and I was looking to start with PatternFly4 on this upcoming project. I am looking to use the React components together with Nextjs(https://nextjs.org/) and I am looking for somebody who has done the same and could share the base setup with me. I'm not the biggest webpack hero :D ... yet

README topics

Decide what's worth documenting and take a first pass on documenting the patternfly specific aspects of the build. Some topics could be

  • What the purpose of this project even is
  • How we configure webpack to load our javascripts, stylesheets, images, and other assets
  • Any third party libraries our project requires and why
  • Tools we use to keep the code in quality shape
  • Etc.

Make the DynamicImport a TS generic to avoid swallowing the component's props

Right now we suggest doing something like this

const SomePage = (routeProps: RouteComponentProps) => {
  const lastNavigation = useLastLocation();
  return (
    <DynamicImport load={getSomePageModuleAsync()} focusContentAfterMount={lastNavigation !== null}>
      {(Component: any) => {
        if (Component === null) {
          return (
            <PageSection aria-label="Loading Content Container">
              <div className="pf-l-bullseye">
                <Alert title="Loading" className="pf-l-bullseye__item" />
              </div>
            </PageSection>
          );
        } else {
          return <Component />; // we are not passing a prop that is required, but the TS compiler can't know this because we lost the component's types in the process!
        }
      }}
    </DynamicImport>
  );
};

Component is typed as any, which makes it impossible to make sure the right props are being passed to the component.
It would be nice specifying the interface the dynamically loaded component should respect, something like this:

interface SomePageRoute {
  foo: string;
}
const SomePage = (routeProps: RouteComponentProps<SomePageRoute>) => {
  const lastNavigation = useLastLocation();
  return (
    <DynamicImport<ISomePageProps> load={getSomePageAsync()} focusContentAfterMount={lastNavigation !== null}>
      {(Component) => {
        // Component here would be the actual component class/function, with the right type. 
        if (Component === null) {
          return (
            <PageSection aria-label="Loading Content Container">
              <div className="pf-l-bullseye">
                <Alert title="Loading" className="pf-l-bullseye__item" />
              </div>
            </PageSection>
          );
        } else {
          return <Component someRequiredPropFromTheRouter={routeProps.match.params.foo} />;
        }
      }}
    </DynamicImport>
  );
};

It doesn't sound like much, but this way the compiler can help you avoiding gluing a component to a route that doesn't provide the required data to instantiate it.

Set up build configuration for multi env

It would be good to have even the smallest support for multiple types of builds for multiple environments. Let's add hook which allows for production and development build modes.

Awesome source maps please!

Screen reader users should be made aware of route changes

Generally, we want to ensure that after a new view is loaded, screen reader users are informed and adequately oriented so that they can easily find and consume the new content.

For us to do this, the following needs to be addressed;

  • Page <title> needs to be updated per page
  • Ensure each page contains a main heading
  • Ensure keyboard focus is managed and not lost between page changes

Currently, after selecting an item from the primary navigation, nothing relevant to the page change is announced and it's verified that the user is still focused on the link. Let's improve this so that some basic information is provided and ideally send focus to the new content once it's available.

Cannot resolve peer dependencies when running `npm install` without `--legacy-peer-deps`

$ git clone git@[email protected]:patternfly/patternfly-react-seed.git
$ cd patternfly-react-seed
$ rm package-lock.json
$ npm install

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR!   react@"^17.0.2" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^15.5.4 || ^16.0.0" from [email protected]
npm ERR! node_modules/react-router-last-location
npm ERR!   react-router-last-location@"^2.0.1" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /home/javiroman/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/javiroman/.npm/_logs/2022-04-04T06_44_47_718Z-debug-0.log

$ npm --version
8.3.1
$ node --version
v16.14.0

I'm not sure about the issue, any idea about re-creating the dependency tree when the package-lock.json file is missing?

Brand and SVG

I don't know if this is the place to ask questions, let me know please where can I join.

I'm building the new Infinispan Console with Patternfly 4 and react, taking this seed as the starting point.
https://github.com/karesti/infinispan-console-ng

I've put under `src/app/assets/images' the images we need to display on the header.

I updated the AppLayout such as

import brand from '@app/assets/images/brand.svg';

const Header = (
    <PageHeader
      logo={<Brand src={brand} alt="Datagrid Management Console"/>}

Unfortunately, the svg image does not display. I tested with a png and it works.
Do I need to add anything else? In the official documentation, the svg seems supported in the brand component.

Thank you!

Katia

Add Chrome/Routing

It would be nice if users didn't have to implement routing, it's like, the very first battle every dev will run into. Can we add minimal support for this out of the box?

Both npm- and yarn-based lockfiles are present, we should choose one

The repo currently has both package-lock.json and yarn.lock files present.

Our README uses npm commands, so I assume the intention was to switch from yarn to npm. Inspecting the history:

  • We started with yarn.lock initially
  • #78 removed yarn.lock and switched us to npm's package-lock.json
  • #120 reintroduced yarn.lock as a side-effect
  • Since then it has only been modified by dependabot, where package-lock.json has also been modified by hand

So I think we just need to delete yarn.lock. I wonder if we should add it to .gitignore?

Resolve peer dependency warnings related to Storybook (upgrade after Storybook issue is resolved)

See #150 for context.

We need to wait for storybookjs/storybook#14119 to be resolved, and then upgrade to the latest release of Storybook once that fix is released.

When running npm install, these warnings are all due to outdated dependencies in Storybook:

npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @reach/[email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react
npm WARN   react@"^17.0.2" from the root project
npm WARN   89 more (@emotion/core, @emotion/styled, @emotion/styled-base, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"15.x || 16.x || 16.4.0-alpha.0911da3" from @reach/[email protected]
npm WARN node_modules/@reach/router
npm WARN   @reach/router@"^1.2.1" from @storybook/[email protected]
npm WARN   node_modules/@storybook/addon-info/node_modules/@storybook/api
npm WARN   3 more (@storybook/router, @storybook/api, @storybook/router)
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react
npm WARN   peer react@"15.x || 16.x || 16.4.0-alpha.0911da3" from @reach/[email protected]
npm WARN   node_modules/@reach/router
npm WARN     @reach/router@"^1.2.1" from @storybook/[email protected]
npm WARN     node_modules/@storybook/addon-info/node_modules/@storybook/api
npm WARN     3 more (@storybook/router, @storybook/api, @storybook/router)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @reach/[email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react-dom
npm WARN   react-dom@"^17.0.2" from the root project
npm WARN   42 more (@patternfly/react-core, @patternfly/react-icons, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react-dom@"15.x || 16.x || 16.4.0-alpha.0911da3" from @reach/[email protected]
npm WARN node_modules/@reach/router
npm WARN   @reach/router@"^1.2.1" from @storybook/[email protected]
npm WARN   node_modules/@storybook/addon-info/node_modules/@storybook/api
npm WARN   3 more (@storybook/router, @storybook/api, @storybook/router)
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react-dom
npm WARN   peer react-dom@"15.x || 16.x || 16.4.0-alpha.0911da3" from @reach/[email protected]
npm WARN   node_modules/@reach/router
npm WARN     @reach/router@"^1.2.1" from @storybook/[email protected]
npm WARN     node_modules/@storybook/addon-info/node_modules/@storybook/api
npm WARN     3 more (@storybook/router, @storybook/api, @storybook/router)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react
npm WARN   react@"^17.0.2" from the root project
npm WARN   89 more (@emotion/core, @emotion/styled, @emotion/styled-base, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^0.14.0 || ^15.0.0 || ^16.0.0" from [email protected]
npm WARN node_modules/create-react-context
npm WARN   create-react-context@"0.3.0" from @reach/[email protected]
npm WARN   node_modules/@reach/router
npm WARN   1 more (react-popper)
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react
npm WARN   peer react@"^0.14.0 || ^15.0.0 || ^16.0.0" from [email protected]
npm WARN   node_modules/create-react-context
npm WARN     create-react-context@"0.3.0" from @reach/[email protected]
npm WARN     node_modules/@reach/router
npm WARN     1 more (react-popper)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react
npm WARN   react@"^17.0.2" from the root project
npm WARN   89 more (@emotion/core, @emotion/styled, @emotion/styled-base, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^0.14.0 || ^15.0.0 || ^16.0.0" from [email protected]
npm WARN node_modules/mini-create-react-context
npm WARN   mini-create-react-context@"^0.4.0" from [email protected]
npm WARN   node_modules/react-router
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react
npm WARN   peer react@"^0.14.0 || ^15.0.0 || ^16.0.0" from [email protected]
npm WARN   node_modules/mini-create-react-context
npm WARN     mini-create-react-context@"^0.4.0" from [email protected]
npm WARN     node_modules/react-router
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react
npm WARN   react@"^17.0.2" from the root project
npm WARN   89 more (@emotion/core, @emotion/styled, @emotion/styled-base, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^15.3.0 || ^16.0.0" from [email protected]
npm WARN node_modules/react-clientside-effect
npm WARN   react-clientside-effect@"^1.2.2" from [email protected]
npm WARN   node_modules/react-focus-lock
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react
npm WARN   peer react@"^15.3.0 || ^16.0.0" from [email protected]
npm WARN   node_modules/react-clientside-effect
npm WARN     react-clientside-effect@"^1.2.2" from [email protected]
npm WARN     node_modules/react-focus-lock
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react
npm WARN   react@"^17.0.2" from the root project
npm WARN   89 more (@emotion/core, @emotion/styled, @emotion/styled-base, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^0.14.8 || ^15.0.1 || ^16.0.0" from [email protected]
npm WARN node_modules/react-element-to-jsx-string
npm WARN   react-element-to-jsx-string@"^14.0.2" from @storybook/[email protected]
npm WARN   node_modules/@storybook/addon-info
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react
npm WARN   peer react@"^0.14.8 || ^15.0.1 || ^16.0.0" from [email protected]
npm WARN   node_modules/react-element-to-jsx-string
npm WARN     react-element-to-jsx-string@"^14.0.2" from @storybook/[email protected]
npm WARN     node_modules/@storybook/addon-info
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react-dom
npm WARN   react-dom@"^17.0.2" from the root project
npm WARN   42 more (@patternfly/react-core, @patternfly/react-icons, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react-dom@"^0.14.8 || ^15.0.1 || ^16.0.0" from [email protected]
npm WARN node_modules/react-element-to-jsx-string
npm WARN   react-element-to-jsx-string@"^14.0.2" from @storybook/[email protected]
npm WARN   node_modules/@storybook/addon-info
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react-dom
npm WARN   peer react-dom@"^0.14.8 || ^15.0.1 || ^16.0.0" from [email protected]
npm WARN   node_modules/react-element-to-jsx-string
npm WARN     react-element-to-jsx-string@"^14.0.2" from @storybook/[email protected]
npm WARN     node_modules/@storybook/addon-info
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react
npm WARN   react@"^17.0.2" from the root project
npm WARN   89 more (@emotion/core, @emotion/styled, @emotion/styled-base, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^16.8.0" from [email protected]
npm WARN node_modules/react-focus-lock
npm WARN   react-focus-lock@"^2.1.0" from @storybook/[email protected]
npm WARN   node_modules/@storybook/components
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react
npm WARN   peer react@"^16.8.0" from [email protected]
npm WARN   node_modules/react-focus-lock
npm WARN     react-focus-lock@"^2.1.0" from @storybook/[email protected]
npm WARN     node_modules/@storybook/components
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react
npm WARN   react@"^17.0.2" from the root project
npm WARN   89 more (@emotion/core, @emotion/styled, @emotion/styled-base, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^16.6.0" from [email protected]
npm WARN node_modules/react-helmet-async
npm WARN   react-helmet-async@"^1.0.2" from @storybook/[email protected]
npm WARN   node_modules/@storybook/components
npm WARN   1 more (@storybook/ui)
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react
npm WARN   peer react@"^16.6.0" from [email protected]
npm WARN   node_modules/react-helmet-async
npm WARN     react-helmet-async@"^1.0.2" from @storybook/[email protected]
npm WARN     node_modules/@storybook/components
npm WARN     1 more (@storybook/ui)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react-dom
npm WARN   react-dom@"^17.0.2" from the root project
npm WARN   42 more (@patternfly/react-core, @patternfly/react-icons, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react-dom@"^16.6.0" from [email protected]
npm WARN node_modules/react-helmet-async
npm WARN   react-helmet-async@"^1.0.2" from @storybook/[email protected]
npm WARN   node_modules/@storybook/components
npm WARN   1 more (@storybook/ui)
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react-dom
npm WARN   peer react-dom@"^16.6.0" from [email protected]
npm WARN   node_modules/react-helmet-async
npm WARN     react-helmet-async@"^1.0.2" from @storybook/[email protected]
npm WARN     node_modules/@storybook/components
npm WARN     1 more (@storybook/ui)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react
npm WARN   react@"^17.0.2" from the root project
npm WARN   89 more (@emotion/core, @emotion/styled, @emotion/styled-base, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"0.14.x || ^15.0.0 || ^16.0.0" from [email protected]
npm WARN node_modules/react-popper
npm WARN   react-popper@"^1.3.7" from [email protected]
npm WARN   node_modules/react-popper-tooltip
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react
npm WARN   peer react@"0.14.x || ^15.0.0 || ^16.0.0" from [email protected]
npm WARN   node_modules/react-popper
npm WARN     react-popper@"^1.3.7" from [email protected]
npm WARN     node_modules/react-popper-tooltip
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react
npm WARN   react@"^17.0.2" from the root project
npm WARN   89 more (@emotion/core, @emotion/styled, @emotion/styled-base, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^16.6.0" from [email protected]
npm WARN node_modules/react-popper-tooltip
npm WARN   react-popper-tooltip@"^2.8.3" from @storybook/[email protected]
npm WARN   node_modules/@storybook/components
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react
npm WARN   peer react@"^16.6.0" from [email protected]
npm WARN   node_modules/react-popper-tooltip
npm WARN     react-popper-tooltip@"^2.8.3" from @storybook/[email protected]
npm WARN     node_modules/@storybook/components
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react-dom
npm WARN   react-dom@"^17.0.2" from the root project
npm WARN   42 more (@patternfly/react-core, @patternfly/react-icons, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react-dom@"^16.6.0" from [email protected]
npm WARN node_modules/react-popper-tooltip
npm WARN   react-popper-tooltip@"^2.8.3" from @storybook/[email protected]
npm WARN   node_modules/@storybook/components
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react-dom
npm WARN   peer react-dom@"^16.6.0" from [email protected]
npm WARN   node_modules/react-popper-tooltip
npm WARN     react-popper-tooltip@"^2.8.3" from @storybook/[email protected]
npm WARN     node_modules/@storybook/components
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react
npm WARN   react@"^17.0.2" from the root project
npm WARN   89 more (@emotion/core, @emotion/styled, @emotion/styled-base, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@">=0.14.0 <17.0.0" from [email protected]
npm WARN node_modules/react-textarea-autosize
npm WARN   react-textarea-autosize@"^7.1.0" from @storybook/[email protected]
npm WARN   node_modules/@storybook/components
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react
npm WARN   peer react@">=0.14.0 <17.0.0" from [email protected]
npm WARN   node_modules/react-textarea-autosize
npm WARN     react-textarea-autosize@"^7.1.0" from @storybook/[email protected]
npm WARN     node_modules/@storybook/components
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react
npm WARN   react@"^17.0.2" from the root project
npm WARN   89 more (@emotion/core, @emotion/styled, @emotion/styled-base, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^0.14.9 || ^15.3.0 || ^16.0.0-rc || ^16.0" from [email protected]
npm WARN node_modules/simplebar-react
npm WARN   simplebar-react@"^1.0.0-alpha.6" from @storybook/[email protected]
npm WARN   node_modules/@storybook/components
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react
npm WARN   peer react@"^0.14.9 || ^15.3.0 || ^16.0.0-rc || ^16.0" from [email protected]
npm WARN   node_modules/simplebar-react
npm WARN     simplebar-react@"^1.0.0-alpha.6" from @storybook/[email protected]
npm WARN     node_modules/@storybook/components
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react-dom
npm WARN   react-dom@"^17.0.2" from the root project
npm WARN   42 more (@patternfly/react-core, @patternfly/react-icons, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react-dom@"^0.14.9 || ^15.3.0 || ^16.0.0-rc || ^16.0" from [email protected]
npm WARN node_modules/simplebar-react
npm WARN   simplebar-react@"^1.0.0-alpha.6" from @storybook/[email protected]
npm WARN   node_modules/@storybook/components
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react-dom
npm WARN   peer react-dom@"^0.14.9 || ^15.3.0 || ^16.0.0-rc || ^16.0" from [email protected]
npm WARN   node_modules/simplebar-react
npm WARN     simplebar-react@"^1.0.0-alpha.6" from @storybook/[email protected]
npm WARN     node_modules/@storybook/components
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react
npm WARN   react@"^17.0.2" from the root project
npm WARN   89 more (@emotion/core, @emotion/styled, @emotion/styled-base, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^16.8.0" from [email protected]
npm WARN node_modules/use-callback-ref
npm WARN   use-callback-ref@"^1.2.1" from [email protected]
npm WARN   node_modules/react-focus-lock
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react
npm WARN   peer react@"^16.8.0" from [email protected]
npm WARN   node_modules/use-callback-ref
npm WARN     use-callback-ref@"^1.2.1" from [email protected]
npm WARN     node_modules/react-focus-lock
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react
npm WARN   react@"^17.0.2" from the root project
npm WARN   89 more (@emotion/core, @emotion/styled, @emotion/styled-base, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^16.8.0" from [email protected]
npm WARN node_modules/use-sidecar
npm WARN   use-sidecar@"^1.0.1" from [email protected]
npm WARN   node_modules/react-focus-lock
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react
npm WARN   peer react@"^16.8.0" from [email protected]
npm WARN   node_modules/use-sidecar
npm WARN     use-sidecar@"^1.0.1" from [email protected]
npm WARN     node_modules/react-focus-lock

Title pkg throws warnings

In latest master, we get the following warning upon starting up the app for the very first time;

Screen Shot 2019-09-11 at 10 20 56 AM

It comes from a package we are using to set the document title. We should fix this so there are no out of box warnings for users to have to deal with.

Storybook broken

With the latest round of webpack upgrades, storybook seems to have broken. I did work through the noted migration steps locally, but still no luck as I get the common TypeError: Cannot read property 'tapAsync' of undefined error that others are hitting. Maybe a future storybook upgrade will fix it?

Consider converting react-seed into a template

People who want to get started in building PatternFly UIs are encouraged to fork this seed repository as a starting point for their development, however repository forking was not intended for this purpose and thus doing it this way creates some annoyances for downstream developers:

  • The new repository can only be public because the source being forked is public
  • There is an existing git commit history that is not relevant to the project being developed

This means that users who want to bypass this will most likely simply clone the repository and push into a new one which is annoying/time consuming.

GitHub provides a feature known as template repositories [1] which makes these annoyances moot, users who create new repositories off of a template will start with a blank git commit history and are free to choose between public and private visibility for the generated repository.

[1] https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-template-repository

Can't find fonts when serving from a non-root path

Use case is to take the files generated in dist/ and put them on a webserver in a non-root path.

The error I encounter when doing this is that the patternfly fonts, specified in the main.css use a url(/fonts/...) path, which forces the browser to look at the root, rather than relative to the base path.

Screen Shot 2022-01-19 at 8 50 45 PM

Is there anyway to update webpack to change this?

Import a "success" notification

The idea is that the simplest version of this build system will ONLY produce a working build and not also provide things like application layout/structure with routing and all those features. Instead, the only proof that things are up and running should be a single SUCCESS notification in the middle of the screen upon launching the app.

From there, users can take the app in any direction they choose.

CSS Variable Woes

I'm having trouble with the CSS variables. I'm trying to apply {background-position: center;} to my <BackgroundImage />, but no luck so far.

I've read about how the variable names are structured, but I'm obviously not doing it correctly (since it's not working!). I've also done the customization tutorial, but, again, there's some kind of disconnect.

I'm using the :root pseudoclass per the tutorial, and I've structured the property name based on the names given on the BackgroundImage component's doc page.

:root {
    --pf-c-background-image--BackgroundPosition: center;
}

It also fails using the css class given in the doc page, eg:

.pf-c-background-image {
    background-position: center;
}

While help with this particular issue would be lovely, what I'd really like to see would be, in the seed repo, a couple of css variable overrides in the app.css file, so users can see functional code - preferably in a css property that isn't explicitly given on the documentation pages, so users can see how to construct new ones.

404 for bundles when on deep routes

To reproduce, add a deep route - eg /some/thing - and have it served by any sample component. Then hit the refresh button; the app will fail to load because bundles are served from a path that's relative to the current route.

A way to address the issue is to add a <base href="/"> tag in the header section of the index.html file, but I wonder if that's the best way to do it.

Add typescript support

Adding the ability to test typescript components would help us:

  • cut down on extra code that is currently cluttering up the main patternfly-react repo
  • give us more traffic on the pf-seed repo to help gather feedback

bug: extra padding/space caused by hidden div not having the correct style `display: none`

Steps to reproduce:

  1. Clone this repo
  2. Add the following code after this line https://github.com/patternfly/patternfly-react-seed/blob/main/src/app/Support/Support.tsx#L39 (don't forget to add the proper imports):
    <Toolbar>
      <ToolbarContent>
        <ToolbarItem>Foo</ToolbarItem>
      </ToolbarContent>
    </Toolbar>
  1. Run npm install && npm run start:dev to start the dev server as described in the https://github.com/patternfly/patternfly-react-seed#quick-start

Actual output:
image

Expected output:
image

Additional Info:
The extra padding there is caused by the hidden div not having the proper styles. Since the div has the class pf-m-hidden and the attribute hidden it should have display: none but it actually has display: flex
image

This causes it to be part of the document and the row-gap: 24px of the toolbar causes it to put a 24px space between the actual toolbar content div and the hidden div
image

Multi environment variable support

The following request came in from a community user:

I just want a global constant that can be one thing when the environment is in dev mode (e.g. dev.blah.com), and have it be another (e.g. api.blah.com) when it's prod

Let's see if we can make this happen in a generic and simple way.

[FUTURE] Jest v24 supports Babel 7

Jest has migrated to Babel 7 (jestjs/jest#7016), and currently supported in their v24.0.0-alpha.9 build.

If we upgrade to v24 once it's available, we can remove "babel-core": "^7.0.0-bridge.0" from our package.json

CLI Support

As a developer, it's a bit cumbersome to consume pf-seed in its current form. People have to clone/fork it, find & replace a bunch of text, likely make other small adjustments to suit their needs.. before you know it what could have been a 1-minute setup turned into, well, something less straight forward.

We'd like to be able to offer some level of automatic configuration that's not possible with a single offering like we have today. For example, the ability to choose between TypeScript and JavaScript as a base language, or a specify a certain type of testing framework.

Something like the angular cli or create-react-app would really help us in both the short and long term. Yeoman has been around for a long time and has quite a community, and gives us the ability to create custom generators. similar to those I mentioned.

Let's give it a try and see what it would take to offer a TypeScript and JavaScript configuration option, as well as exposing options for setting the app name and other simple things that will keep users from having to immediately find & replace upon installing the seed project.

Storybook and Babel

Hi,

When building, the following warnings appear, followed by a page of related warnings.

warning " > @storybook/[email protected]" has unmet peer dependency "@babel/core@^7.0.1".
warning " > @storybook/[email protected]" has unmet peer dependency "babel-loader@^7.0.0 || ^8.0.0".

Mike

digital envelope routines::initialization error

Describe the bug

npm run start:dev produces error

To Reproduce
Steps to reproduce the behavior

Expected behavior

working build/service

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

cd patternfly-react-seed
npm install && npm run start:dev
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated [email protected]: deprecated
npm WARN deprecated [email protected]: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated [email protected]: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1
npm WARN deprecated @storybook/[email protected]: deprecating @storybook/addon-knobs in favor of @storybook/addon-controls
npm WARN deprecated [email protected]: Version no longer supported. Upgrade to @latest
npm WARN deprecated [email protected]: core-js@<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated [email protected]: core-js@<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.

added 3077 packages, and audited 3078 packages in 38s

230 packages are looking for funding
  run `npm fund` for details

44 vulnerabilities (3 low, 9 moderate, 30 high, 2 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

> [email protected] start:dev
> webpack serve --color --progress --config webpack.dev.js

10% building 0/1 entries 0/0 dependencies 0/0 modulesℹ 「wds」: Project is running at http://localhost:9000/
ℹ 「wds」: webpack output is served from /
ℹ 「wds」: Content not from webpack is served from ./dist
ℹ 「wds」: 404s will fallback to /index.html
Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:67:19)
    at Object.createHash (node:crypto:130:10)
    at BulkUpdateDecorator.hashFactory (/home/daemonna/patternfly-react-seed/node_modules/webpack/lib/util/createHash.js:145:18)
    at BulkUpdateDecorator.update (/home/daemonna/patternfly-react-seed/node_modules/webpack/lib/util/createHash.js:46:50)
    at OriginalSource.updateHash (/home/daemonna/patternfly-react-seed/node_modules/webpack/node_modules/webpack-sources/lib/OriginalSource.js:104:8)
    at NormalModule._initBuildHash (/home/daemonna/patternfly-react-seed/node_modules/webpack/lib/NormalModule.js:870:17)
    at handleParseResult (/home/daemonna/patternfly-react-seed/node_modules/webpack/lib/NormalModule.js:936:10)
    at /home/daemonna/patternfly-react-seed/node_modules/webpack/lib/NormalModule.js:1028:4
    at processResult (/home/daemonna/patternfly-react-seed/node_modules/webpack/lib/NormalModule.js:745:11)
    at /home/daemonna/patternfly-react-seed/node_modules/webpack/lib/NormalModule.js:809:5
node:internal/crypto/hash:67
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:67:19)
    at Object.createHash (node:crypto:130:10)
    at BulkUpdateDecorator.hashFactory (/home/daemonna/patternfly-react-seed/node_modules/webpack/lib/util/createHash.js:145:18)
    at BulkUpdateDecorator.update (/home/daemonna/patternfly-react-seed/node_modules/webpack/lib/util/createHash.js:46:50)
    at OriginalSource.updateHash (/home/daemonna/patternfly-react-seed/node_modules/webpack/node_modules/webpack-sources/lib/OriginalSource.js:104:8)
    at NormalModule._initBuildHash (/home/daemonna/patternfly-react-seed/node_modules/webpack/lib/NormalModule.js:870:17)
    at handleParseResult (/home/daemonna/patternfly-react-seed/node_modules/webpack/lib/NormalModule.js:936:10)
    at /home/daemonna/patternfly-react-seed/node_modules/webpack/lib/NormalModule.js:1028:4
    at processResult (/home/daemonna/patternfly-react-seed/node_modules/webpack/lib/NormalModule.js:745:11)
    at /home/daemonna/patternfly-react-seed/node_modules/webpack/lib/NormalModule.js:809:5 {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Example Of Routers with React Lazy and Suspense

Do you have any example of using Routers with React Lazy and Suspense .
Right Now All Routes are defined in routes.tsx
I am trying to implement Micro Front End with Remote routes using web pack module-federation

Thanks !!

IE Support Investigation

Some customers may find it desirable to support IE11, even though Patternfly does not. Let's take a shot at making this happen to see if it's possible to accomplish without having to touch PF core or react.

  • Investigate adding support for auto-prefixer as a post-processing step for our stylesheets so grid and other fancy styling techniques work in IE
  • Investigate adding support for to use css vars in IE

Refactor, standardize, and normalize

This issue is for making build/configuration/naming convention alignment type changes to the codebase. We want patternfly seed project to reflect successful aspects of other PF project setups where possible, in terms of directory structure and code-level design patterns.

Allow alternate root url to webpack

I have patternfly-react-seed running behind nginx which routes /console to it. Hitting that url, I get:

GET https://devel.example.com/app.bundle.js/ net::ERR_ABORTED 404

The source looks like this (call to script has the error):

<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8" />
    <title>Patternfly Seed</title>
    <meta id="appName" name="application-name" content="Patternfly Seed" />
  </head>

  <body>
    <noscript>Enabling JavaScript is required to run this app.</noscript>
    <div id="root"></div>
  <script type="text/javascript" src="app.bundle.js"></script></body>
</html>

Performance Issues

As the size of a project based on this seed app grows, we begin to notice performance problems, particularly around running production builds, but also even just around starting/hot-reloading the dev server. No errors per-say, but at one point I saw the dev server and prod build taking minute(s) to recompile - this is far too slow to be practical for development.

Can we make some improvements to the webpack config to make it better again?

Here's an example of how long it takes to build the empty project/start dev server on my local machine (~11 seconds).

Screen Shot 2019-07-02 at 9 11 58 AM

Screen Shot 2019-07-02 at 9 13 05 AM

Webpack doesn't bundle images correctly

When performing a production build I noticed that there images where not getting base64 encoded or copied to the dist directory during the build. The images remained in the original folder /assets/images. Since products would deliver what's in the dist directory we should update the build to copy the images over to the dist directory.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.