Skip to content

Commit

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

* Checklinks.

* Checklinks.

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

* Test commit.
  • Loading branch information
reynoldsalec authored Feb 9, 2024
1 parent 8c95486 commit 3223bc6
Show file tree
Hide file tree
Showing 26 changed files with 1,401 additions and 3,052 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
12 changes: 8 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,14 @@ dist
.nyc_output
coverage/

# Vuepress
# docs
.temp
.cache
_site
docs/.vuepress/.cache
docs/.vuepress/.temp
docs/.vuepress/distyarn.lock
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 Solr Plugin',
description: 'The offical Lando plugin for Solr.',
landoDocs: 3,
landoPlugin,
version,
head: [
['meta', {name: 'viewport', content: 'width=device-width, initial-scale=1'}],
['link', {rel: 'icon', href: '/solr/favicon.ico', size: 'any'}],
['link', {rel: 'icon', href: '/solr/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/solr/issues/new/choose'},
{text: 'Slack', link: 'https://www.launchpass.com/devwithlando'},
{text: 'Contact Us', link: '/support'},
],
},
{text: 'Examples', link: 'https://github.com/lando/solr/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.

4 changes: 2 additions & 2 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 Solr 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:

```yaml
services:
Expand Down
48 changes: 20 additions & 28 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,23 @@ description: Learn how to develop and contribute to the Lando Solr service

# Development

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

# 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/solr": ./../../
"@lando/solr": ../..
```
This tells Lando that _this_ app should use the source version of the `@lando/solr` 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/solr/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/solr@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).
Loading

0 comments on commit 3223bc6

Please sign in to comment.