Skip to content

Commit

Permalink
Add starter; add nvmrc; add yarn to package.json; copy over Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
fhennig committed Nov 21, 2024
1 parent c75883f commit b363cbd
Show file tree
Hide file tree
Showing 119 changed files with 15,130 additions and 8,688 deletions.
46 changes: 24 additions & 22 deletions keycloak/keycloakify/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:react-hooks/recommended', 'plugin:storybook/recommended'],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
root: true,
env: { browser: true, es2020: true },
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react-hooks/recommended",
"plugin:storybook/recommended"
],
'react-hooks/exhaustive-deps': 'off',
'@typescript-eslint/no-redeclare': 'off',
'no-labels': 'off',
},
overrides: [
{
files: ['**/*.stories.*'],
rules: {
'import/no-anonymous-default-export': 'off',
},
ignorePatterns: ["dist", ".eslintrc.cjs"],
parser: "@typescript-eslint/parser",
plugins: ["react-refresh"],
rules: {
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
"react-hooks/exhaustive-deps": "off",
"@typescript-eslint/no-redeclare": "off",
"no-labels": "off"
},
],
}
overrides: [
{
files: ["**/*.stories.*"],
rules: {
"import/no-anonymous-default-export": "off"
}
}
]
};
55 changes: 55 additions & 0 deletions keycloak/keycloakify/.github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: ci
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: bahmutov/npm-install@v1
- run: npm run build-keycloak-theme

check_if_version_upgraded:
name: Check if version upgrade
if: github.event_name == 'push'
runs-on: ubuntu-latest
needs: test
outputs:
from_version: ${{ steps.step1.outputs.from_version }}
to_version: ${{ steps.step1.outputs.to_version }}
is_upgraded_version: ${{ steps.step1.outputs.is_upgraded_version }}
is_pre_release: ${{steps.step1.outputs.is_pre_release }}
steps:
- uses: garronej/[email protected]
id: step1
with:
action_name: is_package_json_version_upgraded
branch: ${{ github.head_ref || github.ref }}

create_github_release:
runs-on: ubuntu-latest
needs: check_if_version_upgraded
if: needs.check_if_version_upgraded.outputs.is_upgraded_version == 'true'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: bahmutov/npm-install@v1
- run: npm run build-keycloak-theme
- uses: softprops/action-gh-release@v2
with:
name: Release v${{ needs.check_if_version_upgraded.outputs.to_version }}
tag_name: v${{ needs.check_if_version_upgraded.outputs.to_version }}
target_commitish: ${{ github.head_ref || github.ref }}
generate_release_notes: true
draft: false
prerelease: ${{ needs.check_if_version_upgraded.outputs.is_pre_release == 'true' }}
files: dist_keycloak/keycloak-theme-*.jar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion keycloak/keycloakify/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ jspm_packages

/dist_keycloak
/build
/storybook-static
/storybook-static
6 changes: 6 additions & 0 deletions keycloak/keycloakify/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules/
/dist/
/dist_keycloak/
/public/keycloakify-dev-resources/
/.vscode/
/.yarn_home/
25 changes: 25 additions & 0 deletions keycloak/keycloakify/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"printWidth": 90,
"tabWidth": 4,
"useTabs": false,
"semi": true,
"singleQuote": false,
"trailingComma": "none",
"bracketSpacing": true,
"arrowParens": "avoid",
"overrides": [
{
"files": [
"**/login/pages/*.tsx",
"**/account/pages/*.tsx",
"**/login/Template.tsx",
"**/account/Template.tsx",
"**/login/UserProfileFormFields.tsx",
"KcApp.tsx"
],
"options": {
"printWidth": 150
}
}
]
}
23 changes: 7 additions & 16 deletions keycloak/keycloakify/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
import type { StorybookConfig } from "@storybook/react-vite";

const config: StorybookConfig = {
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-onboarding",
"@storybook/addon-interactions",
"@chromatic-com/storybook"
],
framework: {
name: "@storybook/react-vite",
options: {},
},
docs: {
autodocs: "tag",
},
staticDirs: ["../public"],
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
addons: [],
framework: {
name: "@storybook/react-vite",
options: {}
},
staticDirs: ["../public"]
};
export default config;
25 changes: 25 additions & 0 deletions keycloak/keycloakify/.storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<style>
body.sb-show-main.sb-main-padded {
padding: 0;
}

