Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial Setup of Storybook, React App, CICD deploy to GitHub pages #16

Merged
merged 7 commits into from
Jun 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions .github/workflows/autotest.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
name: Rucio WebUI Autotests

on:
push:
pull_request:
push:
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup NodeJS
uses: actions/setup-node@v2
with:
node-version: 16.14.0
- name: Install project in clean state
run: npm clean-install
- name: Run tests
run: npm test
- name: Format code
run: npm run prettier
- name: Lint
run: npm run lint
- name: Check TypeScript
run: npm run typescript
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup NodeJS
uses: actions/setup-node@v2
with:
node-version: 16.14.0
- name: Install project in clean state
run: npm clean-install
- name: Run tests
run: npm test
- name: Format code
run: npm run prettier
- name: Lint
run: npm run lint
- name: Check TypeScript
run: npm run typescript
24 changes: 24 additions & 0 deletions .github/workflows/build-deploy-storybook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build and Deploy Rucio WebUI
on:
push:
branches:
- master
permissions:
contents: write
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3

- name: Install and Build 🔧
run: |
npm install --legacy-peer-deps
npm run build-storybook

- name: Deploy 🚀
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace with a custom script to push to gh-pages branch :)

uses: JamesIves/github-pages-deploy-action@v4.3.3
with:
branch: gh-pages
folder: docs
92 changes: 16 additions & 76 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,85 +1,25 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock


# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/


# TypeScript cache
*.tsbuildinfo

# Coverage reports
coverage
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# Optional npm cache directory
.npm
# dependencies
/node_modules
/.pnp
.pnp.js

# Optional eslint cache
.eslintcache
# testing
/coverage

# Optional stylelint cache
.stylelintcache
# production
/build

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# common ide's
.vscode
.idea
.devcontainer
package-lock.json
16 changes: 16 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
"stories": [
"../src/**/*.stories.mdx",
"../src/**/*.stories.@(js|jsx|ts|tsx)"
],
"addons": [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
"@storybook/preset-create-react-app"
],
"framework": "@storybook/react",
"core": {
"builder": "@storybook/builder-webpack5"
}
}
9 changes: 9 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
}
71 changes: 70 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,70 @@
# Rucio WEBUI 2.0
# Getting Started with Rucio WebUI

## Installation

In the project directory, you can run:

#### `npm i --legacy-peer-deps`

This step will install all the dependencies required to run both, our [Storybook](https://storybook.js.org/) & [React App](https://reactjs.org/).

## Getting Started with Storybook

In the project directory, you can run:

#### `npm run storybook`

Runs the storybook in the development mode.\
Open [http://localhost:6006](http://localhost:6006) to view it in the browser.

The page will reload if you make edits.\
You will also see any lint errors in the console.

#### `npm run build-storybook`

Builds the app for production to the `build` folder.\
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.\
Your app is ready to be deployed!

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

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

## Getting Started with Create React App

In the project directory, you can run:

#### `npm start`

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

The page will reload if you make edits.\
You will also see any lint errors in the console.

#### `npm test`

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

#### `npm run build`

Builds the app for production to the `build` folder.\
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.\
Your app is ready to be deployed!

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

#### `npm run 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.
57 changes: 43 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,17 @@
],
"license": "Apache v2.0",
"dependencies": {
"@testing-library/jest-dom": "^5.16.2",
"@testing-library/react": "^12.1.3",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.3.0",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^27.4.1",
"@types/node": "^16.11.26",
"@types/react": "^17.0.39",
"@types/react-dom": "^17.0.13",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "^6.2.2",
"react-scripts": "5.0.0",
"tsc-files": "^1.1.3",
"typescript": "^4.6.2",
"@types/jest": "^27.5.2",
"@types/node": "^16.11.38",
"@types/react": "^18.0.11",
"@types/react-dom": "^18.0.5",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"react-scripts": "5.0.1",
"typescript": "^4.7.3",
"web-vitals": "^2.1.4"
},
"scripts": {
Expand All @@ -34,7 +32,25 @@
"prettier": "prettier -c src",
"husky-install": "husky install",
"typescript": "tsc --project tsconfig.json --noEmit",
"eject": "react-scripts eject"
"eject": "react-scripts eject",
"storybook": "start-storybook -p 6006 -s public",
"build-storybook": "build-storybook -o docs -s public"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
],
"overrides": [
{
"files": [
"**/*.stories.*"
],
"rules": {
"import/no-anonymous-default-export": "off"
}
}
]
},
"browserslist": {
"production": [
Expand All @@ -51,9 +67,22 @@
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.14.0",
"@typescript-eslint/parser": "^5.14.0",
"@storybook/addon-actions": "^6.5.6",
"@storybook/addon-essentials": "^6.5.6",
"@storybook/addon-interactions": "^6.5.6",
"@storybook/addon-links": "^6.5.6",
"@storybook/builder-webpack5": "^6.5.6",
"@storybook/manager-webpack5": "^6.5.6",
"@storybook/node-logger": "^6.5.6",
"@storybook/preset-create-react-app": "^4.1.2",
"@storybook/react": "^6.5.6",
"@storybook/testing-library": "^0.0.11",
"babel-plugin-named-exports-order": "^0.0.2",
"eslint": "^8.10.0",
"husky": "^7.0.4",
"lint-staged": "^12.3.5",
"prettier": "^2.5.1"
"prettier": "^2.5.1",
"prop-types": "^15.8.1",
"webpack": "^5.73.0"
}
}
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function App() {
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.tsx</code> and save to reload. Ok
Edit <code>src/App.tsx</code> and save to reload.
</p>
<a
className="App-link"
Expand Down
6 changes: 3 additions & 3 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React from 'react'
import ReactDOM from 'react-dom'
import ReactDOM from 'react-dom/client'
import './index.css'
import App from './App'
import reportWebVitals from './reportWebVitals'

ReactDOM.render(
const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement)
root.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root'),
)

// If you want to start measuring performance in your app, pass a function
Expand Down
Loading