Skip to content

Commit f70d4e1

Browse files
authored
Merge branch 'master' into update-ci
2 parents e7beb14 + ca61c3d commit f70d4e1

File tree

109 files changed

+2451
-13186
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+2451
-13186
lines changed

.github/workflows/docs.yml

+9-12
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ concurrency:
2323
group: "pages"
2424
cancel-in-progress: true
2525

26+
27+
env:
28+
UV_VERSION: 0.3.3
29+
2630
jobs:
2731
build:
2832
runs-on: ubuntu-latest
@@ -41,24 +45,17 @@ jobs:
4145
with:
4246
ref: ${{ inputs.head }}
4347

44-
- name: Set up Node
45-
uses: actions/setup-node@v4
46-
with:
47-
node-version: '16'
48-
cache: 'yarn'
49-
cache-dependency-path: docs/yarn.lock
50-
51-
- name: Install dependencies
52-
run: yarn install
53-
working-directory: docs
48+
- name: Install uv
49+
run: |
50+
curl -LsSf "https://astral.sh/uv/${UV_VERSION}/install.sh" | sh
5451
5552
- name: Build
5653
run: make docs
5754

5855
- name: Upload artifact
5956
uses: actions/upload-pages-artifact@v3
6057
with:
61-
path: docs/dist/
58+
path: docs/_site
6259

6360
deploy:
6461
needs: build # run only after a successful build
@@ -69,7 +66,7 @@ jobs:
6966

7067
environment:
7168
name: github-pages
72-
url: ${{ steps.deployment.output.pages_url }}
69+
url: ${{ steps.deployment.outputs.page_url }}
7370

7471
runs-on: ubuntu-latest
7572
steps:

CHANGELOG.md

+26-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
sidebarDepth: 0
3-
search: false
2+
search:
3+
exclude: true
44
---
55

66
# Changelog
@@ -13,6 +13,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
## Unreleased
1414
- No changes yet.
1515

