Skip to content

Commit

Permalink
feat(v2): docs versioning ❄️🔥 (#1983)
Browse files Browse the repository at this point in the history
* wip: versioning

* wip again

* nits lint

* refactor metadata code so that we can have inobject properties optimization, fix typing

* remove buggy permalink code

* modify versioned docs fixture such that foo/baz only exists in v1.0.0

* refactor metadata.ts so that there is less transformon object

* more refactoring

* reduce test fixtures, refactoring

* refactoring readability

* finish metadata part

* refactor with readdir

* first pass of implementation

* fix mdx laoder

* split generated routes by version for performance & smaller bundle

* test data for demo

* refactor with set

* more tests

* typo

* fix typo

* better temporary ui

* stronger typing & docsVersion command

* add 100% test coverage for docsVersion command

* more test and delete manual docs cut

* cut 2.0.0-alpha.35 docs

* cut alpha.36 instead

* copyright

* delete versioned docs

* stronger test on metadata

* update typo
  • Loading branch information
endiliey authored Nov 22, 2019
1 parent c413cff commit 9829f56
Show file tree
Hide file tree
Showing 45 changed files with 1,841 additions and 384 deletions.
2 changes: 2 additions & 0 deletions packages/docusaurus-plugin-content-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"license": "MIT",
"devDependencies": {
"@docusaurus/types": "^2.0.0-alpha.36",
"commander": "^4.0.1",
"picomatch": "^2.1.0"
},
"dependencies": {
Expand All @@ -22,6 +23,7 @@
"globby": "^10.0.1",
"import-fresh": "^3.1.0",
"loader-utils": "^1.2.3",
"lodash": "^4.17.15",
"shelljs": "^0.8.3"
},
"peerDependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
custom_edit_url: https://github.com/customUrl/docs/lorem.md
unrelated_frontmatter: won't be part of metadata
---

Lorem ipsum.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,4 @@ module.exports = {
url: 'https://your-docusaurus-test-site.com',
baseUrl: '/',
favicon: 'img/favicon.ico',
organizationName: 'facebook', // Usually your GitHub org/user name.
projectName: 'docusaurus', // Usually your repo name.
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is `next` version of bar.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello `next` !
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

module.exports = {
title: 'Versioned Site',
tagline: 'The tagline of my site',
url: 'https://your-docusaurus-test-site.com',
baseUrl: '/',
favicon: 'img/favicon.ico',
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"docs": {
"Test": [
"foo/bar"
],
"Guides": [
"hello"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Bar `1.0.0` !
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Baz `1.0.0` ! This will be deleted in next subsequent versions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello `1.0.0` !
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Bar `1.0.1` !
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello `1.0.1` !
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"version-1.0.0/docs": {
"Test": [
"version-1.0.0/foo/bar",
"version-1.0.0/foo/baz"
],
"Guides": [
"version-1.0.0/hello"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"version-1.0.1/docs": {
"Test": [
"version-1.0.1/foo/bar"
],
"Guides": [
"version-1.0.1/hello"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[
"1.0.1",
"1.0.0"
]
Loading

0 comments on commit 9829f56

Please sign in to comment.