Skip to content

Commit

Permalink
Initial vitepress migration. (#38)
Browse files Browse the repository at this point in the history
* Initial vitepress migration.

* Make checklink happy.

* Fix more checklinks.

* Configure sidebar.

* Get rid of vuepress stuff.

* Make sure vitepress deps are devDeps.

* Update vitepress and theme to latest versions.

* Update netlify.toml patterns.

* Update path to from source install insructions and update vitepress-theme-default-plus.

* chxlnx

* Test commit.

* Test commit.

---------

Co-authored-by: Mike Pirog <[email protected]>
  • Loading branch information
reynoldsalec and pirog authored Feb 9, 2024
1 parent 7610f6f commit e69ddc0
Show file tree
Hide file tree
Showing 26 changed files with 2,123 additions and 5,213 deletions.
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
}
}]
}
}
58 changes: 58 additions & 0 deletions docs/.vitepress/config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
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 Backdrop Plugin',
description: 'The offical Lando plugin for Backdrop.',
landoDocs: 3,
landoPlugin,
version,
head: [
['meta', {name: 'viewport', content: 'width=device-width, initial-scale=1'}],
['link', {rel: 'icon', href: '/backdrop/favicon.ico', size: 'any'}],
['link', {rel: 'icon', href: '/backdrop/favicon.svg', type: 'image/svg+xml'}],
],
themeConfig: {
sidebar: sidebar(),
},
});

function sidebar() {
return [
{
text: 'Introduction',
collapsed: false,
items: [
{text: 'Introduction', link: '/'},
{text: 'Installation', link: '/install'},
{text: 'Getting Started', link: '/getting-started'},
{text: 'Configuration', link: '/config'},
{text: 'Tooling', link: '/tooling'},
],
},
{
text: 'Contribution',
collapsed: true,
items: [
{text: 'Development', link: '/development'},
{text: 'Team', link: '/team'},
],
},
{
text: 'Help & Support',
collapsed: true,
items: [
{text: 'GitHub', link: 'https://github.com/lando/backdrop/issues/new/choose'},
{text: 'Slack', link: 'https://www.launchpass.com/devwithlando'},
{text: 'Contact Us', link: '/support'},
],
},
{text: 'Examples', link: 'https://github.com/lando/backdrop/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;
42 changes: 0 additions & 42 deletions docs/.vuepress/config.js

This file was deleted.

16 changes: 8 additions & 8 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 Backdrop recipe.

# Configuration

While Lando [recipes](https://docs.lando.dev/config/recipes.html) set sane defaults so they work out of the box, they are also [configurable](https://docs.lando.dev/config/recipes.html#config).
While Lando [recipes](https://docs.lando.dev/core/v3/recipes.html) set sane defaults so they work out of the box, they are also [configurable](https://docs.lando.dev/core/v3/recipes.html#config).

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

```yaml
recipe: backdrop
Expand All @@ -29,13 +29,13 @@ config:
backdrush: false
```
Note that if the above config options are not enough, all Lando recipes can be further [extended and overriden](https://docs.lando.dev/config/recipes.html#extending-and-overriding-recipes).
Note that if the above config options are not enough, all Lando recipes can be further [extended and overriden](https://docs.lando.dev/core/v3/recipes.html#extending-and-overriding-recipes).
## Choosing a php version
You can set `php` to any version that is available in our [php service](https://docs.lando.dev/php). However, you should consult the [Backdrop requirements](https://backdropcms.org/requirements) to make sure that version is actually supported by Backdrop itself.
You can set `php` to any version that is available in our [php service](https://docs.lando.dev/php). However, you should consult the [Backdrop requirements](https://docs.backdropcms.org/documentation/system-requirements) to make sure that version is actually supported by Backdrop itself.

The [recipe config](https://docs.lando.dev/config/recipes.html#config) to set the Backdrop recipe to use `php` version `5.5` is shown below:
The [recipe config](https://docs.lando.dev/core/v3/recipes.html#config) to set the Backdrop recipe to use `php` version `5.5` is shown below:

```yaml
recipe: backdrop
Expand Down Expand Up @@ -79,7 +79,7 @@ By default, this recipe will use the default version of our [mysql](https://docs

If you are unsure about how to configure the `database`, we *highly recommend* you check out both the [mysql](https://docs.lando.dev/mysql) and [mariadb](https://docs.lando.dev/mariadb) services before you change the default.

Also note that like the configuration of the `php` version, you should consult the [Backdrop requirements](https://backdropcms.org/requirements) to make sure the `database` and `version` you select is actually supported by Backdrop itself.
Also note that like the configuration of the `php` version, you should consult the [Backdrop requirements](https://docs.backdropcms.org/documentation/system-requirements) to make sure the `database` and `version` you select is actually supported by Backdrop itself.

#### Using MySQL (default)

Expand Down Expand Up @@ -107,7 +107,7 @@ config:

## Connecting to your database

Unlike other unnamed php-based CMSes, Backdrop's database connection information can be set by an environmental variable named [`BACKDROP_SETTINGS`](https://api.backdropcms.org/api/backdrop/core%21includes%21bootstrap.inc/function/backdrop_settings_initialize/1). Lando will set this variable for you which means that unless you explicitly hijack the default functionality, *you should not need to do anything* to configure your database connection.
Unlike other unnamed php-based CMSes, Backdrop's database connection information can be set by an environmental variable named [`BACKDROP_SETTINGS`](https://docs.backdropcms.org/api/backdrop/core%21includes%21bootstrap.inc/function/backdrop_settings_initialize/1). Lando will set this variable for you which means that unless you explicitly hijack the default functionality, *you should not need to do anything* to configure your database connection.

You can also examine and use this variable in-code similarly to how you would with [`LANDO_INFO`](https://docs.lando.dev/guides/lando-info.html).

Expand All @@ -131,7 +131,7 @@ You can get also get the above information, and more, by using the [`lando info`

## Using custom config files

You may need to override our [default Backdrop config](https://github.com/lando/backdrop/tree/main/recipes/backdrop) with your own.
You may need to override our [default Backdrop config](https://github.com/lando/backdrop/tree/main/builders) with your own.

If you do this, you must use files that exist inside your application and express them relative to your project root as shown below:

Expand Down
50 changes: 20 additions & 30 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,23 @@ description: Learn how to develop and contribute to the Lando Backdrop service

# Development

This guide contains information to help onboard developers to work on the [Backdrop](https://backdropcms.org/) integration, hereafter referred to as "the plugin".
This guide contains information to help onboard developers to work on the [backdrop](https://backdropcms.org) 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/backdrop.git && cd backdrop

# Install dependencies with lando
lando start
git clone https://github.com/lando/backdrop && cd backdrop

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

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

```yaml
plugins:
"@lando/backdrop": ./../../
"@lando/backdrop": ../..
```
This tells Lando that _this_ app should use the source version of the `@lando/backdrop` 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 @@ -63,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 @@ -114,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/backdrop/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 @@ -141,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 @@ -171,4 +162,3 @@ npm install @lando/backdrop@edge

## Contribution

If you want to contribute code then just follow [this flow](https://guides.github.com/introduction/flow/).
Loading

0 comments on commit e69ddc0

Please sign in to comment.