Skip to content

Commit 06c4c45

Browse files
committed
Initial vitepress migration.
1 parent fccb1b7 commit 06c4c45

26 files changed

+1544
-3439
lines changed

.eslintignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
.temp
2-
.cache
1+
temp
2+
cache
33
dist
44
_site
5+
!.vitepress

.github/workflows/pr-docs-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
pull_request:
55

66
jobs:
7-
unit-tests:
7+
docs-tests:
88
runs-on: ${{ matrix.os }}
99
strategy:
1010
matrix:
@@ -26,6 +26,6 @@ jobs:
2626

2727
# Run tests
2828
- name: Run linter
29-
run: npm run docs:lint
29+
run: npm run lint
3030
- name: Test build
3131
run: npm run docs:build

.gitignore

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,14 @@ dist
3333
.nyc_output
3434
coverage/
3535

36-
# Vuepress
36+
# docs
3737
.temp
3838
.cache
3939
_site
40-
docs/.vuepress/.cache
41-
docs/.vuepress/.temp
42-
docs/.vuepress/distyarn.lock
40+
dist
41+
cache
42+
temp
43+
config.*.timestamp-*-*.*
44+
45+
# YARN
46+
yarn.lock

docs/.eslintrc.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@
1818
"max-len": ["error", {
1919
"code": 12000,
2020
"ignoreComments": true
21+
}],
22+
"require-jsdoc": ["error", {
23+
"require": {
24+
"FunctionDeclaration": false,
25+
"MethodDefinition": false,
26+
"ClassDeclaration": false,
27+
"ArrowFunctionExpression": false,
28+
"FunctionExpression": false
29+
}
2130
}]
2231
}
2332
}

docs/.vitepress/config.mjs

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import {createRequire} from 'module';
2+
3+
import {defineConfig} from '@lando/vitepress-theme-default-plus/config';
4+
5+
const require = createRequire(import.meta.url);
6+
7+
const {name, version} = require('../../package.json');
8+
const landoPlugin = name.replace('@lando/', '');
9+
10+
export default defineConfig({
11+
title: 'Lando Varnish Plugin',
12+
description: 'The offical Lando plugin for Varnish.',
13+
landoDocs: 3,
14+
landoPlugin,
15+
version,
16+
head: [
17+
['meta', {name: 'viewport', content: 'width=device-width, initial-scale=1'}],
18+
['link', {rel: 'icon', href: '/varnish/favicon.ico', size: 'any'}],
19+
['link', {rel: 'icon', href: '/varnish/favicon.svg', type: 'image/svg+xml'}],
20+
],
21+
themeConfig: {
22+
sidebar: sidebar(),
23+
},
24+
});
25+
26+
function sidebar() {
27+
return [
28+
{
29+
text: 'Introduction',
30+
collapsed: false,
31+
items: [
32+
{text: 'Overview', link: '/'},
33+
{text: 'Installation', link: '/install'},
34+
{text: 'Usage', link: '/config'},
35+
],
36+
},
37+
{
38+
text: 'Contribution',
39+
collapsed: false,
40+
items: [
41+
{text: 'Development', link: '/development'},
42+
{text: 'Team', link: '/team'},
43+
],
44+
},
45+
{
46+
text: 'Help & Support',
47+
collapsed: false,
48+
items: [
49+
{text: 'GitHub', link: 'https://github.com/lando/varnish/issues/new/choose'},
50+
{text: 'Slack', link: 'https://www.launchpass.com/devwithlando'},
51+
{text: 'Contact Us', link: '/support'},
52+
],
53+
},
54+
{text: 'Examples', link: 'https://github.com/lando/varnish/tree/main/examples'},
55+
];
56+
};

docs/.vitepress/theme/index.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import VPLTheme from '@lando/vitepress-theme-default-plus';
2+
3+
export default VPLTheme;

docs/.vuepress/config.js

Lines changed: 0 additions & 40 deletions
This file was deleted.

docs/config.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ description: Learn how to configure the Lando Varnish service.
55

66
# Configuration
77

