Move storybook to a separate repo (for now)

merge
This commit is contained in:
garronej 2023-03-22 02:42:25 +01:00
parent c2e0bd3d18
commit aa85f18796
7 changed files with 110 additions and 6762 deletions

View file

@ -130,18 +130,3 @@ jobs:
- uses: actions/setup-node@v3.6.0 - uses: actions/setup-node@v3.6.0
- run: npx -y -p gh-pages@3.0.0 gh-pages -u "github-actions-bot <actions@github.com>" -d build - run: npx -y -p gh-pages@3.0.0 gh-pages -u "github-actions-bot <actions@github.com>" -d build
# github_pages_storybook:
# runs-on: ubuntu-latest
# needs:
# - create_github_release
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-node@v3.6.0
# - uses: bahmutov/npm-install@v1
# - run: yarn build-keycloak-theme # Only for the assets in public
# - run: yarn build-storybook
# - run: git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${{github.repository}}.git
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - run: npx -y -p gh-pages@3.0.0 gh-pages -u "github-actions-bot <actions@github.com>" -d storybook-static --dest storybook --add

View file

@ -1,16 +0,0 @@
module.exports = {
"stories": [
"../src/keycloak-theme/**/*.stories.tsx",
],
"addons": [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
"@storybook/preset-create-react-app"
],
"framework": "@storybook/react",
"core": {
"builder": "@storybook/builder-webpack5"
},
"staticDirs": ['../public']
}

View file

@ -1,13 +0,0 @@
export const parameters = {
actions: {argTypesRegex: "^on[A-Z].*"},
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
options: {
storySort: (a, b) =>
a[1].kind === b[1].kind ? 0 : a[1].id.localeCompare(b[1].id, undefined, {numeric: true}),
},
}

View file

@ -1,41 +0,0 @@
import type {KcContextExtension} from "keycloak-theme/kcContext";
import KcApp from "../src/keycloak-theme/KcApp";
import {KcContextBase} from "keycloakify";
import {getKcContext} from "keycloakify/lib/getKcContext";
import {ExtendsKcContextBase} from "keycloakify/src/lib/getKcContext/getKcContextFromWindow";
import {DeepPartial} from "keycloakify/src/lib/tools/DeepPartial";
export const socialProviders = [
{loginUrl: 'google', alias: 'google', providerId: 'google', displayName: 'Google'},
{loginUrl: 'microsoft', alias: 'microsoft', providerId: 'microsoft', displayName: 'Microsoft'},
{loginUrl: 'facebook', alias: 'facebook', providerId: 'facebook', displayName: 'Facebook'},
{loginUrl: 'instagram', alias: 'instagram', providerId: 'instagram', displayName: 'Instagram'},
{loginUrl: 'twitter', alias: 'twitter', providerId: 'twitter', displayName: 'Twitter'},
{loginUrl: 'linkedin', alias: 'linkedin', providerId: 'linkedin', displayName: 'LinkedIn'},
{loginUrl: 'stackoverflow', alias: 'stackoverflow', providerId: 'stackoverflow', displayName: 'Stackoverflow'},
{loginUrl: 'github', alias: 'github', providerId: 'github', displayName: 'Github'},
{loginUrl: 'gitlab', alias: 'gitlab', providerId: 'gitlab', displayName: 'Gitlab'},
{loginUrl: 'bitbucket', alias: 'bitbucket', providerId: 'bitbucket', displayName: 'Bitbucket'},
{loginUrl: 'paypal', alias: 'paypal', providerId: 'paypal', displayName: 'PayPal'},
{loginUrl: 'openshift', alias: 'openshift', providerId: 'openshift', displayName: 'OpenShift'},
]
type PageId = (KcContextExtension | KcContextBase)['pageId']
export const template = (pageId: PageId) => {
type MockData = DeepPartial<ExtendsKcContextBase<KcContextExtension>>;
const Template = (mockData: MockData) => {
const finalMockData = {
message: undefined,
pageId,
...mockData
} as MockData
if (!("message" in mockData)) mockData["message"] = undefined
const {kcContext} = getKcContext<KcContextExtension>({mockPageId: pageId, mockData: [finalMockData]})
return <KcApp kcContext={kcContext as NonNullable<typeof kcContext>}/>
}
return (args: MockData) => Object.assign(Template.bind({}), {args})
}

View file

