Skip to content

Commit

Permalink
adding more doc
Browse files Browse the repository at this point in the history
  • Loading branch information
samber committed Nov 2, 2023
1 parent 412782d commit c7b9110
Show file tree
Hide file tree
Showing 32 changed files with 753 additions and 26 deletions.
6 changes: 6 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,9 @@ This command generates static content into the `build` directory and can be serv
### Deployment

Deployed on Vercel.

### Illustrations 🎨

- https://github.com/egonelbre/gophers
- https://github.com/MariaLetta/free-gophers-pack
- https://github.com/ashleymcnamara/gophers
8 changes: 8 additions & 0 deletions docs/docs/debugging/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"label": "Debugging",
"position": 5,
"link": {
"type": "generated-index",
"description": "Debug your scope tree and service dependencies"
}
}
57 changes: 57 additions & 0 deletions docs/docs/debugging/to-do-v2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
title: my hello page title
description: my hello page description
sidebar_position: 1
---

# To samber/do v2

This documentation will help you upgrade your site from `samber/do` v1 to `samber/do` v2.

`samber/do` v2 is a new major version, including breaking changes requiring you to adjust your applications accordingly. We will guide to during this process, and also mention a few optional recommendations.

This release is large rewrite, but the breaking changes are relatively easy to handle. Some updates can be done with a simple `sed` command.

