Skip to content

Commit 6347269

Browse files
committed
added VitePress documentation
1 parent b506910 commit 6347269

8 files changed

Lines changed: 2714 additions & 8 deletions

File tree

.github/workflows/pages.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: pages
16+
cancel-in-progress: false
17+
18+
jobs:
19+
build:
20+
name: Build documentation
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Set up Java
28+
uses: actions/setup-java@v4
29+
with:
30+
distribution: temurin
31+
java-version: 21
32+
33+
- name: Set up Gradle
34+
uses: gradle/actions/setup-gradle@v4
35+
36+
- name: Set up Node
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version: 22
40+
cache: npm
41+
42+
- name: Install Node dependencies
43+
run: npm ci
44+
45+
- name: Build Javadoc
46+
run: ./gradlew javadoc
47+
48+
- name: Build VitePress site
49+
run: npm run docs:build
50+
51+
- name: Copy Javadoc into site
52+
run: cp -R scope/build/docs/javadoc docs/.vitepress/dist/javadoc
53+
54+
- name: Configure Pages
55+
uses: actions/configure-pages@v5
56+
57+
- name: Upload Pages artifact
58+
uses: actions/upload-pages-artifact@v3
59+
with:
60+
path: docs/.vitepress/dist
61+
62+
deploy:
63+
name: Deploy documentation
64+
runs-on: ubuntu-latest
65+
needs: build
66+
environment:
67+
name: github-pages
68+
url: ${{ steps.deployment.outputs.page_url }}
69+
70+
steps:
71+
- name: Deploy to GitHub Pages
72+
id: deployment
73+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
.gradle/
2+
node_modules/
3+
docs/.vitepress/dist/
4+
docs/.vitepress/cache/
25
build/
36
*/build/
47
.DS_Store
58
.idea/
69
out/
7-
*/bin/
10+
*/bin/

docs/.vitepress/config.mts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { defineConfig } from 'vitepress';
2+
3+
export default defineConfig({
4+
title: 'scope',
5+
description: 'A small JVM library that treats scopes as first-class runtime objects.',
6+
base: '/scope/',
7+
cleanUrls: true,
8+
themeConfig: {
9+
nav: [
10+
{ text: 'Guide', link: '/mental-model' },
11+
{ text: 'API', link: '/api-reference' },
12+
{ text: 'Javadoc', link: '/javadoc/', target: '_blank', rel: 'noreferrer' },
13+
{ text: 'GitHub', link: 'https://github.com/theking90000/scope' }
14+
],
15+
sidebar: [
16+
{
17+
text: 'Guide',
18+
items: [
19+
{ text: 'Mental model', link: '/mental-model' },
20+
{ text: 'Getting started', link: '/getting-started' },
21+
{ text: 'Injection', link: '/injection' },
22+
{ text: 'Qualifiers & collections', link: '/qualifiers-and-collections' },
23+
{ text: 'Scopes & lifecycle', link: '/scopes-and-lifecycle' },
24+
{ text: 'Multi-parent scopes', link: '/multi-parent' },
25+
{ text: 'Extension hooks', link: '/extension-hooks' },
26+
{ text: 'API reference', link: '/api-reference' },
27+
{ text: 'Exceptions', link: '/exceptions' },
28+
{ text: 'Recipes', link: '/recipes' }
29+
]
30+
}
31+
],
32+
socialLinks: [
33+
{ icon: 'github', link: 'https://github.com/theking90000/scope' }
34+
],
35+
search: {
36+
provider: 'local'
37+
}
38+
}
39+
});

docs/README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ Service service = root.get(Service.class); // built and cached as a scope single
3838

3939
## Installation
4040