@ -5,9 +5,7 @@
<img src="https://github.com/codegouvfr/keycloakify-starter/workflows/ci/badge.svg?branch=main"> <img src="https://github.com/codegouvfr/keycloakify-starter/workflows/ci/badge.svg?branch=main">
<br/> <br/>
<br/> <br/>
<a href="https://starter.keycloakify.dev">Demo authenticated React SPA</a> <a href="https://starter.keycloakify.dev">Authenticated React SPA</a>
-
<a href="https://starter.keycloakify.dev/storybook">Keycloak theme Storybook</a>
</p> </p>
# Introduction # Introduction
@ -47,8 +45,7 @@ npx download-builtin-keycloak-theme
# The CI workflow # The CI workflow
- You need to manually allow GitHub Action to push on your repositroy. For this reason the initial setup will fail. You need to enabled permission and re-run failed job: [see video](https://user-images.githubusercontent.com/6702424/213480604-0aac0ea7-487f-491d-94ae-df245b2c7ee8.mov). - You need to manually allow GitHub Action to push on your repositroy. For this reason the initial setup will fail. You need to enabled permission and re-run failed job: [see video](https://user-images.githubusercontent.com/6702424/213480604-0aac0ea7-487f-491d-94ae-df245b2c7ee8.mov).
- This CI is configured to publish [the app](https://starter.keycloakify.dev) and [the Storybook of the Keycloak theme](https://starter.keycloakify.dev/storybook) on [GitHub Pages](https://github.com/codegouvfr/keycloakify-starter/blob/3617a71deb1a6544c3584aa8d6d2241647abd48c/.github/workflows/ci.yaml#L51-L76) and on [DockerHub](https://github.com/codegouvfr/keycloakify-starter/blob/3617a71deb1a6544c3584aa8d6d2241647abd48c/.github/workflows/ci.yaml#L78-L123) (as ngnix based docker image). In practice you probably want one - This CI is configured to publish [the app](https://starter.keycloakify.dev) on [GitHub Pages](https://github.com/codegouvfr/keycloakify-starter/blob/3617a71deb1a6544c3584aa8d6d2241647abd48c/.github/workflows/ci.yaml#L51-L76) and on [DockerHub](https://github.com/codegouvfr/keycloakify-starter/blob/3617a71deb1a6544c3584aa8d6d2241647abd48c/.github/workflows/ci.yaml#L78-L123) (as a Ngnix based docker image). In practice you probably want one or the other but not both... or neither if you are just building a theme (and not a theme + an app).
or the other but not both... or neither if you are just building a theme (and not a theme + an app).
If you want to enable the CI to publish on DockerHub on your behalf go to repository `Settings` tab, then `Secrets` you will need to add two new secrets: If you want to enable the CI to publish on DockerHub on your behalf go to repository `Settings` tab, then `Secrets` you will need to add two new secrets:
`DOCKERHUB_TOKEN`, you Dockerhub authorization token. `DOCKERHUB_TOKEN`, you Dockerhub authorization token.
`DOCKERHUB_USERNAME`, Your Dockerhub username. `DOCKERHUB_USERNAME`, Your Dockerhub username.
@ -213,7 +210,6 @@ jobs:
prerelease: \${{ needs.check_if_version_upgraded.outputs.is_release_beta == 'true' }} prerelease: \${{ needs.check_if_version_upgraded.outputs.is_release_beta == 'true' }}
env: env:
GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
# - run: npx -y -p gh-pages@3.0.0 gh-pages -u "github-actions-bot <actions@github.com>" -d storybook-static --dest storybook --add
``` ```
You can also remove `jwt-decode`, `keycloak-js`, `powerhooks` and `tsafe` from your dependencies. You can also remove `jwt-decode`, `keycloak-js`, `powerhooks` and `tsafe` from your dependencies.

View file

@ -12,9 +12,7 @@
"build": "react-scripts build", "build": "react-scripts build",
"build-keycloak-theme": "yarn build && keycloakify", "build-keycloak-theme": "yarn build && keycloakify",
"eject-keycloak-page": "eject-keycloak-page", "eject-keycloak-page": "eject-keycloak-page",
"download-builtin-keycloak-theme": "download-builtin-keycloak-theme", "download-builtin-keycloak-theme": "download-builtin-keycloak-theme"
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook"
}, },
"keycloakify": { "keycloakify": {
"extraLoginPages": [ "extraLoginPages": [
@ -37,19 +35,9 @@
"powerhooks": "^0.26.2", "powerhooks": "^0.26.2",
"react": "18.1.0", "react": "18.1.0",
"react-dom": "18.1.0", "react-dom": "18.1.0",
"tsafe": "^1.4.3" "tsafe": "^1.6.0"
}, },
"devDependencies": { "devDependencies": {
"@storybook/addon-actions": "^6.5.16",
"@storybook/addon-essentials": "^6.5.16",
"@storybook/addon-interactions": "^6.5.16",
"@storybook/addon-links": "^6.5.16",
"@storybook/builder-webpack5": "^6.5.16",
"@storybook/manager-webpack5": "^6.5.16",
"@storybook/node-logger": "^6.5.16",
"@storybook/preset-create-react-app": "^4.1.2",
"@storybook/react": "^6.5.16",
"@storybook/testing-library": "^0.0.13",
"@types/node": "^15.3.1", "@types/node": "^15.3.1",
"@types/react": "18.0.9", "@types/react": "18.0.9",
"@types/react-dom": "18.0.4", "@types/react-dom": "18.0.4",

6761
yarn.lock

File diff suppressed because it is too large Load diff