Skip to content

Commit e24c93c

Browse files
authored
docs: archive v5 docs (#3482)
1 parent bee43db commit e24c93c

File tree

4 files changed

+40
-3
lines changed

4 files changed

+40
-3
lines changed

docusaurus.config.js

+35
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,27 @@ const fetch = require('node-fetch');
44

55
const VERSIONS_JSON = require('./versions.json');
66

7+
/**
8+
* Old versions of the Ionic Docs are archived so
9+
* that we do not need to re-build it every time we deploy.
10+
* Building a large number of docs sites at once can cause
11+
* out of memory issues, so archiving old docs sites
12+
* allow us to keep memory usage and build times low.
13+
*
14+
* Note that this file is only for versions of the Ionic Docs
15+
* that are built with Docusaurus. The
16+
* Ionic v3 and v4 docs are built with other tools, so those
17+
* versions are not included here.
18+
*/
19+
const ARCHIVED_VERSIONS_JSON = require('./versionsArchived.json');
20+
21+
/**
22+
* This returns an array where each entry is an array
23+
* containing the version name at index 0 and
24+
* the archive url at index 1.
25+
*/
26+
const ArchivedVersionsDropdownItems = Object.entries(ARCHIVED_VERSIONS_JSON).splice(0, 5);
27+
728
const BASE_URL = '/docs';
829

930
module.exports = {
@@ -165,6 +186,20 @@ module.exports = {
165186
type: 'docsVersionDropdown',
166187
position: 'right',
167188
dropdownItemsAfter: [
189+
...ArchivedVersionsDropdownItems.map(([versionName, versionUrl]) => ({
190+
label: versionName,
191+
/**
192+
* Use "to" instead of "href" so the
193+
* external URL icon does not show up.
194+
*/
195+
to: versionUrl,
196+
/**
197+
* Just like the version docs in this project,
198+
* we want to archived versions to open in the
199+
* same tab.
200+
*/
201+
target: '_self',
202+
})),
168203
{ to: 'https://ionicframework.com/docs/v4/components', label: 'v4', target: '_blank' },
169204
{ to: 'https://ionicframework.com/docs/v3/', label: 'v3', target: '_blank' },
170205
],

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
},
88
"scripts": {
99
"prebuild": "npm run generate-markdown; scripts/i18n.sh; if [ -n \"$CROWDIN_PERSONAL_TOKEN\" ]; then npm run crowdin:sync; fi",
10-
"build": "NODE_OPTIONS=--max_old_space_size=8192 npm run build:${VERCEL_ENV:-preview}",
10+
"build": "npm run build:${VERCEL_ENV:-preview}",
1111
"build:preview": "docusaurus build --locale en",
1212
"build:production": "docusaurus build",
1313
"clear": "docusaurus clear",

versions.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
[
22
"v7",
3-
"v6",
4-
"v5"
3+
"v6"
54
]

versionsArchived.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"v5": "https://ionic-docs-5utg8ms4c-ionic1.vercel.app/docs/v5/"
3+
}

0 commit comments

Comments
 (0)