8-
Here are the configuration options, set to the default values, for this service. If you are unsure about where this goes or what this means, we *highly recommend* scanning the [services documentation](https://docs.lando.dev/config/services.html) to get a good handle on how the magicks work.
8+
Here are the configuration options, set to the default values, for this service. If you are unsure about where this goes or what this means, we *highly recommend* scanning the [services documentation](https://docs.lando.dev/core/v3/lando-service.html) to get a good handle on how the magicks work.
99

10-
Also note that options, in addition to the [build steps](https://docs.lando.dev/config/services.html#build-steps) and [overrides](https://docs.lando.dev/config/services.html#overrides) that are available to every service, are shown below:
10+
Also note that options, in addition to the [build steps](https://docs.lando.dev/core/v3/lando-service.html#build-steps) and [overrides](https://docs.lando.dev/core/v3/lando-service.html#overrides) that are available to every service, are shown below:
1111

1212
```yaml
1313
services:
@@ -83,7 +83,7 @@ services:
8383

8484
There are also [several various envvars](https://github.com/wodby/varnish#environment-variables) exposed by the underlying image we use that you can set to further customize how your Varnish works. **These are not officially supported** so we *highly recommend* you do not alter them unless you know what you are doing. Even then, YMMV.
8585

86-
That said, you will need to use a [service override](https://docs.lando.dev/config/services.html#overrides) to take advantage of them as shown below:
86+
That said, you will need to use a [service override](https://docs.lando.dev/core/v3/lando-service.html#overrides) to take advantage of them as shown below:
8787

8888
```yaml
8989
myservice:

docs/development.md

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,23 @@ description: Learn how to develop and contribute to the Lando Varnish service
55

66
# Development
77

8-
This guide contains information to help onboard developers to work on the [Varnish Cache](https://varnish-cache.org/intro/index.html#intro) integration, hereafter referred to as "the plugin".
8+
This guide contains information to help onboard developers to work on the [varnish](https://varnish.microsoft.com/en-us/) integration, hereafter referred to as *the plugin*.
99

1010
## Requirements
1111

1212
At the very least you will need to have the following installed:
1313

14-
* [Lando 3.5.0+](https://docs.lando.dev/basics/installation.html), preferably installed [from source](https://docs.lando.dev/basics/installation.html#from-source).
14+
* [Lando 3.21.0+](https://docs.lando.dev/getting-started/installation.html) preferably installed [from source](https://docs.lando.dev/getting-started/installation.html#from-source).
1515
* [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
16-
17-
While not a hard requirement it's also probably a good idea to install `node` 18
1816
* [Node 18](https://nodejs.org/dist/latest-v18.x/)
1917

2018
## Installation
2119

22-
```bash
20+
```sh
2321
# Clone this repo
2422
git clone https://github.com/lando/varnish.git && cd varnish
2523

26-
# Install dependencies with lando
27-
lando start
28-
29-
# Or install them with npm
24+
# Install deps
3025
npm install
3126
```
3227

@@ -38,7 +33,7 @@ Note that each one of these examples contains the following section in its Lando
3833

3934
```yaml
4035
plugins:
41-
"@lando/varnish": ./../../
36+
"@lando/varnish": ../..
4237
```
4338
4439
This tells Lando that _this_ app should use the source version of the `@lando/varnish` plugin you cloned down in the installation. This is useful because it allows you to isolate development within this repo without interferring with any other apps using the stable and global version of the plugin.
@@ -62,21 +57,24 @@ npm run docs:dev
6257
6358
# build docs locally
6459
npm run docs:build
60+
61+
# preview built docs locally
62+
npm run docs:build
6563
```
6664

67-
If you are more interested in the internals of the docs they use [VuePress2](https://v2.vuepress.vuejs.org/) and our [Special theme](https://vuepress-theme-default-plus.lando.dev).
65+
If you are more interested in the internals of the docs they use [VitePress](https://vitepress.dev/) and our [SPECIAL THEME](https://vitepress-theme-default-plus.lando.dev).
6866

6967
## Testing
7068

71-
It's best to familiarize yourself with how Lando [does testing](https://docs.lando.dev/contrib/contrib-testing.html) in general before proceeding.
69+
It's best to familiarize yourself with how Lando [does testing](https://docs.lando.dev/contrib/coder.html) in general before proceeding.
7270

7371
### Unit Tests
7472

75-
Generally, unit testable code should be placed in `lib` and then the associated test in `tests` in the form `FILE-BEING-TESTED.spec.js`. Here is an example:
73+
Generally, unit testable code should be placed in `utils` and then the associated test in `tests` in the form `FILE-BEING-TESTED.spec.js`. Here is an example:
7674

7775
```bash
7876
./
79-
|-- lib
77+
|-- utils
8078
|-- stuff.js
8179
|-- test
8280
|-- stuff.spec.js
@@ -113,21 +111,18 @@ Destroy tests
113111
lando destroy -y
114112
```
115113

116-
Note that the headers here are important and are defined in our `npm run generate:tests` script. The _Start up tests_ header specifies things that should run before the main series of tests. _Verification commands_ is the main body of tests and is required. _Destroy tests_ specifies any needed clean up commands to run.
114+
Note that the headers here are important. The _Start up tests_ header specifies things that should run before the main series of tests. _Verification commands_ is the main body of tests and is required. _Destroy tests_ specifies any needed clean up commands to run.
117115

118116
If you check out the various READMEs in our [examples](https://github.com/lando/varnish/tree/main/examples) you will notice that they are all Leia tests.
119117

120118
Before running all or some of the tests you will need to generate them.
121119

122120
```bash
123-
# Generate tests
124-
npm run generate:tests
125-
126121
# Run ALL the tests, this will likely take a long time
127122
npm run test:leia
128123
129124
# Run the tests for a single example
130-
npm run leia examples/mariadb-10.2/README.md -c 'Destroy tests'
125+
npx leia examples/mariadb-10.2/README.md -c 'Destroy tests'
131126
```
132127

133128
If you've created new testable examples then you will also need to let GitHub Actions know so they can run on pull requests.
@@ -140,15 +135,12 @@ To add the new tests to the workflow just modify `jobs.leia-tests.strategy.matri
140135
jobs:
141136
leia-tests:
142137
strategy:
138+
fail-fast: false
143139
matrix:
144-
leia-tests:
145-
# This should be the filename, without .leia.js extension in the test directory
146-
# NOTE that you will need to run npm run generate:tests to see these
147-
- test: platform-sh-maria-db-10-1-example
148-
# This should be the directory that the test was generated from
149-
source: examples/mariadb-10.2
150-
- test: platform-sh-maria-db-10-2-example
151-
source: examples/mariadb-10.2
140+
leia-test:
141+
- examples/2.1
142+
- examples/2.2
143+
152144
```
153145

154146
Now open a pull request and the new tests should run!
@@ -170,4 +162,4 @@ npm install @lando/varnish@edge
170162

171163
## Contribution
172164

173-
If you want to contribute code then just follow [this flow](https://guides.github.com/introduction/flow/).
165+
If you want to contribute code then just follow [this flow](https://docs.github.com/en/get-started/using-github/github-flow).

docs/index.md

Lines changed: 3 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ next: ./config.html
88

99
[Varnish Cache](https://varnish-cache.org/intro/index.html#intro) is a web application accelerator also known as a caching HTTP reverse proxy. You install it in front of any server that speaks HTTP and configure it to cache the contents.
1010

11-
You can easily add it to your Lando app by adding an entry to the [services](https://docs.lando.dev/config/services.html) top-level config in your [Landofile](https://docs.lando.dev/config/lando.html).
11+
You can easily add it to your Lando app by adding an entry to the [services](https://docs.lando.dev/core/v3/lando-service.html) top-level config in your [Landofile](https://docs.lando.dev/core/v3).
1212

1313
```yaml
1414
services:
@@ -25,50 +25,9 @@ services:
2525
* [6](https://hub.docker.com/r/wodby/varnish)
2626
* **[4.1](https://hub.docker.com/r/wodby/varnish)** **(default)**
2727
* [4](https://hub.docker.com/r/wodby/varnish)
28-
* [custom](https://docs.lando.dev/config/services.html#advanced)
28+
* [custom](https://docs.lando.dev/core/v3/lando-service.html#overrides)
2929
3030
## Patch versions
3131
32-
This service does not support patch versions but if you **really** need something like that, you could consider using either a [custom compose service](https://docs.lando.dev/compose) or a service [overrides](https://docs.lando.dev/config/services.html#overrides).
32+
This service does not support patch versions but if you **really** need something like that, you could consider using either a [custom compose service](https://docs.lando.dev/compose) or a service [overrides](https://docs.lando.dev/core/v3/lando-service.html#overrides).
3333
34-
## Custom Installation
35-
36-
This plugin is included with Lando by default. That means if you have Lando version `3.0.8` or higher then this plugin is already installed!
37-
38-
However if you would like to manually install the plugin, update it to the bleeding edge or install a particular version then use the below. Note that this installation method requires Lando `3.5.0+`.
39-
40-
:::: code-group
41-
::: code-group-item LANDO 3.21+
42-
```bash:no-line-numbers
43-
lando plugin-add @lando/varnish
44-
```
45-
:::
46-
::: code-group-item HYPERDRIVE
47-
```bash:no-line-numbers
48-
# @TODO
49-
# @NOTE: This doesn't actaully work yet
50-
hyperdrive install @lando/varnish
51-
```
52-
:::
53-
::: code-group-item DOCKER
54-
```bash:no-line-numbers
55-
# Ensure you have a global plugins directory
56-
mkdir -p ~/.lando/plugins
57-
58-
# Install plugin
59-
# NOTE: Modify the "npm install @lando/varnish" line to install a particular version eg
60-
# npm install @lando/[email protected]
61-
docker run --rm -it -v ${HOME}/.lando/plugins:/plugins -w /tmp node:14-alpine sh -c \
62-
"npm init -y \
63-
&& npm install @lando/varnish --production --flat --no-default-rc --no-lockfile --link-duplicates \
64-
&& npm install --production --cwd /tmp/node_modules/@lando/varnish \
65-
&& mkdir -p /plugins/@lando \
66-
&& mv --force /tmp/node_modules/@lando/varnish /plugins/@lando/varnish"
67-
68-
# Rebuild the plugin cache
69-
lando --clear
70-
```
71-
:::
72-
::::
73-
74-
You should be able to verify the plugin is installed by running `lando config --path plugins` and checking for `@lando/varnish`. This command will also show you _where_ the plugin is being loaded from.

0 commit comments

Comments
 (0)