Check the release notes [here](https://github.com/samber/do/releases).

No breaking change will be done until v3.

## 1- Upgrading package

Update go.mod:

```sh
go get -u github.com/samber/do/v2
```

Replace package import:

```sh
find . -type f -exec sed -i 's#samber/do"#samber/do/v2"#g' {} \;
```

Cleanup previous dependencies:

```sh
go mod tidy
```

## 2- `do.Injector` interface

`do.Injector` has been transformed into an interface. Replace `*do.Injector` by `do.Injector`.

```sh
find . -type f -exec sed -i "s/*do.Injector/do.Injector/g" {} \;
```

## 3- `do.Shutdown****` output

Shutdown functions used to return only 1 argument.

```go
# from
err := injector.Shutdown()

# to
signal, err := injector.Shutdown()
```
2 changes: 2 additions & 0 deletions docs/docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
title: Getting started
description: Let's discover samber/do in less than 5 minutes.
sidebar_position: 1
---

Expand Down
8 changes: 8 additions & 0 deletions docs/docs/scopes/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"label": "Scopes",
"position": 3,
"link": {
"type": "generated-index",
"description": "Learn how to split your services into multiple modules"
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
title: my hello page title
description: my hello page description
sidebar_position: 6
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
title: my hello page title
description: my hello page description
sidebar_position: 3
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
title: my hello page title
description: my hello page description
sidebar_position: 2
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
title: my hello page title
description: my hello page description
sidebar_position: 5
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
title: my hello page title
description: my hello page description
sidebar_position: 4
---

Expand Down
8 changes: 8 additions & 0 deletions docs/docs/service-invocation/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"label": "Service invocation",
"position": 2,
"link": {
"type": "generated-index",
"description": "Learn how to invoke services in your application"
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
title: my hello page title
description: my hello page description
sidebar_position: 1
---

Expand Down Expand Up @@ -45,8 +47,6 @@ export default {

The docs version dropdown appears in your navbar:

![Docs Version Dropdown](./img/docsVersionDropdown.png)

## Update an existing version

It is possible to edit versioned docs in their respective folder:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
title: my hello page title
description: my hello page description
sidebar_position: 2
---

Expand Down Expand Up @@ -71,8 +73,6 @@ export default {

The locale dropdown now appears in your navbar:

![Locale Dropdown](./img/localeDropdown.png)

## Build your localized site

Build your site for a specific locale:
Expand Down
8 changes: 8 additions & 0 deletions docs/docs/service-lifecycle/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"label": "Service lifecycle",
"position": 4,
"link": {
"type": "generated-index",
"description": "Learn how to check service status and unload an application"
}
}
25 changes: 25 additions & 0 deletions docs/docs/service-lifecycle/congratulations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
title: my hello page title
description: my hello page description
sidebar_position: 6
---

# Congratulations!

You have just learned the **basics of Docusaurus** and made some changes to the **initial template**.

Docusaurus has **much more to offer**!

Have **5 more minutes**? Take a look at **[versioning](../tutorial-extras/manage-docs-versions.md)** and **[i18n](../tutorial-extras/translate-your-site.md)**.

Anything **unclear** or **buggy** in this tutorial? [Please report it!](https://github.com/facebook/docusaurus/discussions/4610)

## What's next?

- Read the [official documentation](https://docusaurus.io/)
- Modify your site configuration with [`docusaurus.config.js`](https://docusaurus.io/docs/api/docusaurus-config)
- Add navbar and footer items with [`themeConfig`](https://docusaurus.io/docs/api/themes/configuration)
- Add a custom [Design and Layout](https://docusaurus.io/docs/styling-layout)
- Add a [search bar](https://docusaurus.io/docs/search)
- Find inspirations in the [Docusaurus showcase](https://docusaurus.io/showcase)
- Get involved in the [Docusaurus Community](https://docusaurus.io/community/support)
36 changes: 36 additions & 0 deletions docs/docs/service-lifecycle/create-a-blog-post.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
title: my hello page title
description: my hello page description
sidebar_position: 3
---

# Create a Blog Post

Docusaurus creates a **page for each blog post**, but also a **blog index page**, a **tag system**, an **RSS** feed...

## Create your first Post

Create a file at `blog/2021-02-28-greetings.md`:

```md title="blog/2021-02-28-greetings.md"
---
slug: greetings
title: Greetings!
authors:
- name: Joel Marcey
title: Co-creator of Docusaurus 1
url: https://github.com/JoelMarcey
image_url: https://github.com/JoelMarcey.png
- name: Sébastien Lorber
title: Docusaurus maintainer
url: https://sebastienlorber.com
image_url: https://github.com/slorber.png
tags: [greetings]
---

Congratulations, you have made your first post!

Feel free to play around and edit this post as much you like.
```

A new blog post is now available at [http://localhost:3000/blog/greetings](http://localhost:3000/blog/greetings).
59 changes: 59 additions & 0 deletions docs/docs/service-lifecycle/create-a-document.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
title: my hello page title
description: my hello page description
sidebar_position: 2
---

# Create a Document

Documents are **groups of pages** connected through:

- a **sidebar**
- **previous/next navigation**
- **versioning**

## Create your first Doc

Create a Markdown file at `docs/hello.md`:

```md title="docs/hello.md"
# Hello

This is my **first Docusaurus document**!
```

A new document is now available at [http://localhost:3000/docs/hello](http://localhost:3000/docs/hello).

## Configure the Sidebar

Docusaurus automatically **creates a sidebar** from the `docs` folder.

Add metadata to customize the sidebar label and position:

```md title="docs/hello.md" {1-4}
---
sidebar_label: 'Hi!'
sidebar_position: 3
---

# Hello

This is my **first Docusaurus document**!
```

It is also possible to create your sidebar explicitly in `sidebars.js`:

```js title="sidebars.js"
export default {
docSidebar: [
'intro',
// highlight-next-line
'hello',
{
type: 'category',
label: 'Tutorial',
items: ['tutorial-basics/create-a-document'],
},
],
};
```
33 changes: 33 additions & 0 deletions docs/docs/service-lifecycle/deploy-your-site.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: my hello page title
description: my hello page description
sidebar_position: 5
---

# Deploy your site

Docusaurus is a **static-site-generator** (also called **[Jamstack](https://jamstack.org/)**).

It builds your site as simple **static HTML, JavaScript and CSS files**.

## Build your site

Build your site **for production**:

```bash
npm run build
```

The static files are generated in the `build` folder.

## Deploy your site

Test your production build locally:

```bash
npm run serve
```

The `build` folder is now served at [http://localhost:3000/](http://localhost:3000/).

You can now deploy the `build` folder **almost anywhere** easily, **for free** or very small cost (read the **[Deployment Guide](https://docusaurus.io/docs/deployment)**).
Loading

0 comments on commit c7b9110

Please sign in to comment.