Skip to content
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
10 changes: 3 additions & 7 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ jobs:
- name: Enable corepack
run: corepack enable

- name: Install dependencies
run: make deps

- name: Build
run: make build

- name: Generate assets
run: make static-assets
run: make static-assets-pr
env:
IS_PR: 'true'
8 changes: 2 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,10 @@ jobs:
- name: Enable corepack
run: corepack enable

- name: Install dependencies
run: make deps

- name: Build
run: make build

- name: Generate assets
run: make static-assets
env:
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}

# https://github.com/marketplace/actions/github-pages
- name: Deploy to GitHub Pages
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/coverage

# production
/build
/dist
/static-assets

# misc
Expand Down
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,15 @@ clean:
mkdir -p static-assets

static-assets: build
cp build/static/js/*.js static-assets/main-v1.js
cp dist/hub-button-app.js static-assets/main-v1.js
cp dist/hub-button-app.js.sig static-assets/main-v1.js.sig
cp dist/hub-button-app.js.map static-assets/main-v1.js.map
sed -i -E '[email protected]@https:\/\/traefik.github.io\/traefiklabs-hub-button-app\/main-v1.js@' static-assets/main-v1.js.map

static-assets-pr: build
cp dist/hub-button-app.js static-assets/main-v1.js
sed -i '1s@.*@\/* eslint-disable *\/@' static-assets/main-v1.js
sed -i '23s@.*@\/\/# sourceMappingURL=https:\/\/traefik.github.io\/traefiklabs-hub-button-app\/main-v1.js.map@' static-assets/main-v1.js
cp build/static/js/*.js.map static-assets/main-v1.js.map
sed -i -E '1s@static\/js\/main.[0-9a-zA-Z]{8}.js@https:\/\/traefik.github.io\/traefiklabs-hub-button-app\/main-v1.js@' static-assets/main-v1.js.map

cp dist/hub-button-app.js.map static-assets/main-v1.js.map
sed -i -E '[email protected]@https:\/\/traefik.github.io\/traefiklabs-hub-button-app\/main-v1.js@' static-assets/main-v1.js.map
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ Check the page that opens if the Header is properly rendered and if the latest p
- `yarn install`
- `yarn build`

It will create a `build` folder with the compiled assets.
It will create a `dist` folder with the compiled assets.

**Note**: You will need a `PRIVATE_KEY` env variable to complete the build process. You can find the value on Bitwarden.

## How to use

Expand Down Expand Up @@ -56,4 +58,5 @@ lines:
### Deployment URLs

- https://traefik.github.io/traefiklabs-hub-button-app/main-v1.js
- https://traefik.github.io/traefiklabs-hub-button-app/main-v1.js.sig
- https://traefik.github.io/traefiklabs-hub-button-app/main-v1.js.map
13 changes: 13 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Hub button app</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,26 @@
"@types/styled-components": "^5.1.26",
"@typescript-eslint/eslint-plugin": "^8.38.0",
"@typescript-eslint/parser": "^8.38.0",
"@vitejs/plugin-react": "^5.1.0",
"eslint": "^8.57.1",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-import": "^2.32.0",
"prettier": "^3.6.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"styled-components": "^5.3.5",
"typescript": "^4.9.5",
"vite": "^7.1.12",
"vite-tsconfig-paths": "^5.1.4",
"web-vitals": "^2.1.4"
},
"scripts": {
"format": "prettier './src/**/*.{ts,tsx}' --config .prettierrc.json --write",
"lint": "eslint './src/**/*.{ts,tsx}'",
"lint:fix": "eslint --fix './src/**/*.{ts,tsx}'",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"browserslist": {
"production": [
Expand All @@ -48,5 +49,5 @@
"last 1 safari version"
]
},
"packageManager": "yarn@4.9.2"
"packageManager": "yarn@4.10.3"
}
165 changes: 0 additions & 165 deletions public/index.html

This file was deleted.

6 changes: 5 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import HubButton from 'components/HubButton'

export const App = ({ style }: { style?: string }) => {
return <HubButton style={style} />
return (
<div style={{ height: 500, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
<HubButton style={style} />
</div>
)
}

export default App
15 changes: 15 additions & 0 deletions src/WebComponent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import HubButton from 'components/HubButton'

export const WebComponent = ({
style,
side,
align,
}: {
style?: string
side?: 'top' | 'bottom'
align: 'left' | 'center' | 'right'
}) => {
return <HubButton style={style} side={side} align={align} />
}

export default WebComponent
Loading