Skip to content

Commit

Permalink
ci: added prettier to docs workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
retr0h committed Dec 30, 2023
1 parent b722e1d commit 2f60165
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 24,737 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/docs-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: yarn
cache-dependency-path: ./docs/yarn.lock
- name: Install Task
uses: arduino/setup-task@v1
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Lint the website
run: task docs:fmt:check
- name: Test build website
run: task docs:build
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: yarn
cache-dependency-path: ./docs/yarn.lock
- name: Install Task
Expand Down
24 changes: 19 additions & 5 deletions docs/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ tasks:
deps:
- yarn:install
cmds:
- npx docusaurus build
- yarn docusaurus build

start:
desc: Start website
Expand All @@ -24,7 +24,7 @@ tasks:
HOST: '{{default "localhost" .HOST}}'
PORT: '{{default "3001" .PORT}}'
cmds:
- npx docusaurus start --no-open --host={{.HOST}} --port={{.PORT}}
- yarn docusaurus start --no-open --host={{.HOST}} --port={{.PORT}}

serve:
desc: Preview website
Expand All @@ -34,7 +34,7 @@ tasks:
HOST: '{{default "localhost" .HOST}}'
PORT: '{{default "3001" .PORT}}'
cmds:
- npx docusaurus serve --no-open --host={{.HOST}} --port={{.PORT}}
- yarn docusaurus serve --no-open --host={{.HOST}} --port={{.PORT}}

clean:
desc: Clean temp directories
Expand All @@ -46,7 +46,7 @@ tasks:
vars:
VERSION: '{{.VERSION}}'
cmds:
- npx docusaurus docs:version {{.VERSION}}
- yarn docusaurus docs:version {{.VERSION}}
requires:
vars:
- VERSION
Expand All @@ -55,4 +55,18 @@ tasks:
desc: Build and deploy Docusaurus
summary: Requires GIT_USER and GIT_PASS envs to be previous set
cmds:
- npx docusaurus deploy
- yarn docusaurus deploy

fmt:
desc: Reformat files whose formatting differs from `prettier`
deps:
- yarn:install
cmds:
- yarn prettier docs --write --config prettier.config.js

fmt:check:
desc: Check files whose formatting differs from `prettier`
deps:
- yarn:install
cmds:
- yarn prettier docs --check --config prettier.config.js
6 changes: 4 additions & 2 deletions docs/docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Gilt uses [Viper][] to load configuation through multpile methods.
Create the giltfile (`Giltfile.yaml`).

Clone the specified `url`@`version` to the configurable path `--gilt-dir`.
Extract the repo the `dstDir` when `dstDir` is provided. Otherwise, copy files
Extract the repo the `dstDir` when `dstDir` is provided. Otherwise, copy files
and/or directories to the desired destinations.

```yaml
Expand All @@ -28,7 +28,7 @@ repositories:
- git: https://github.com/lorin/openstack-ansible-modules.git
version: 2677cc3
sources:
- src: "*_manage"
- src: '*_manage'
dstDir: library
- src: nova_quota
dstDir: library
Expand Down Expand Up @@ -70,4 +70,6 @@ go-gilt \
overlay
```

<!-- prettier-ignore-start -->
[Viper]: https://github.com/spf13/viper
<!-- prettier-ignore-end -->
27 changes: 16 additions & 11 deletions docs/docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ before submitting a PR.

:::note

This document applies to the core [Gilt][] repository.
This document applies to the [Gilt][] repository.

:::

Expand All @@ -26,17 +26,18 @@ This document applies to the core [Gilt][] repository.

## 1. Setup

- **Go** - Gilt is written in [Go][]. We always support the latest two major
Go versions, so make sure your version is recent enough.
- **Node.js** - [Node.js][] is used to host Gilt's documentation server
and is required if you want to run this server locally.
- **Go** - Gilt is written in [Go][]. We always support the latest two major Go
versions, so make sure your version is recent enough.
- **Node.js** - [Node.js][] is used to host Gilt's documentation server and is
required if you want to run this server locally.

## 2. Making changes

