Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial vitepress migration. #41

Merged
merged 7 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.temp
.cache
temp
cache
dist
_site
!.vitepress
4 changes: 2 additions & 2 deletions .github/workflows/pr-docs-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:

jobs:
unit-tests:
docs-tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -26,6 +26,6 @@ jobs:

# Run tests
- name: Run linter
run: npm run docs:lint
run: npm run lint
- name: Test build
run: npm run docs:build
9 changes: 5 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@ dist
.nyc_output
coverage/

# Vuepress
# docs
.temp
.cache
_site
docs/.vuepress/.cache
docs/.vuepress/.temp
docs/.vuepress/dist
dist
cache
temp
config.*.timestamp-*-*.*

# YARN
yarn.lock
9 changes: 9 additions & 0 deletions docs/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@
"max-len": ["error", {
"code": 12000,
"ignoreComments": true
}],
"require-jsdoc": ["error", {
"require": {
"FunctionDeclaration": false,
"MethodDefinition": false,
"ClassDeclaration": false,
"ArrowFunctionExpression": false,
"FunctionExpression": false
}
}]
}
}
56 changes: 56 additions & 0 deletions docs/.vitepress/config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import {createRequire} from 'module';

import {defineConfig} from '@lando/vitepress-theme-default-plus/config';

const require = createRequire(import.meta.url);

const {name, version} = require('../../package.json');
const landoPlugin = name.replace('@lando/', '');

export default defineConfig({
title: 'Lando Mysql Plugin',
description: 'The offical Lando plugin for Mysql.',
landoDocs: 3,
landoPlugin,
version,
head: [
['meta', {name: 'viewport', content: 'width=device-width, initial-scale=1'}],
['link', {rel: 'icon', href: '/mysql/favicon.ico', size: 'any'}],
['link', {rel: 'icon', href: '/mysql/favicon.svg', type: 'image/svg+xml'}],
],
themeConfig: {
sidebar: sidebar(),
},
});

function sidebar() {
return [
{
text: 'Introduction',
collapsed: false,
items: [
{text: 'Overview', link: '/'},
{text: 'Installation', link: '/install'},
{text: 'Usage', link: '/config'},
],
},
{
text: 'Contribution',
collapsed: false,
items: [
{text: 'Development', link: '/development'},
{text: 'Team', link: '/team'},
],
},
{
text: 'Help & Support',
collapsed: false,
items: [
{text: 'GitHub', link: 'https://github.com/lando/mysql/issues/new/choose'},
{text: 'Slack', link: 'https://www.launchpass.com/devwithlando'},
{text: 'Contact Us', link: '/support'},
],
},
{text: 'Examples', link: 'https://github.com/lando/mysql/tree/main/examples'},
];
};
3 changes: 3 additions & 0 deletions docs/.vitepress/theme/index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import VPLTheme from '@lando/vitepress-theme-default-plus';

export default VPLTheme;
40 changes: 0 additions & 40 deletions docs/.vuepress/config.js

This file was deleted.

10 changes: 5 additions & 5 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ description: Learn how to configure the Lando MySQL service.

# Configuration

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.
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.

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:
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:

::: warning Be careful when switching database type, version or credentials!
You should be careful switching database `type`, `version` or `creds`.
Expand Down Expand Up @@ -84,7 +84,7 @@ Also note that by default all `mysql` services have a passwordless `root` user.

## Using a custom MySQL config file