41-
See the [main README](../README.md#quick-start) for Gradle / Maven coordinates.
42-
The library targets **Java 21**. The base package is:
41+
See the [main README](https://github.com/theking90000/scope#quick-start) for
42+
Gradle / Maven coordinates. The library targets **Java 21**. The base package is:
4343

4444
```java
4545
package be.theking90000.scope;
@@ -57,6 +57,7 @@ up yet, the same JavaDoc is attached to every release on GitHub Packages.)_
5757

5858
## Other references
5959

60-
- [Main README](../README.md) — the project landing page (pitch and comparison).
61-
- [`scope/README.md`](../scope/README.md) — the original, in-depth **French**
62-
reference for the same module.
60+
- [Main README](https://github.com/theking90000/scope) — the project landing page
61+
(pitch and comparison).
62+
- [`scope/README.md`](https://github.com/theking90000/scope/blob/main/scope/README.md)
63+
— the original, in-depth **French** reference for the same module.

docs/getting-started.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
This page walks through the smallest useful program and explains exactly what the
44
container does. For installation coordinates, see the
5-
[main README](../README.md#quick-start). The library targets **Java 21** and lives
6-
under `be.theking90000.scope`.
5+
[main README](https://github.com/theking90000/scope#quick-start). The library
6+
targets **Java 21** and lives under `be.theking90000.scope`.
77

88
## A first scope
99

docs/index.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# `scope` documentation
2+
3+
`scope` is a small JVM library that treats **scopes as first-class runtime
4+
objects**. A scope is a lexical block you can build, nest, shadow and dispose
5+
_while the program runs_ — and a thin dependency injection layer wires objects
6+
together by walking the scope graph.
7+
8+
If you have five minutes, read **[Mental model](mental-model.md)** first: every
9+
other page builds on it.
10+
11+
```java
12+
import be.theking90000.scope.Scope;
13+
14+
record RootScope() {}
15+
record Config(String value) {}
16+
record Service(Config config) {}
17+
18+
Scope<RootScope> root = new Scope<>(new RootScope());
19+
root.seed(Config.class, new Config("prod"));
20+
21+
Service service = root.get(Service.class); // built and cached as a scope singleton
22+
```
23+
24+
## Table of contents
25+
26+
| Page | What it covers |
27+
| --------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
28+
| [Mental model](mental-model.md) | Scopes as language blocks, the lifetime model, the visibility/ownership asymmetry. |
29+
| [Getting started](getting-started.md) | First example, step by step, and how `get()` resolves. |
30+
| [Injection](injection.md) | Constructor injection rules, supported parameter shapes, lazy `Provider<T>`, cycles. |
31+
| [Qualifiers & collections](qualifiers-and-collections.md) | `Key<T>`, `@Named`, and injecting all providers of a type. |
32+
| [Scopes & lifecycle](scopes-and-lifecycle.md) | Parents, shadowing, ownership vs visibility, `close()`, `@PostConstruct` / `@PreDestroy` / `AutoCloseable`. |
33+
| [Multi-parent scopes](multi-parent.md) | DAG scopes, ambiguity, `NEAREST` vs `DEEP` resolution. |
34+
| [Extension hooks](extension-hooks.md) | `OnCreatedHook`, `BeanCreated`, `Disposer`, hook shadowing, batch initialization. |
35+
| [API reference](api-reference.md) | Every public member of `Scope`, `Key`, `Provider`, `MultiProvider`. |
36+
| [Exceptions](exceptions.md) | The `DiException` hierarchy and when each is thrown. |
37+
| [Recipes](recipes.md) | Common patterns and a best-practices checklist. |
38+
39+
## Installation
40+
41+
See the [main README](https://github.com/theking90000/scope#quick-start) for
42+
Gradle / Maven coordinates. The library targets **Java 21**. The base package is:
43+
44+
```java
45+
package be.theking90000.scope;
46+
```
47+
48+
## JavaDoc
49+
50+
Every public type and method ships with thorough JavaDoc — it is the most precise
51+
reference for exact signatures, edge cases and behavior. Browse it online:
52+
53+
**<https://theking90000.github.io/scope/javadoc/>**
54+
55+
_(Published from the `javadoc` jar produced by the build; if the hosted site is not
56+
up yet, the same JavaDoc is attached to every release on GitHub Packages.)_
57+
58+
## Other references
59+
60+
- [Main README](https://github.com/theking90000/scope) — the project landing page
61+
(pitch and comparison).
62+
- [`scope/README.md`](https://github.com/theking90000/scope/blob/main/scope/README.md)
63+
— the original, in-depth **French** reference for the same module.

0 commit comments

Comments
 (0)