Skip to content

Commit

Permalink
migrate to v3 (#75)
Browse files Browse the repository at this point in the history
* migrate to docusaurus v3
- migrate to slides from jsx to tsx
- migrate configs from js to ts

* Update Dependencies

* enable deploy preview

* fix formatting

* Fix Generic Class Diagrams

* Update actions

---------

Co-authored-by: Steffen Merk <[email protected]>
  • Loading branch information
SteffenLm and Steffen Merk authored Nov 8, 2023
1 parent e77860c commit e408543
Show file tree
Hide file tree
Showing 51 changed files with 8,556 additions and 14,933 deletions.
24 changes: 10 additions & 14 deletions .github/workflows/docs_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,34 @@ on:
push:
branches:
- main

jobs:
deploy:
name: Deploy to GitHub Pages
name: deploy current jappuccini documentation to GitHub Pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
- name: checkout repository
uses: actions/checkout@v4

- name: setup nodejs
uses: actions/setup-node@v4
with:
node-version: 18
cache: npm

- name: Install dependencies
- name: install dependencies
run: npm ci

- name: check formatting
run: npm run prettier:check

- name: Build website
- name: build website
run: npm run build

# Popular action to deploy to GitHub Pages:
# Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus
- name: Deploy to GitHub Pages
- name: deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Build output to publish to the `gh-pages` branch:
publish_dir: ./build
# The following lines assign commit authorship to the official
# GH-Actions bot for deploys to `gh-pages` branch:
# https://github.com/actions/checkout/issues/13#issuecomment-724415212
# The GH actions bot is used by default if you didn't specify the two fields.
# You can swap them out with your own user credentials.
user_name: github-actions[bot]
user_email: 41898282+github-actions[bot]@users.noreply.github.com
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@ name: Pull Request Checks

on:
pull_request:

jobs:
ci:
runs-on: ubuntu-latest
name: verify buildable state
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: setup nodejs
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
cache: npm

- name: install dependencies
run: npm ci
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/pull_request_deploy_preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Deploy PR previews

on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed

concurrency:
group: preview-${{ github.ref }}
cancel-in-progress: true

jobs:
deploy-preview:
name: deploy current branch to GitHub Pages
runs-on: ubuntu-latest
if: github.event.action != 'closed'
steps:
- name: checkout repository
uses: actions/checkout@v4

- name: setup nodejs
uses: actions/setup-node@v4
with:
node-version: 18
cache: npm

- name: install dependencies
run: npm ci

- name: build website
run: npm run build
env:
BASE_URL: /java-docs/pr-preview/pr-${{ github.event.number }}

- name: deploy preview
uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./build/

undeploy-preview:
name: undeploy current branch from GitHub Pages
runs-on: ubuntu-latest
if: github.event.action == 'closed'
steps:
- name: checkout repository
uses: actions/checkout@v4

- name: Deploy preview
uses: rossjrw/pr-preview-action@v1
4 changes: 2 additions & 2 deletions docs/additional-material/daniel-java2/sample-exam.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ classDiagram
<<record>>
-name String
-universe Universe
-members Map~T&#44&#160Boolean~
-members Map~T&sbquo; Boolean~
+addSuperHuman(t T) void
+getMostPowerfulSuperHuman() Optional~T~
+getAllAvailableSuperHumans() List~T~
Expand Down Expand Up @@ -196,7 +196,7 @@ classDiagram
<<record>>
-name String
-universe Universe
-members Map~T&#44&#160Boolean~
-members Map~T&sbquo; Boolean~
+addSuperHuman(t T) void
+getMostPowerfulSuperHuman() Optional~T~
+getAllAvailableSuperHumans() List~T~
Expand Down
4 changes: 2 additions & 2 deletions docs/additional-material/steffen.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,8 @@ classDiagram
+q1() Phone~Car~
+q2() OptionalDouble
+q3(maxPrice: double) List~Phone~
+q4() Map~String&#44&#160Phone~
+q5() Map~String&#44&#160List~Phone~~
+q4() Map~String&sbquo; Phone~
+q5() Map~String&sbquo; List~Phone~~
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/exam-exercises/exam-exercises-java2/corner-shop.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ classDiagram
class CornerShop {
<<record>>
-name String
-store Map~Goods&#44&#160Integer~
-store Map~Goods&sbquo; Integer~
+getAmountByDescription(description String) Optional~Integer~
+buyGoods(goods Goods, amount int) void
+sellGoods(goods Goods, amount int) void
Expand Down
2 changes: 1 addition & 1 deletion docs/exam-exercises/exam-exercises-java2/dictionary.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ classDiagram
<<record>>
-sourceLanguage Language
-targetLanguage Language
-entries Map~Word&#44&#160Word~
-entries Map~Word&sbquo; Word~
+addEntry(sourceWord Word, targetWord Word) void
+importEntries(file File) void
+getTranslation(word String) Optional~String~
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ classDiagram
class HumanResources {
<<record>>
+telephoneBook Map~TelephoneNumber&#44&#160Person~
+telephoneBook Map~TelephoneNumber&sbquo; Person~
+staff List~Person~
+addTelephoneNumber(telephoneNumber TelephoneNumber, person Person) void
+addStaff(person Person) void
Expand Down
2 changes: 1 addition & 1 deletion docs/exam-exercises/exam-exercises-java2/library.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ classDiagram
class Library {
<<record>>
-name String
-books Map~Book&#44&#160Status~
-books Map~Book&sbquo; Status~
+addBook(book Book) void
+getBookByTitle(title String) Optional~Book~
+getPaperBooksByStatus(status Status) List~PaperBook~
Expand Down
4 changes: 2 additions & 2 deletions docs/exam-exercises/exam-exercises-java2/phone-store.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ classDiagram
+query1() List~Phone~
+query2() OptionalDouble
+query3(maxPriceInEuro double) List~Phone~
+query4() Map~Phone&#44&#160String~
+query5() Map~ConnectionTyp&#44&#160List~Phone~~
+query4() Map~Phone&sbquo; String~
+query5() Map~ConnectionTyp&sbquo; List~Phone~~
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/exam-exercises/exam-exercises-java2/space-station.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ classDiagram
class SpaceStation {
<<record>>
-name String
-bays Map~Integer&#44&#160SpaceFighter~
-bays Map~Integer&sbquo; SpaceFighter~
+land(bayNumber Integer, spaceFighter SpaceFighter) void
+getFastestSpaceFighter() Optional~SpaceFighter~
}
Expand Down
4 changes: 2 additions & 2 deletions docs/exercises/java-stream-api/java-stream-api01.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ classDiagram
+getNumberOfConsolesFromNintendo() long
+getSoldUnitsInMillionsPerYearFromAllOutdatedConsoles() List~String~
+getAverageSoldUnitsInMillionsPerYearFromAllOutdatedConsoles() OptionalDouble
+getAllConsolesByMaker() Map~Maker&#44&#160List~Console~~
+getTotalSoldUnitsInMillionsPerMaker() Map~Maker&#44&#160Double~
+getAllConsolesByMaker() Map~Maker&sbquo; List~Console~~
+getTotalSoldUnitsInMillionsPerMaker() Map~Maker&sbquo; Double~
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/exercises/java-stream-api/java-stream-api02.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ classDiagram
+getNameOfVfLWolfsburgFootballerWithMostPlayedGames() Optional~Footballer~
+getNamesOfAllFootballClubs() List~FootballClub~
+isFootballerWithSizeInCmLT170AndNumberOfGoalsBT0() boolean
+getAllFootballersByBirthyear() Map~Integer&#44&#160List~Footballer~~
+getAllFootballersByBirthyear() Map~Integer&sbquo; List~Footballer~~
+getAverageNumberOfPointsFromAllBundesligaFootballClubs() OptionalDouble
}
```
Expand Down
2 changes: 1 addition & 1 deletion docs/exercises/maps/maps01.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ classDiagram
class TelephoneBook {
<<record>>
-entries Map~Person&#44&#160TelephoneNumber~
-entries Map~Person&sbquo; TelephoneNumber~
+addEntry(person Person, telephoneNumber TelephoneNumber) void
+getTelephoneNumberByName(name String) TelephoneNumber
}
Expand Down
2 changes: 1 addition & 1 deletion docs/exercises/maps/maps02.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ classDiagram
class BookCollection {
<<record>>
-collection Map~Author&#44&#160List~Book~~
-collection Map~Author&sbquo; List~Book~~
+addAuthor(author Author) void
+addBook(author Author, book Book) void
+getMostDiligentAuthor() Author
Expand Down
2 changes: 1 addition & 1 deletion docs/exercises/optionals/optionals01.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ classDiagram
class BookCollection {
<<record>>
-collection Map~Author&#44&#160List~Book~~
-collection Map~Author&sbquo; List~Book~~
+addAuthor(author Author) void
+addBook(author Author, book Book) void
+getMostDiligentAuthor() Optional~Author~
Expand Down
2 changes: 1 addition & 1 deletion docs/exercises/optionals/optionals02.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ classDiagram
class TelephoneBook {
<<record>>
-entries Map~Person&#44&#160TelephoneNumber~
-entries Map~Person&sbquo; TelephoneNumber~
+addEntry(person Person, telephoneNumber TelephoneNumber) void
+getTelephoneNumberByName(name String) Optional~TelephoneNumber~
}
Expand Down
2 changes: 1 addition & 1 deletion docs/exercises/unit-tests/unit-tests03.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ classDiagram
class TelephoneBook {
<<record>>
-entries Map~Person&#44&#160TelephoneNumber~
-entries Map~Person&sbquo; TelephoneNumber~
+addEntry(person Person, telephoneNumber TelephoneNumber) void
+getTelephoneNumberByName(name String) Optional~TelephoneNumber~
}
Expand Down
2 changes: 1 addition & 1 deletion docs/exercises/unit-tests/unit-tests04.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ classDiagram
class BookCollection {
<<record>>
-collection Map~Author&#44&#160List~Book~~
-collection Map~Author&sbquo; List~Book~~
+addAuthor(author Author) void
+addBook(author Author, book Book) void
+getMostDiligentAuthor() Optional~Author~
Expand Down
28 changes: 14 additions & 14 deletions docusaurus.config.js → docusaurus.config.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
const lightCodeTheme = require('prism-react-renderer/themes/github');
const darkCodeTheme = require('prism-react-renderer/themes/dracula');
import { themes as prismThemes } from 'prism-react-renderer';
import type { Config } from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';

const config = {
const config: Config = {
title: 'Programmieren mit Java',
tagline: '',
url: 'https://jappuccini.github.io',
baseUrl: '/java-docs/',
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'throw',
favicon: 'img/favicon.ico',
url: process.env.URL || 'https://jappuccini.github.io',
baseUrl: process.env.BASE_URL || '/java-docs/',
organizationName: 'jappuccini',
projectName: 'java-docs',
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'throw',
markdown: {
mermaid: true,
},
Expand All @@ -19,14 +20,13 @@ const config = {
defaultLocale: 'de',
locales: ['de'],
},

presets: [
[
'@docusaurus/preset-classic',
{
docs: {
routeBasePath: '/',
sidebarPath: require.resolve('./sidebars.js'),
sidebarPath: './sidebars.ts',
editUrl: 'https://github.com/jappuccini/java-docs/tree/main/',
},
blog: false,
Expand All @@ -40,7 +40,7 @@ const config = {
require.resolve('./src/css/custom.css'),
],
},
},
} satisfies Preset.Options,
],
],

Expand Down Expand Up @@ -94,11 +94,11 @@ const config = {
copyright: `Copyright © ${new Date().getFullYear()} Daniel Appenmaier & Steffen Merk Built with Docusaurus.`,
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
additionalLanguages: ['java'],
},
},
} satisfies Preset.ThemeConfig,
};

module.exports = config;
export default config;
Loading

0 comments on commit e408543

Please sign in to comment.