16+
## [1.23.0](https://github.com/uber-go/fx/compare/v1.22.2...v1.22.3) - 2024-10-11
17+
18+
### Added
19+
- Added `Runtime` to `fxevent.Run` event, which stores the runtime of
20+
a constructor or a decorator that's run, including functions created
21+
by `fx.Supply` and `fx.Replace`.
22+
23+
### Changed
24+
- Overhauled the documentation website. (https://uber-go.github.io/fx/)
25+
26+
## [1.22.2](https://github.com/uber-go/fx/compare/v1.22.1...v1.22.2) - 2024-08-07
27+
28+
### Fixed
29+
- A deadlock with the relayer in signal receivers.
30+
31+
### Changed
32+
- Upgrade Dig dependency to v1.18.0
33+
34+
## [1.22.1](https://github.com/uber-go/fx/compare/v1.22.0...v1.22.1) - 2024-06-25
35+
36+
### Fixed
37+
- Fx apps will only listen to signals when `.Run()`, `.Wait()`, or `.Done()`
38+
are called, fixing a regression introduced in v1.19.0.
39+
1640
## [1.22.0](https://github.com/uber-go/fx/compare/v1.21.1...v1.22.0) - 2024-05-30
1741

1842
### Added

CONTRIBUTING.md

+100-137
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
sidebarDepth: 2
3-
search: false
2+
search:
3+
exclude: true
44
---
55

66
# Contributing
@@ -12,89 +12,86 @@ please [open an issue](https://github.com/uber-go/fx/issues/new)
1212
describing your proposal.
1313
Discussing API changes ahead of time makes pull request review much smoother.
1414

15-
::: tip
16-
You'll need to sign [Uber's CLA](https://cla-assistant.io/uber-go/fx)
17-
before we can accept any of your contributions.
18-
If necessary, a bot will remind
19-
you to accept the CLA when you open your pull request.
20-
:::
15+
!!! tip
16+
17+
You'll need to sign [Uber's CLA](https://cla-assistant.io/uber-go/fx)
18+
before we can accept any of your contributions.
19+
If necessary, a bot will remind
20+
you to accept the CLA when you open your pull request.
21+
2122

2223
## Contribute code
2324

2425
Set up your local development environment to contribute to Fx.
2526

2627
1. [Fork](https://github.com/uber-go/fx/fork), then clone the repository.
2728

28-
<code-group>
29-
<code-block title="Git">
30-
```bash
31-
git clone https://github.com/your_github_username/fx.git
32-
cd fx
33-
git remote add upstream https://github.com/uber-go/fx.git
34-
git fetch upstream
35-
```
36-
</code-block>
37-
38-
<code-block title="GitHub CLI">
39-
```bash
40-
gh repo fork --clone uber-go/fx
41-
```
42-
</code-block>
43-
</code-group>
29+
=== "Git"
30+
31+
```bash
32+
git clone https://github.com/your_github_username/fx.git
33+
cd fx
34+
git remote add upstream https://github.com/uber-go/fx.git
35+
git fetch upstream
36+
```
37+
38+
=== "GitHub CLI"
39+
40+
```bash
41+
gh repo fork --clone uber-go/fx
42+
```
4443

4544
2. Install Fx's dependencies:
4645

47-
```bash
48-
go mod download
49-
```
46+
```bash
47+
go mod download
48+
```
5049

5150
3. Verify that tests and other checks pass locally.
5251

53-
```bash
54-
make lint
55-
make test
56-
```
52+
```bash
53+
make lint
54+
make test
55+
```
5756

58-
Note that for `make lint` to work,
59-
you must be using the latest stable version of Go.
60-
If you're on an older version, you can still contribute your change,
61-
but we may discover style violations when you open the pull request.
57+
Note that for `make lint` to work,
58+
you must be using the latest stable version of Go.
59+
If you're on an older version, you can still contribute your change,
60+
but we may discover style violations when you open the pull request.
6261
6362
Next, make your changes.
6463
6564
1. Create a new feature branch.
6665
67-
```bash
68-
git checkout master
69-
git pull
70-
git checkout -b cool_new_feature
71-
```
66+
```bash
67+
git checkout master
68+
git pull
69+
git checkout -b cool_new_feature
70+
```
7271
7372
2. Make your changes, and verify that all tests and lints still pass.
7473
75-
```bash
76-
$EDITOR app.go
77-
make lint
78-
make test
79-
```
74+
```bash
75+
$EDITOR app.go
76+
make lint
77+
make test
78+
```
8079
8180
3. When you're satisfied with the change,
8281
push it to your fork and make a pull request.
8382

84-
<code-group>
85-
<code-block title="Git">
86-
```bash
87-
git push origin cool_new_feature
88-
# Open a PR at https://github.com/uber-go/fx/compare
89-
```
90-
</code-block>
91-
92-
<code-block title="GitHub CLI">
93-
```bash
94-
gh pr create
95-
```
96-
</code-block>
97-
</code-group>
83+
=== "Git"
84+
85+
```bash
86+
git push origin cool_new_feature
87+
# Open a PR at https://github.com/uber-go/fx/compare
88+
```
89+
90+
=== "GitHub CLI"
91+
92+
```bash
93+
gh pr create
94+
```
9895

9996
At this point, you're waiting on us to review your changes.
10097
We *try* to respond to issues and pull requests within a few business days,
@@ -115,18 +112,14 @@ To contribute documentation to Fx,
115112
1. Set up your local development environment
116113
as you would to [contribute code](#contribute-code).
117114
118-
2. Install the documentation website dependencies.
119-
120-
```bash
121-
cd docs
122-
yarn install
123-
```
115+
2. [Install uv](https://docs.astral.sh/uv/getting-started/installation/).
116+
We use this to manage our Python dependencies.
124117
125118
3. Run the development server.
126119
127-
```bash
128-
yarn dev
129-
```
120+
```bash
121+
make serve
122+
```
130123
131124
4. Make your changes.
132125
@@ -208,84 +201,54 @@ Markdown will reflow this into a "normal" pargraph when rendering.
208201
209202
All code samples in documentation must be buildable and testable.
210203
211-
To aid in this, we have two tools:
204+
To make this possible, we put code samples in the "ex/" directory,
205+
and use the [PyMdown Snippets extension](https://facelessuser.github.io/pymdown-extensions/extensions/snippets/)
206+
to include them in the documentation.
212207
213-
- [mdox](https://github.com/bwplotka/mdox/)
214-
- the `region` shell script
208+
To include code snippets in your documentation,
209+
take the following steps:
215210
216-
#### mdox
211+
1. Add source code under the `ex/` directory.
212+
Usually, the file will be placed in a directory
213+
with a name matching the documentation file
214+
that will include the snippet.
217215
218-
mdox is a Markdown file formatter that includes support for
219-
running a command and using its output as part of a code block.
220-
To use this, declare a regular code block and tag it with `mdoc-exec`.
216+
For example,
217+
for src/annotation.md, examples will reside in ex/annotation/.
221218
222-
```markdown
223-
```go mdox-exec='cat foo.go'
224-
// ...
225-
```
219+
2. Inside the source file, name regions of code with comments in the forms:
226220
227-
The contents of the code block will be replaced
228-
with the output of the command when you run `make fmt`
229-
in the docs directory.
230-
`make check` will ensure that the contents are up-to-date.
221+
```
222+
// --8<-- [start:name]
223+
...
224+
// --8<-- [end:name]
225+
```
231226
232-
The command runs with the working directory set to docs/.
233-
Store code samples in ex/ and reference them directly.
227+
Where `name` is the name of the snippet.
228+
For example:
234229
235-
#### region
230+
```go
231+
// --8<-- [start:New]
232+
func New() *http.Server {
233+
// ...
234+
}
235+
// --8<-- [end:New]
236+
```
236237
237-
The `region` shell script is a command intended to be used with `mdox-exec`.
238+
3. Include the snippet in a code block with the following syntax:
238239
239-
```plain mdox-exec='region' mdox-expect-exit-code='1'
240-
USAGE: region FILE REGION1 REGION2 ...
240+
```markdown
241+
```go
242+
;--8<-- "path/to/file.go:name"
243+
```
241244
242-
Extracts text from FILE marked by "// region" blocks.
243-
```
245+
Where `path/to/file.go` is the path to the file containing the snippet
246+
relative to the `ex/` directory,
247+
and `name` is the name of the snippet.
244248
245-
For example, given the file:
249+
You can include multiple snippets from the same file like so:
246250
247-
```
248-
foo
249-
// region myregion
250-
bar
251-
// endregion myregion
252-
baz
253-
```
254-
255-
Running `region $FILE myregion` will print:
256-
257-
```
258-
bar
259-
```
260-
261-
The same region name may be used multiple times
262-
to pull different snippets from the same file.
263-
For example, given the file:
264-
265-
```go
266-
// region provide-foo
267-
func main() {
268-
fx.New(
269-
fx.Provide(
270-
NewFoo,
271-
// endregion provide-foo
272-
NewBar,
273-
// region provide-foo
274-
),
275-
).Run()
276-
}
277-
278-
// endregion provide-foo
279-
```
280-
281-
`region $FILE provide-foo` will print,
282-
283-
```go
284-
func main() {
285-
fx.New(
286-
fx.Provide(
287-
NewFoo,
288-
),
289-
).Run()
290-
}
291-
```
251+
```
252+
;--8<-- "path/to/file.go:snippet1"
253+
;--8<-- "path/to/file.go:snippet2"
254+
```

0 commit comments

Comments
 (0)