Skip to content

Commit bafb89b

Browse files
committed
Moved repository to cloudx project
1 parent 9f2384c commit bafb89b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+23460
-0
lines changed

.eslintrc

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
// tells eslint to use the TypeScript parser
3+
"parser": "@typescript-eslint/parser",
4+
// tell the TypeScript parser that we want to use JSX syntax
5+
"parserOptions": {
6+
"tsx": true,
7+
"jsx": true,
8+
"js": true,
9+
"useJSXTextNode": true,
10+
"project": "./tsconfig.json",
11+
"tsconfigRootDir": "."
12+
},
13+
// we want to use the recommended rules provided from the typescript plugin
14+
"extends": [
15+
"eslint:recommended",
16+
"plugin:react/recommended",
17+
"plugin:@typescript-eslint/recommended"
18+
],
19+
"globals": {
20+
"window": "readonly",
21+
"describe": "readonly",
22+
"test": "readonly",
23+
"expect": "readonly",
24+
"it": "readonly",
25+
"process": "readonly",
26+
"document": "readonly"
27+
},
28+
"settings": {
29+
"react": {
30+
"version": "^16.11.0"
31+
}
32+
},
33+
// includes the typescript specific rules found here: https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#supported-rules
34+
"plugins": [
35+
"@typescript-eslint",
36+
"react-hooks",
37+
"eslint-plugin-react-hooks"
38+
],
39+
"rules": {
40+
"@typescript-eslint/explicit-function-return-type": "off",
41+
"react-hooks/rules-of-hooks": "error",
42+
"react-hooks/exhaustive-deps": "warn",
43+
"@typescript-eslint/interface-name-prefix": "off",
44+
"prettier/prettier": "off",
45+
"import/no-unresolved": "off",
46+
"import/extensions": "off",
47+
"react/prop-types": "off"
48+
},
49+
"env": {
50+
"browser": true,
51+
"node": true
52+
}
53+
}

.github/workflows/main.yaml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Github Page Deployment
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths-ignore:
8+
- LICENSE
9+
- README.md
10+
- .gitignore
11+
- .github/**
12+
pull_request:
13+
branches:
14+
- main
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
strategy:
19+
matrix:
20+
node-version: [18.x]
21+
steps:
22+
- uses: actions/checkout@v2
23+
- name: Use Node.js ${{ matrix.node-version }}
24+
uses: actions/setup-node@v2
25+
with:
26+
node-version: ${{ matrix.node-version }}
27+
cache: 'npm'
28+
- name: Install Packages
29+
run: npm ci
30+
- name: Perform Tests
31+
run: npm test
32+
- name: Perform Audit
33+
run: npm audit --production

.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
**/node_modules
2+
dist
3+
yarn-error.log
4+
yarn.lock
5+
stats.json
6+
coverage
7+
.DS_Store
8+
.idea
9+
.env

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package.json

.prettierrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"singleQuote": true,
3+
"printWidth": 120
4+
}

README.md