You may need to override our [default MySQL config](https://github.com/lando/mysql/tree/main/services/mysql) with your own [custom MySQL config](https://dev.mysql.com/doc/refman/8.0/en/option-files.html).
You may need to override our [default MySQL config](https://github.com/lando/mysql/tree/main/builders) with your own [custom MySQL config](https://dev.mysql.com/doc/refman/8.0/en/option-files.html).

If you do this, you must use a file that exists inside your application and express it relative to your project root as shown below:

Expand Down Expand Up @@ -130,7 +130,7 @@ You can then invoke them on the command line.
lando dotnet
```

Lando tooling is actually pretty powerful so definitely check out [the rest](https://docs.lando.dev/config/tooling.html) of its cool features.
Lando tooling is actually pretty powerful so definitely check out [the rest](https://docs.lando.dev/core/v3/tooling.html) of its cool features.

## Adding routing

Expand All @@ -143,4 +143,4 @@ proxy:
- something.else.local
```

Lando proxying is actually pretty powerful so definitely check out [the rest](https://docs.lando.dev/config/proxy.html) of its cool features.
Lando proxying is actually pretty powerful so definitely check out [the rest](https://docs.lando.dev/core/v3/proxy.html) of its cool features.
50 changes: 21 additions & 29 deletions docs/development.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,27 @@
---
title: Development
description: Learn how to develop and contribute to the Lando MySQL service
description: Learn how to develop and contribute to the Lando Mysql service
---

# Development

This guide contains information to help onboard developers to work on the [MySQL](https://www.mysql.com/) integration, hereafter referred to as "the plugin".
This guide contains information to help onboard developers to work on the [mysql](https://www.mysql.com/) integration, hereafter referred to as *the plugin*.

## Requirements

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

* [Lando 3.5.0+](https://docs.lando.dev/basics/installation.html), preferably installed [from source](https://docs.lando.dev/basics/installation.html#from-source).
* [Lando 3.21.0+](https://docs.lando.dev/getting-started/installation.html) preferably installed [from source](https://docs.lando.dev/install/source.html).
* [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)

While not a hard requirement it's also probably a good idea to install `node` 18
* [Node 18](https://nodejs.org/dist/latest-v18.x/)

## Installation

```bash
```sh
# Clone this repo
git clone https://github.com/lando/mysql.git && cd mysql

# Install dependencies with lando
lando start

# Or install them with npm
# Install deps
npm install
```

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

```yaml
plugins:
"@lando/mysql": ./../../
"@lando/mysql": ../..
```

This tells Lando that _this_ app should use the source version of the `@lando/mysql` 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.
Expand All @@ -62,21 +57,24 @@ npm run docs:dev

# build docs locally
npm run docs:build

# preview built docs locally
npm run docs:build
```

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).
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).

## Testing

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

### Unit Tests

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:
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:

```bash
./
|-- lib
|-- utils
|-- stuff.js
|-- test
|-- stuff.spec.js
Expand Down Expand Up @@ -113,21 +111,18 @@ Destroy tests
lando destroy -y
```

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.
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.

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

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

```bash
# Generate tests
npm run generate:tests

# Run ALL the tests, this will likely take a long time
npm run test:leia

# Run the tests for a single example
npm run leia examples/mariadb-10.2/README.md -c 'Destroy tests'
npx leia examples/mariadb-10.2/README.md -c 'Destroy tests'
```

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

```

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

## Contribution

If you want to contribute code then just follow [this flow](https://guides.github.com/introduction/flow/).
If you want to contribute code then just follow [this flow](https://docs.github.com/en/get-started/using-github/github-flow).
45 changes: 2 additions & 43 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ next: ./config.html

[MySQL](https://www.mysql.com/) is a very common database server.

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).
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).

```yaml
services:
Expand All @@ -20,7 +20,7 @@ services:

* [8.0](https://hub.docker.com/r/bitnami/mysql)
* **[5.7](https://hub.docker.com/r/bitnami/mysql)** **(default)**
* [custom](https://docs.lando.dev/config/services.html#advanced)
* [custom](https://docs.lando.dev/core/v3/lando-service.html#overrides)

## Patch versions

Expand All @@ -38,44 +38,3 @@ services:

But make sure you use one of the available [patch tags](https://hub.docker.com/r/bitnami/mysql/tags) for the underlying image we are using.

## Custom Installation

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!

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+`.

:::: code-group
::: code-group-item LANDO 3.21+
```bash:no-line-numbers
lando plugin-add @lando/mysql
```
:::
::: code-group-item HYPERDRIVE
```bash:no-line-numbers
# @TODO
# @NOTE: This doesn't actaully work yet
hyperdrive install @lando/mysql
```
:::
::: code-group-item DOCKER
```bash:no-line-numbers
# Ensure you have a global plugins directory
mkdir -p ~/.lando/plugins

# Install plugin
# NOTE: Modify the "npm install @lando/mysql" line to install a particular version eg
# npm install @lando/[email protected]
docker run --rm -it -v ${HOME}/.lando/plugins:/plugins -w /tmp node:18-alpine sh -c \
"npm init -y \
&& npm install @lando/mysql --production --flat --no-default-rc --no-lockfile --link-duplicates \
&& npm install --production --cwd /tmp/node_modules/@lando/mysql \
&& mkdir -p /plugins/@lando \
&& mv --force /tmp/node_modules/@lando/mysql /plugins/@lando/mysql"

# Rebuild the plugin cache
lando --clear
```
:::
::::

You should be able to verify the plugin is installed by running `lando config --path plugins` and checking for `@lando/mysql`. This command will also show you _where_ the plugin is being loaded from.
Loading
Loading