/* Following styles are just meant to avoid white flash when switching from one story to another */
@keyframes fadeToTransparent {
from {
background-color: #393939;
}

to {
background-color: transparent;
}
}
html {
animation: fadeToTransparent 500ms forwards ease-in;
}
body > .sb-preparing-docs {
visibility: hidden;
}
body > .sb-preparing-story {
visibility: hidden;
}
</style>
16 changes: 8 additions & 8 deletions keycloak/keycloakify/.storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import type { Preview } from "@storybook/react";

const preview: Preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i
}
}
}
};

export default preview;
2 changes: 0 additions & 2 deletions keycloak/keycloakify/LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
MIT License

This license applies specifically to this directory

Copyright (c) 2020 GitHub user u/garronej

Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
62 changes: 43 additions & 19 deletions keycloak/keycloakify/README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,60 @@
# Keycloakify theme
<p align="center">
<i>🚀 <a href="https://keycloakify.dev">Keycloakify</a> v11 starter 🚀</i>
<br/>
<br/>
</p>

This is a keycloak theme, built with keycloakify, and branched from <https://github.com/keycloakify/keycloakify-starter>.
This starter is based on Vite. There is also [a Webpack based starter](https://github.com/keycloakify/keycloakify-starter-webpack).

We last synced with upstream on 2024-05-11.

To preview in the storybook:
# Quick start

```bash
nvm use # use the correct node version
yarn install --immutable # install dependencies (it's like npm install)
yarn storybook
git clone https://github.com/keycloakify/keycloakify-starter
cd keycloakify-starter
yarn install # Or use an other package manager, just be sure to delete the yarn.lock if you use another package manager.
```

To build a JAR and package it into an image that copies it to an output directory, build the Dockerfile. (This is done by CI).
# Testing the theme locally

[Documentation](https://docs.keycloakify.dev/v/v10/testing-your-theme)

Currently, only the login theme is implemented.
# How to customize the theme

## Dependency documentation
[Documentation](https://docs.keycloakify.dev/v/v10/customization-strategies)

### Keycloakify
# Building the theme

https://docs.keycloakify.dev/
You need to have [Maven](https://maven.apache.org/) installed to build the theme (Maven >= 3.1.1, Java >= 7).
The `mvn` command must be in the $PATH.

### Keycloak ORCID
- On macOS: `brew install maven`
- On Debian/Ubuntu: `sudo apt-get install maven`
- On Windows: `choco install openjdk` and `choco install maven` (Or download from [here](https://maven.apache.org/download.cgi))

https://github.com/eosc-kc/keycloak-orcid
```bash
npm run build-keycloak-theme
```

## Installing yarn 4
Note that by default Keycloakify generates multiple .jar files for different versions of Keycloak.
You can customize this behavior, see documentation [here](https://docs.keycloakify.dev/targeting-specific-keycloak-versions).

Prerequisite: node
# Initializing the account theme

```bash
corepack enable
corepack install yarn
npx keycloakify initialize-account-theme
```

# Initializing the email theme

```bash
npx keycloakify initialize-email-theme
```

# GitHub Actions

The starter comes with a generic GitHub Actions workflow that builds the theme and publishes
the jars [as GitHub releases artifacts](https://github.com/keycloakify/keycloakify-starter/releases/tag/v10.0.0).
To release a new version **just update the `package.json` version and push**.

To enable the workflow go to your fork of this repository on GitHub then navigate to:
`Settings` > `Actions` > `Workflow permissions`, select `Read and write permissions`.
43 changes: 13 additions & 30 deletions keycloak/keycloakify/index.html
Original file line number Diff line number Diff line change
@@ -1,31 +1,14 @@
<!doctype html>
<html lang="en">

<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

<!--
Notice the use of %BASE_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%BASE_URL%favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
-->
<link rel="icon" type="image/svg+xml" sizes="32x32" href="%BASE_URL%favicon.svg">

<title>Loculus Authentication</title>

<meta name="keycloakify-ignore-start">
<script>console.log("This is logged Only in the main app, stripped out in the theme")</script>
<meta name="keycloakify-ignore-end">

</head>

<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>

</html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
</head>

<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Loading

0 comments on commit b363cbd

Please sign in to comment.