+113
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# DISCLAIMER
2+
3+
Based on the [Patternfly Seed](https://github.com/patternfly/patternfly-react-seed) mentioned below.
4+
5+
## Patternfly Seed
6+
7+
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.
8+
9+
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.
10+
11+
<img width="1058" alt="Out of box dashboard view of patternfly seed" src="https://user-images.githubusercontent.com/5942899/103803761-03a0a500-501f-11eb-870a-345d7d035e6b.png">
12+
13+
### Quick-start
14+
15+
```bash
16+
git clone https://github.com/patternfly/patternfly-react-seed
17+
cd patternfly-react-seed
18+
npm install && npm run start:dev
19+
```
20+
### Development scripts
21+
```sh
22+
# Install development/build dependencies
23+
npm install
24+
25+
# Start the development server
26+
npm run start:dev
27+
28+
# Run a production build (outputs to "dist" dir)
29+
npm run build
30+
31+
# Run the test suite
32+
npm run test
33+
34+
# Run the test suite with coverage
35+
npm run test:coverage
36+
37+
# Run the linter
38+
npm run lint
39+
40+
# Run the code formatter
41+
npm run format
42+
43+
# Launch a tool to inspect the bundle size
44+
npm run bundle-profile:analyze
45+
46+
# Start the express server (run a production build first)
47+
npm run start
48+
49+
# Start storybook component explorer
50+
npm run storybook
51+
52+
# Build storybook component explorer as standalone app (outputs to "storybook-static" dir)
53+
npm run build:storybook
54+
```
55+
56+
### Configurations
57+
* [TypeScript Config](./tsconfig.json)
58+
* [Webpack Config](./webpack.common.js)
59+
* [Jest Config](./jest.config.js)
60+
* [Editor Config](./.editorconfig)
61+
62+
### Raster image support
63+
64+
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.
65+
66+
For example:
67+
```js
68+
import imgSrc from '@assets/images/g_sizing.png';
69+
<img src={imgSrc} alt="Some image" />
70+
```
71+
72+
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.
73+
74+
```js
75+
import loader from '@app/assets/images/loader.gif';
76+
<img src={loader} alt="Content loading />
77+
```
78+
79+
### Vector image support
80+
Inlining SVG in the app's markup is also possible.
81+
82+
```js
83+
import logo from '@app/assets/images/logo.svg';
84+
<span dangerouslySetInnerHTML={{__html: logo}} />
85+
```
86+
87+
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](./webpack.common.js#L5)). 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.
88+
```css
89+
body {
90+
background: url(./assets/bgimages/img_avatar.svg);
91+
}
92+
```
93+
94+
### Adding custom CSS
95+
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](./stylePaths.js). We specify these explicity for performance reasons to avoid webpack needing to crawl through the entire node_modules directory when parsing CSS modules.
96+
97+
### Code quality tools
98+
* For accessibility compliance, we use [react-axe](https://github.com/dequelabs/react-axe)
99+
* To keep our bundle size in check, we use [webpack-bundle-analyzer](https://github.com/webpack-contrib/webpack-bundle-analyzer)
100+
* To keep our code formatting in check, we use [prettier](https://github.com/prettier/prettier)
101+
* To keep our code logic and test coverage in check, we use [jest](https://github.com/facebook/jest)
102+
* To ensure code styles remain consistent, we use [eslint](https://eslint.org/)
103+
* To provide a place to showcase custom components, we integrate with [storybook](https://storybook.js.org/)
104+
105+
### Multi environment configuration
106+
This project uses [dotenv-webpack](https://www.npmjs.com/package/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:
107+
108+
```sh
109+
ENV_1=http://1.myendpoint.com
110+
ENV_2=http://2.myendpoint.com
111+
```
112+
113+
With that in place, you can use the values in your code like `console.log(process.env.ENV_1);`

dr-surge.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
const indexPath = path.resolve(__dirname, 'dist/index.html');
4+
const targetFilePath = path.resolve(__dirname, 'dist/200.html');
5+
// ensure we have bookmarkable url's when publishing to surge
6+
// https://surge.sh/help/adding-a-200-page-for-client-side-routing
7+
fs.createReadStream(indexPath).pipe(fs.createWriteStream(targetFilePath));

jest.config.js

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// For a detailed explanation regarding each configuration property, visit:
2+
// https://jestjs.io/docs/en/configuration.html
3+
4+
module.exports = {
5+
// Automatically clear mock calls and instances between every test
6+
clearMocks: true,
7+
8+
// Indicates whether the coverage information should be collected while executing the test
9+
collectCoverage: false,
10+
11+
// The directory where Jest should output its coverage files
12+
coverageDirectory: 'coverage',
13+
14+
// An array of directory names to be searched recursively up from the requiring module's location
15+
moduleDirectories: [
16+
"node_modules",
17+
"<rootDir>/src"
18+
],
19+
20+
// A map from regular expressions to module names that allow to stub out resources with a single module
21+
moduleNameMapper: {
22+
'\\.(css|less)$': '<rootDir>/__mocks__/styleMock.js',
23+
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
24+
"@app/(.*)": '<rootDir>/src/app/$1'
25+
},
26+
27+
// A preset that is used as a base for Jest's configuration
28+
preset: "ts-jest/presets/js-with-ts",
29+
30+
// The path to a module that runs some code to configure or set up the testing framework before each test
31+
setupFilesAfterEnv: ['<rootDir>/test-setup.js'],
32+
33+
// The test environment that will be used for testing.
34+
testEnvironment: "jsdom",
35+
36+
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
37+
snapshotSerializers: ['enzyme-to-json/serializer'],
38+
39+
};

0 commit comments

Comments
 (0)