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

Pirog999 #54

Merged
merged 7 commits into from
Oct 2, 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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## {{ UNRELEASED_VERSION }} - [{{ UNRELEASED_DATE }}]({{ UNRELEASED_LINK }})

* Improved dev release resolution

## v1.1.0-beta.5 - [October 1, 2024](https://github.com/lando/vitepress-theme-default-plus/releases/tag/v1.1.0-beta.5)

* Changed `VPLVersionLink` to _not_ normalize links
Expand Down
5 changes: 3 additions & 2 deletions docs/.vitepress/config.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import {createRequire} from 'module';
import {resolve, dirname} from 'node:path';
import {fileURLToPath} from 'node:url';

import {default as isDevRelease} from '@lando/vitepress-theme-default-plus/is-dev-release';

import {defineConfig} from '../../config';

const require = createRequire(import.meta.url);
const __dirname = dirname(resolve(fileURLToPath(import.meta.url)));
const require = createRequire(import.meta.url);

// get version info
const {version} = require('../../package.json');

// sidebar ender
const sidebarEnder = {
text: `v${version}`,
text: process?.env?.LANDO_MVB_VERSION ? process.env.LANDO_MVB_VERSION : `v${version}`,
collapsed: true,
items: [
{
Expand Down
16 changes: 15 additions & 1 deletion docs/guides/multiversion-vitepress-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,21 @@ You will want to update your build process from something like `npx vitepress bu
command = "npx mvb docs" // [!code ++]
```

You can get more detail on the `mvp` command [over here](../build/multiversion-vitepress-build.md).
You can get more detail on the `mvb` command [over here](../build/multiversion-vitepress-build.md).

You may also want to consider using the usual `npx vitepress build docs` in certain build contect eg pull requests that generate previews as that probably makes more sense for various reasons.

Here is what we do in our `netlify.toml` to separate between `deploy-preview` and all other build contexts.

```toml
[build]
base = "./"
publish = "docs/.vitepress/dist/"
command = "npx mvb docs"

[context.deploy-preview]
command = "npm run build"
```

## 3. Index

Expand Down
4 changes: 4 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
base = "./"
publish = "docs/.vitepress/dist/"
command = "npx mvb docs"

[context.deploy-preview]
command = "npm run build"

# Sets our asset optimization
[build.processing.css]
bundle = true
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
},
"type": "module",
"scripts": {
"build": "vitepress build docs",
"build": "LANDO_MVB_VERSION=$(git describe --tags --always --abbrev=1 --match=\"v[0-9].*\") vitepress build docs",
"mvb": "npx mvb docs",
"dev": "vitepress dev docs",
"dev": "LANDO_MVB_VERSION=$(git describe --tags --always --abbrev=1 --match=\"v[0-9].*\") vitepress dev docs",
"lint": "eslint . --ext .js,.vue",
"preview": "vitepress preview docs",
"test": "npm run lint"
Expand Down
14 changes: 8 additions & 6 deletions utils/get-tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ export default function async(
debug = Debug('@lando/get-tags'), // eslint-disable-line
} = {},
) {
// start with a command that will get ALL THE AUTHORS
const command = ['git', '--no-pager', 'tag', '--list', `"${match}"`];
// stdout opts
const opts = {cwd, trim: true};
// commands
const tagCmd = ['git', '--no-pager', 'tag', '--list', `"${match}"`];
const devReleaseCmd = ['git', 'describe', '--tags', '--always', '--abbrev=1', `--match="${match}"`];
debug('getting tags with %o with exec options %o', tagCmd, opts);
debug('getting dev release with %o with exec options %o', devReleaseCmd, opts);

// get first load of tags
debug('running command %o with exec options %o', command, opts);
const tags = getStdOut(command.join(' '), opts);
const tags = getStdOut(tagCmd.join(' '), opts);
debug('matched %o tags with %o', tags.split('\n').length, match);

// match tags to versions
Expand All @@ -38,7 +40,7 @@ export default function async(
if (versions.length > 0) {
aliases.edge = versions[0];
aliases.stable = versions.filter(version => semver.prerelease(version) === null)[0];
aliases.dev = getStdOut(`git describe --tags --always --abbrev=1 --match="${match}" ${getBranch(cwd)}`, opts);
aliases.dev = getStdOut(`${devReleaseCmd.join(' ')} ${getBranch(cwd)} || ${devReleaseCmd.join(' ')}`, opts);
}
debug('generated aliases %o', aliases);

Expand Down
Loading