- **Code style** - Try to maintain the existing code style where possible. Go
code should be formatted by [`gofumpt`][gofumpt] and linted using
[`golangci-lint`][golangci-lint]. This style is enforced by our CI to ensure
that we have a consistent style across the project. You can use the
[`golangci-lint`][golangci-lint]. Any Markdown or TypeScript files should be
formatted and linted by [Prettier][]. This style is enforced by our CI to
ensure that we have a consistent style across the project. You can use the
`task fmt:check` command to lint the code locally and the `task fmt` command
to automatically fix any issues that are found.
- **Documentation** - Ensure that you add/update any relevant documentation. See
Expand All @@ -51,10 +52,11 @@ To run Gilt with working changes, you can use `go run main.go overlay`.

### Updating documentation

Gilt uses [Docusaurus][] to host a documentation server. The code for
this is located in the Gilt repository. This can be setup and run locally
by using `task docs:start` (requires `nodejs` & `yarn`). All content is written
in Markdown and is located in the `docs/docs` directory.
Gilt uses [Docusaurus][] to host a documentation server. The code for this is
located in the Gilt repository. This can be setup and run locally by using
`task docs:start` (requires `nodejs` & `yarn`). All content is written in
Markdown and is located in the `docs/docs` directory. All Markdown documents
should have an 80 character line wrap limit (enforced by Prettier).

### Writing tests

Expand Down Expand Up @@ -104,12 +106,15 @@ answer questions.
If you have questions, feel free open a [Discussion][] on GitHub.

<!-- prettier-ignore-start -->
[Gilt]: https://github.com/retr0h/go-gilt
[Go]: https://go.dev
[Node.js]: https://nodejs.org/en/
[gofumpt]: https://github.com/mvdan/gofumpt
[golangci-lint]: https://golangci-lint.run
[Prettier]: https://prettier.io/
[Docusaurus]: https://docusaurus.io
[Discussion]: https://github.com/retr0h/go-gilt/discussions
[Conventional Commits]: https://www.conventionalcommits.org
[Bats]: https://github.com/bats-core/bats-core
<!-- prettier-ignore-end -->
20 changes: 11 additions & 9 deletions docs/docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,35 @@ title: Home

<img src="img/gilt.png" align="left" width="250px" height="250px" />

Gilt is a tool which aims to make repo management, manageable. Gilt
clones repositories at a particular version, then overlays the repository to
the provided destination. An alternate approach to "vendoring".
Gilt is a tool which aims to make repo management, manageable. Gilt clones
repositories at a particular version, then overlays the repository to the
provided destination. An alternate approach to "vendoring".

What makes Gilt interesting, is the ability to overlay particular files and/or
directories from the specified repository to given destinations. Originally,
this was quite helpful for those using Ansible, since libraries, plugins, and
playbooks are often shared, but Ansible's [Galaxy][] has no mechanism to handle
this. Currently, this is proving useful for overlaying [Helm charts][].
this. Currently, this is proving useful for overlaying [Helm charts][].

<br clear="left"/>

## Alternatives

* [Repo][]
* [Git submodules][]
* [Git subtree][]
- [Repo][]
- [Git submodules][]
- [Git subtree][]

## History

This project is a golang port of [Gilt][], and aims to correct poor decisions
made in the python version, primarially around config syntax, portability,
and reproducibility.
made in the python version, primarially around config syntax, portability, and
reproducibility.

<!-- prettier-ignore-start -->
[Galaxy]: https://docs.ansible.com/ansible/latest/reference_appendices/galaxy.html
[Helm charts]: https://helm.sh/docs/topics/charts/
[Repo]: https://gerrit.googlesource.com/git-repo/+/refs/heads/master/README.md
[Git submodules]: https://git-scm.com/book/en/v2/Git-Tools-Submodules
[Git subtree]: https://github.com/git/git/blob/master/contrib/subtree/git-subtree.txt
[Gilt]: http:https://gilt.readthedocs.io/en/latest/
<!-- prettier-ignore-end -->
Loading

0 comments on commit 2f60165

Please sign in to comment.