@docusaurus/plugin-content-docs 2.0.0-beta.1ab8aa0af → 2.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/.tsbuildinfo +1 -4661
- package/lib/cli.js +15 -10
- package/lib/client/docsClientUtils.d.ts +1 -1
- package/lib/client/docsClientUtils.js +3 -10
- package/lib/docFrontMatter.d.ts +1 -14
- package/lib/docFrontMatter.js +3 -2
- package/lib/docs.d.ts +1 -1
- package/lib/docs.js +22 -12
- package/lib/index.js +38 -17
- package/lib/lastUpdate.js +6 -6
- package/lib/markdown/linkify.js +1 -1
- package/lib/options.js +1 -6
- package/lib/props.js +4 -3
- package/lib/sidebarItemsGenerator.js +3 -3
- package/lib/sidebars.d.ts +3 -2
- package/lib/sidebars.js +28 -17
- package/lib/slug.js +2 -2
- package/lib/types.d.ts +18 -5
- package/lib/versions.js +54 -22
- package/package.json +13 -12
- package/src/__tests__/__fixtures__/simple-site/docs/foo/baz.md +4 -1
- package/src/__tests__/__fixtures__/simple-site/docs/hello.md +1 -0
- package/src/__tests__/__snapshots__/index.test.ts.snap +22 -13
- package/src/__tests__/cli.test.ts +16 -16
- package/src/__tests__/docFrontMatter.test.ts +47 -7
- package/src/__tests__/docs.test.ts +8 -5
- package/src/__tests__/index.test.ts +52 -12
- package/src/__tests__/lastUpdate.test.ts +3 -2
- package/src/__tests__/options.test.ts +0 -1
- package/src/__tests__/sidebars.test.ts +9 -8
- package/src/__tests__/versions.test.ts +34 -11
- package/src/cli.ts +17 -11
- package/src/client/__tests__/docsClientUtils.test.ts +6 -7
- package/src/client/docsClientUtils.ts +6 -16
- package/src/docFrontMatter.ts +5 -17
- package/src/docs.ts +28 -10
- package/src/index.ts +58 -21
- package/src/lastUpdate.ts +10 -6
- package/src/markdown/linkify.ts +1 -1
- package/src/options.ts +1 -15
- package/src/plugin-content-docs.d.ts +21 -0
- package/src/props.ts +8 -3
- package/src/sidebarItemsGenerator.ts +3 -3
- package/src/sidebars.ts +52 -19
- package/src/slug.ts +2 -2
- package/src/types.ts +23 -7
- package/src/versions.ts +88 -27
package/lib/slug.js
CHANGED
|
@@ -24,8 +24,8 @@ function getSlug({ baseID, frontmatterSlug, dirName, stripDirNumberPrefixes = tr
|
|
|
24
24
|
slug = utils_1.resolvePathname(baseSlug, resolveDirname);
|
|
25
25
|
}
|
|
26
26
|
if (!utils_1.isValidPathname(slug)) {
|
|
27
|
-
throw new Error(`We couldn't compute a valid slug for document with id
|
|
28
|
-
The slug we computed looks invalid: ${slug}
|
|
27
|
+
throw new Error(`We couldn't compute a valid slug for document with id "${baseID}" in "${dirName}" directory.
|
|
28
|
+
The slug we computed looks invalid: ${slug}.
|
|
29
29
|
Maybe your slug frontmatter is incorrect or you use weird chars in the file path?
|
|
30
30
|
By using the slug frontmatter, you should be able to fix this error, by using the slug of your choice:
|
|
31
31
|
|
package/lib/types.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export declare type VersionMetadata = ContentPaths & {
|
|
|
20
20
|
versionPath: string;
|
|
21
21
|
versionEditUrl?: string | undefined;
|
|
22
22
|
versionEditUrlLocalized?: string | undefined;
|
|
23
|
+
versionBanner: VersionBanner;
|
|
23
24
|
isLast: boolean;
|
|
24
25
|
sidebarFilePath: string | false | undefined;
|
|
25
26
|
routePriority: number | undefined;
|
|
@@ -45,9 +46,11 @@ export declare type PathOptions = {
|
|
|
45
46
|
path: string;
|
|
46
47
|
sidebarPath?: string | false | undefined;
|
|
47
48
|
};
|
|
49
|
+
export declare type VersionBanner = 'none' | 'unreleased' | 'unmaintained';
|
|
48
50
|
export declare type VersionOptions = {
|
|
49
51
|
path?: string;
|
|
50
52
|
label?: string;
|
|
53
|
+
banner?: VersionBanner;
|
|
51
54
|
};
|
|
52
55
|
export declare type VersionsOptions = {
|
|
53
56
|
lastVersion?: string;
|
|
@@ -61,7 +64,6 @@ export declare type PluginOptions = MetadataOptions & PathOptions & VersionsOpti
|
|
|
61
64
|
docItemComponent: string;
|
|
62
65
|
admonitions: Record<string, unknown>;
|
|
63
66
|
disableVersioning: boolean;
|
|
64
|
-
excludeNextVersionDocs?: boolean;
|
|
65
67
|
includeCurrentVersion: boolean;
|
|
66
68
|
sidebarItemsGenerator: SidebarItemsGeneratorOption;
|
|
67
69
|
};
|
|
@@ -124,8 +126,20 @@ export declare type LastUpdateData = {
|
|
|
124
126
|
formattedLastUpdatedAt?: string;
|
|
125
127
|
lastUpdatedBy?: string;
|
|
126
128
|
};
|
|
127
|
-
export declare type
|
|
128
|
-
|
|
129
|
+
export declare type DocFrontMatter = {
|
|
130
|
+
id?: string;
|
|
131
|
+
title?: string;
|
|
132
|
+
hide_title?: boolean;
|
|
133
|
+
hide_table_of_contents?: boolean;
|
|
134
|
+
keywords?: string[];
|
|
135
|
+
image?: string;
|
|
136
|
+
description?: string;
|
|
137
|
+
slug?: string;
|
|
138
|
+
sidebar_label?: string;
|
|
139
|
+
sidebar_position?: number;
|
|
140
|
+
pagination_label?: string;
|
|
141
|
+
custom_edit_url?: string | null;
|
|
142
|
+
parse_number_prefixes?: boolean;
|
|
129
143
|
};
|
|
130
144
|
export declare type DocMetadataBase = LastUpdateData & {
|
|
131
145
|
version: VersionName;
|
|
@@ -138,10 +152,9 @@ export declare type DocMetadataBase = LastUpdateData & {
|
|
|
138
152
|
sourceDirName: string;
|
|
139
153
|
slug: string;
|
|
140
154
|
permalink: string;
|
|
141
|
-
sidebar_label?: string;
|
|
142
155
|
sidebarPosition?: number;
|
|
143
156
|
editUrl?: string | null;
|
|
144
|
-
frontMatter:
|
|
157
|
+
frontMatter: DocFrontMatter & Record<string, unknown>;
|
|
145
158
|
};
|
|
146
159
|
export declare type DocNavLink = {
|
|
147
160
|
title: string;
|
package/lib/versions.js
CHANGED
|
@@ -14,6 +14,7 @@ const constants_1 = require("./constants");
|
|
|
14
14
|
const constants_2 = require("@docusaurus/core/lib/constants");
|
|
15
15
|
const utils_1 = require("@docusaurus/utils");
|
|
16
16
|
const lodash_1 = require("lodash");
|
|
17
|
+
const sidebars_1 = require("./sidebars");
|
|
17
18
|
// retro-compatibility: no prefix for the default plugin id
|
|
18
19
|
function addPluginIdPrefix(fileOrDir, pluginId) {
|
|
19
20
|
if (pluginId === constants_2.DEFAULT_PLUGIN_ID) {
|
|
@@ -37,16 +38,16 @@ function getVersionsFilePath(siteDir, pluginId) {
|
|
|
37
38
|
exports.getVersionsFilePath = getVersionsFilePath;
|
|
38
39
|
function ensureValidVersionString(version) {
|
|
39
40
|
if (typeof version !== 'string') {
|
|
40
|
-
throw new Error(`
|
|
41
|
+
throw new Error(`Versions should be strings. Found type "${typeof version}" for version "${version}".`);
|
|
41
42
|
}
|
|
42
43
|
// Should we forbid versions with special chars like / ?
|
|
43
44
|
if (version.trim().length === 0) {
|
|
44
|
-
throw new Error(`Invalid version
|
|
45
|
+
throw new Error(`Invalid version "${version}".`);
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
function ensureValidVersionArray(versionArray) {
|
|
48
49
|
if (!(versionArray instanceof Array)) {
|
|
49
|
-
throw new Error(`The versions file should contain an array of versions! Found content
|
|
50
|
+
throw new Error(`The versions file should contain an array of versions! Found content: ${JSON.stringify(versionArray)}`);
|
|
50
51
|
}
|
|
51
52
|
versionArray.forEach(ensureValidVersionString);
|
|
52
53
|
}
|
|
@@ -66,7 +67,7 @@ function readVersionsFile(siteDir, pluginId) {
|
|
|
66
67
|
function readVersionNames(siteDir, options) {
|
|
67
68
|
const versionFileContent = readVersionsFile(siteDir, options.id);
|
|
68
69
|
if (!versionFileContent && options.disableVersioning) {
|
|
69
|
-
throw new Error(`Docs: using disableVersioning=${options.disableVersioning} option on a non-versioned site does not make sense
|
|
70
|
+
throw new Error(`Docs: using "disableVersioning=${options.disableVersioning}" option on a non-versioned site does not make sense.`);
|
|
70
71
|
}
|
|
71
72
|
const versions = options.disableVersioning ? [] : versionFileContent !== null && versionFileContent !== void 0 ? versionFileContent : [];
|
|
72
73
|
// We add the current version at the beginning, unless
|
|
@@ -77,7 +78,7 @@ function readVersionNames(siteDir, options) {
|
|
|
77
78
|
versions.unshift(constants_1.CURRENT_VERSION_NAME);
|
|
78
79
|
}
|
|
79
80
|
if (versions.length === 0) {
|
|
80
|
-
throw new Error(`It is not possible to use docs without any version. Please check the configuration of these options: includeCurrentVersion=${options.includeCurrentVersion} disableVersioning=${options.disableVersioning}
|
|
81
|
+
throw new Error(`It is not possible to use docs without any version. Please check the configuration of these options: "includeCurrentVersion=${options.includeCurrentVersion}", "disableVersioning=${options.disableVersioning}".`);
|
|
81
82
|
}
|
|
82
83
|
return versions;
|
|
83
84
|
}
|
|
@@ -107,9 +108,7 @@ function getVersionMetadataPaths({ versionName, context, options, }) {
|
|
|
107
108
|
});
|
|
108
109
|
function getSidebarFilePath() {
|
|
109
110
|
if (isCurrentVersion) {
|
|
110
|
-
return options.sidebarPath
|
|
111
|
-
? path_1.default.resolve(context.siteDir, options.sidebarPath)
|
|
112
|
-
: options.sidebarPath;
|
|
111
|
+
return sidebars_1.resolveSidebarPathOption(context.siteDir, options.sidebarPath);
|
|
113
112
|
}
|
|
114
113
|
else {
|
|
115
114
|
return path_1.default.join(getVersionedSidebarsDirPath(context.siteDir, options.id), `version-${versionName}-sidebars.json`);
|
|
@@ -151,20 +150,46 @@ function getVersionEditUrls({ contentPath, contentPathLocalized, context: { site
|
|
|
151
150
|
versionEditUrlLocalized,
|
|
152
151
|
};
|
|
153
152
|
}
|
|
154
|
-
function
|
|
153
|
+
function getDefaultVersionBanner({ versionName, versionNames, lastVersionName, }) {
|
|
154
|
+
// Current version: good, no banner
|
|
155
|
+
if (versionName === lastVersionName) {
|
|
156
|
+
return 'none';
|
|
157
|
+
}
|
|
158
|
+
// Upcoming versions: unreleased banner
|
|
159
|
+
else if (versionNames.indexOf(versionName) < versionNames.indexOf(lastVersionName)) {
|
|
160
|
+
return 'unreleased';
|
|
161
|
+
}
|
|
162
|
+
// Older versions: display unmaintained banner
|
|
163
|
+
else {
|
|
164
|
+
return 'unmaintained';
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
function getVersionBanner({ versionName, versionNames, lastVersionName, options, }) {
|
|
168
|
+
var _a;
|
|
169
|
+
const versionOptionBanner = (_a = options.versions[versionName]) === null || _a === void 0 ? void 0 : _a.banner;
|
|
170
|
+
return (versionOptionBanner !== null && versionOptionBanner !== void 0 ? versionOptionBanner : getDefaultVersionBanner({
|
|
171
|
+
versionName,
|
|
172
|
+
versionNames,
|
|
173
|
+
lastVersionName,
|
|
174
|
+
}));
|
|
175
|
+
}
|
|
176
|
+
function createVersionMetadata({ versionName, versionNames, lastVersionName, context, options, }) {
|
|
155
177
|
var _a, _b, _c;
|
|
156
178
|
const { sidebarFilePath, contentPath, contentPathLocalized, } = getVersionMetadataPaths({
|
|
157
179
|
versionName,
|
|
158
180
|
context,
|
|
159
181
|
options,
|
|
160
182
|
});
|
|
183
|
+
const isLast = versionName === lastVersionName;
|
|
161
184
|
// retro-compatible values
|
|
162
185
|
const defaultVersionLabel = versionName === constants_1.CURRENT_VERSION_NAME ? 'Next' : versionName;
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
186
|
+
function getDefaultVersionPathPart() {
|
|
187
|
+
if (isLast) {
|
|
188
|
+
return '';
|
|
189
|
+
}
|
|
190
|
+
return versionName === constants_1.CURRENT_VERSION_NAME ? 'next' : versionName;
|
|
191
|
+
}
|
|
192
|
+
const defaultVersionPathPart = getDefaultVersionPathPart();
|
|
168
193
|
const versionOptions = (_a = options.versions[versionName]) !== null && _a !== void 0 ? _a : {};
|
|
169
194
|
const versionLabel = (_b = versionOptions.label) !== null && _b !== void 0 ? _b : defaultVersionLabel;
|
|
170
195
|
const versionPathPart = (_c = versionOptions.path) !== null && _c !== void 0 ? _c : defaultVersionPathPart;
|
|
@@ -187,6 +212,12 @@ function createVersionMetadata({ versionName, isLast, context, options, }) {
|
|
|
187
212
|
versionPath,
|
|
188
213
|
versionEditUrl: versionEditUrls === null || versionEditUrls === void 0 ? void 0 : versionEditUrls.versionEditUrl,
|
|
189
214
|
versionEditUrlLocalized: versionEditUrls === null || versionEditUrls === void 0 ? void 0 : versionEditUrls.versionEditUrlLocalized,
|
|
215
|
+
versionBanner: getVersionBanner({
|
|
216
|
+
versionName,
|
|
217
|
+
versionNames,
|
|
218
|
+
lastVersionName,
|
|
219
|
+
options,
|
|
220
|
+
}),
|
|
190
221
|
isLast,
|
|
191
222
|
routePriority,
|
|
192
223
|
sidebarFilePath,
|
|
@@ -199,7 +230,7 @@ function checkVersionMetadataPaths({ versionMetadata, context, }) {
|
|
|
199
230
|
const { siteDir } = context;
|
|
200
231
|
const isCurrentVersion = versionName === constants_1.CURRENT_VERSION_NAME;
|
|
201
232
|
if (!fs_extra_1.default.existsSync(contentPath)) {
|
|
202
|
-
throw new Error(`The docs folder does not exist for version
|
|
233
|
+
throw new Error(`The docs folder does not exist for version "${versionName}". A docs folder is expected to be found at ${path_1.default.relative(siteDir, contentPath)}.`);
|
|
203
234
|
}
|
|
204
235
|
// If the current version defines a path to a sidebar file that does not exist, we throw!
|
|
205
236
|
// Note: for versioned sidebars, the file may not exist (as we prefer to not create it rather than to create an empty file)
|
|
@@ -208,8 +239,8 @@ function checkVersionMetadataPaths({ versionMetadata, context, }) {
|
|
|
208
239
|
if (isCurrentVersion &&
|
|
209
240
|
typeof sidebarFilePath === 'string' &&
|
|
210
241
|
!fs_extra_1.default.existsSync(sidebarFilePath)) {
|
|
211
|
-
throw new Error(`The path to the sidebar file does not exist at
|
|
212
|
-
Please set the docs
|
|
242
|
+
throw new Error(`The path to the sidebar file does not exist at "${path_1.default.relative(siteDir, sidebarFilePath)}".
|
|
243
|
+
Please set the docs "sidebarPath" field in your config file to:
|
|
213
244
|
- a sidebars path that exists
|
|
214
245
|
- false: to disable the sidebar
|
|
215
246
|
- undefined: for Docusaurus generates it automatically`);
|
|
@@ -234,19 +265,19 @@ function checkVersionsOptions(availableVersionNames, options) {
|
|
|
234
265
|
}
|
|
235
266
|
const unknownVersionConfigNames = lodash_1.difference(Object.keys(options.versions), availableVersionNames);
|
|
236
267
|
if (unknownVersionConfigNames.length > 0) {
|
|
237
|
-
throw new Error(`
|
|
268
|
+
throw new Error(`Invalid docs option "versions": unknown versions (${unknownVersionConfigNames.join(',')}) found. ${availableVersionNamesMsg}`);
|
|
238
269
|
}
|
|
239
270
|
if (options.onlyIncludeVersions) {
|
|
240
271
|
if (options.onlyIncludeVersions.length === 0) {
|
|
241
|
-
throw new Error(`
|
|
272
|
+
throw new Error(`Invalid docs option "onlyIncludeVersions": an empty array is not allowed, at least one version is needed.`);
|
|
242
273
|
}
|
|
243
274
|
const unknownOnlyIncludeVersionNames = lodash_1.difference(options.onlyIncludeVersions, availableVersionNames);
|
|
244
275
|
if (unknownOnlyIncludeVersionNames.length > 0) {
|
|
245
|
-
throw new Error(`
|
|
276
|
+
throw new Error(`Invalid docs option "onlyIncludeVersions": unknown versions (${unknownOnlyIncludeVersionNames.join(',')}) found. ${availableVersionNamesMsg}`);
|
|
246
277
|
}
|
|
247
278
|
if (options.lastVersion &&
|
|
248
279
|
!options.onlyIncludeVersions.includes(options.lastVersion)) {
|
|
249
|
-
throw new Error(`
|
|
280
|
+
throw new Error(`Invalid docs option "lastVersion": if you use both the "onlyIncludeVersions" and "lastVersion" options, then "lastVersion" must be present in the provided "onlyIncludeVersions" array.`);
|
|
250
281
|
}
|
|
251
282
|
}
|
|
252
283
|
}
|
|
@@ -270,7 +301,8 @@ function readVersionsMetadata({ context, options, }) {
|
|
|
270
301
|
const lastVersionName = (_a = options.lastVersion) !== null && _a !== void 0 ? _a : getDefaultLastVersionName(versionNames);
|
|
271
302
|
const versionsMetadata = versionNames.map((versionName) => createVersionMetadata({
|
|
272
303
|
versionName,
|
|
273
|
-
|
|
304
|
+
versionNames,
|
|
305
|
+
lastVersionName,
|
|
274
306
|
context,
|
|
275
307
|
options,
|
|
276
308
|
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/plugin-content-docs",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.2",
|
|
4
4
|
"description": "Docs plugin for Docusaurus.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/plugin-content-docs.d.ts",
|
|
@@ -18,22 +18,23 @@
|
|
|
18
18
|
},
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@docusaurus/module-type-aliases": "2.0.0-beta.
|
|
21
|
+
"@docusaurus/module-type-aliases": "2.0.0-beta.2",
|
|
22
22
|
"@types/js-yaml": "^4.0.0",
|
|
23
23
|
"@types/picomatch": "^2.2.1",
|
|
24
24
|
"commander": "^5.1.0",
|
|
25
25
|
"picomatch": "^2.1.1"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@docusaurus/core": "2.0.0-beta.
|
|
29
|
-
"@docusaurus/mdx-loader": "2.0.0-beta.
|
|
30
|
-
"@docusaurus/types": "2.0.0-beta.
|
|
31
|
-
"@docusaurus/utils": "2.0.0-beta.
|
|
32
|
-
"@docusaurus/utils-validation": "2.0.0-beta.
|
|
33
|
-
"chalk": "^4.1.
|
|
28
|
+
"@docusaurus/core": "2.0.0-beta.2",
|
|
29
|
+
"@docusaurus/mdx-loader": "2.0.0-beta.2",
|
|
30
|
+
"@docusaurus/types": "2.0.0-beta.2",
|
|
31
|
+
"@docusaurus/utils": "2.0.0-beta.2",
|
|
32
|
+
"@docusaurus/utils-validation": "2.0.0-beta.2",
|
|
33
|
+
"chalk": "^4.1.1",
|
|
34
34
|
"combine-promises": "^1.1.0",
|
|
35
|
+
"escape-string-regexp": "^4.0.0",
|
|
35
36
|
"execa": "^5.0.0",
|
|
36
|
-
"fs-extra": "^
|
|
37
|
+
"fs-extra": "^10.0.0",
|
|
37
38
|
"globby": "^11.0.2",
|
|
38
39
|
"import-fresh": "^3.2.2",
|
|
39
40
|
"js-yaml": "^4.0.0",
|
|
@@ -41,9 +42,9 @@
|
|
|
41
42
|
"lodash": "^4.17.20",
|
|
42
43
|
"remark-admonitions": "^1.2.1",
|
|
43
44
|
"shelljs": "^0.8.4",
|
|
44
|
-
"tslib": "^2.
|
|
45
|
+
"tslib": "^2.2.0",
|
|
45
46
|
"utility-types": "^3.10.0",
|
|
46
|
-
"webpack": "^5.
|
|
47
|
+
"webpack": "^5.40.0"
|
|
47
48
|
},
|
|
48
49
|
"peerDependencies": {
|
|
49
50
|
"react": "^16.8.4 || ^17.0.0",
|
|
@@ -52,5 +53,5 @@
|
|
|
52
53
|
"engines": {
|
|
53
54
|
"node": ">=12.13.0"
|
|
54
55
|
},
|
|
55
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "883f07fddffaf1657407c8e202e370cc436e25f7"
|
|
56
57
|
}
|
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
id: baz
|
|
3
3
|
title: baz
|
|
4
4
|
slug: bazSlug.html
|
|
5
|
+
pagination_label: baz pagination_label
|
|
5
6
|
---
|
|
6
7
|
|
|
8
|
+
# Baz markdown title
|
|
9
|
+
|
|
7
10
|
## Images
|
|
8
11
|
|
|
9
12
|
Like links, Images also have a footnote style syntax
|
|
@@ -34,7 +37,7 @@ Duplicated footnote reference[^second].
|
|
|
34
37
|
|
|
35
38
|
[^first]: Footnote **can have markup**
|
|
36
39
|
|
|
37
|
-
|
|
40
|
+
and multiple paragraphs.
|
|
38
41
|
|
|
39
42
|
[^second]: Footnote text.
|
|
40
43
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`sidebar site with wrong sidebar content 1`] = `
|
|
4
|
-
"
|
|
4
|
+
"Invalid sidebar file at \\"packages/docusaurus-plugin-content-docs/src/__tests__/__fixtures__/simple-site/wrong-sidebars.json\\".
|
|
5
5
|
These sidebar document ids do not exist:
|
|
6
|
-
- goku
|
|
6
|
+
- goku
|
|
7
7
|
|
|
8
|
-
Available document ids
|
|
8
|
+
Available document ids are:
|
|
9
9
|
- foo/bar
|
|
10
10
|
- foo/baz
|
|
11
11
|
- headingAsTitle
|
|
@@ -168,7 +168,7 @@ Object {
|
|
|
168
168
|
\\"unversionedId\\": \\"foo/bar\\",
|
|
169
169
|
\\"id\\": \\"foo/bar\\",
|
|
170
170
|
\\"isDocsHomePage\\": false,
|
|
171
|
-
\\"title\\": \\"
|
|
171
|
+
\\"title\\": \\"Bar\\",
|
|
172
172
|
\\"description\\": \\"This is custom description\\",
|
|
173
173
|
\\"source\\": \\"@site/docs/foo/bar.md\\",
|
|
174
174
|
\\"sourceDirName\\": \\"foo\\",
|
|
@@ -182,7 +182,7 @@ Object {
|
|
|
182
182
|
},
|
|
183
183
|
\\"sidebar\\": \\"docs\\",
|
|
184
184
|
\\"next\\": {
|
|
185
|
-
\\"title\\": \\"baz\\",
|
|
185
|
+
\\"title\\": \\"baz pagination_label\\",
|
|
186
186
|
\\"permalink\\": \\"/docs/foo/bazSlug.html\\"
|
|
187
187
|
}
|
|
188
188
|
}",
|
|
@@ -200,15 +200,16 @@ Object {
|
|
|
200
200
|
\\"frontMatter\\": {
|
|
201
201
|
\\"id\\": \\"baz\\",
|
|
202
202
|
\\"title\\": \\"baz\\",
|
|
203
|
-
\\"slug\\": \\"bazSlug.html\\"
|
|
203
|
+
\\"slug\\": \\"bazSlug.html\\",
|
|
204
|
+
\\"pagination_label\\": \\"baz pagination_label\\"
|
|
204
205
|
},
|
|
205
206
|
\\"sidebar\\": \\"docs\\",
|
|
206
207
|
\\"previous\\": {
|
|
207
|
-
\\"title\\": \\"
|
|
208
|
+
\\"title\\": \\"Bar\\",
|
|
208
209
|
\\"permalink\\": \\"/docs/foo/bar\\"
|
|
209
210
|
},
|
|
210
211
|
\\"next\\": {
|
|
211
|
-
\\"title\\": \\"Hello
|
|
212
|
+
\\"title\\": \\"Hello sidebar_label\\",
|
|
212
213
|
\\"permalink\\": \\"/docs/\\"
|
|
213
214
|
}
|
|
214
215
|
}",
|
|
@@ -238,11 +239,12 @@ Object {
|
|
|
238
239
|
\\"version\\": \\"current\\",
|
|
239
240
|
\\"frontMatter\\": {
|
|
240
241
|
\\"id\\": \\"hello\\",
|
|
241
|
-
\\"title\\": \\"Hello, World !\\"
|
|
242
|
+
\\"title\\": \\"Hello, World !\\",
|
|
243
|
+
\\"sidebar_label\\": \\"Hello sidebar_label\\"
|
|
242
244
|
},
|
|
243
245
|
\\"sidebar\\": \\"docs\\",
|
|
244
246
|
\\"previous\\": {
|
|
245
|
-
\\"title\\": \\"baz\\",
|
|
247
|
+
\\"title\\": \\"baz pagination_label\\",
|
|
246
248
|
\\"permalink\\": \\"/docs/foo/bazSlug.html\\"
|
|
247
249
|
}
|
|
248
250
|
}",
|
|
@@ -403,6 +405,7 @@ Object {
|
|
|
403
405
|
\\"pluginId\\": \\"default\\",
|
|
404
406
|
\\"version\\": \\"current\\",
|
|
405
407
|
\\"label\\": \\"Next\\",
|
|
408
|
+
\\"banner\\": \\"none\\",
|
|
406
409
|
\\"isLast\\": true,
|
|
407
410
|
\\"docsSidebars\\": {
|
|
408
411
|
\\"docs\\": [
|
|
@@ -418,7 +421,7 @@ Object {
|
|
|
418
421
|
\\"items\\": [
|
|
419
422
|
{
|
|
420
423
|
\\"type\\": \\"link\\",
|
|
421
|
-
\\"label\\": \\"
|
|
424
|
+
\\"label\\": \\"Bar\\",
|
|
422
425
|
\\"href\\": \\"/docs/foo/bar\\"
|
|
423
426
|
},
|
|
424
427
|
{
|
|
@@ -435,7 +438,7 @@ Object {
|
|
|
435
438
|
},
|
|
436
439
|
{
|
|
437
440
|
\\"type\\": \\"link\\",
|
|
438
|
-
\\"label\\": \\"Hello
|
|
441
|
+
\\"label\\": \\"Hello sidebar_label\\",
|
|
439
442
|
\\"href\\": \\"/docs/\\"
|
|
440
443
|
}
|
|
441
444
|
]
|
|
@@ -447,7 +450,7 @@ Object {
|
|
|
447
450
|
\\"items\\": [
|
|
448
451
|
{
|
|
449
452
|
\\"type\\": \\"link\\",
|
|
450
|
-
\\"label\\": \\"Hello
|
|
453
|
+
\\"label\\": \\"Hello sidebar_label\\",
|
|
451
454
|
\\"href\\": \\"/docs/\\"
|
|
452
455
|
}
|
|
453
456
|
]
|
|
@@ -870,6 +873,7 @@ Object {
|
|
|
870
873
|
\\"pluginId\\": \\"community\\",
|
|
871
874
|
\\"version\\": \\"1.0.0\\",
|
|
872
875
|
\\"label\\": \\"1.0.0\\",
|
|
876
|
+
\\"banner\\": \\"none\\",
|
|
873
877
|
\\"isLast\\": true,
|
|
874
878
|
\\"docsSidebars\\": {
|
|
875
879
|
\\"version-1.0.0/community\\": [
|
|
@@ -888,6 +892,7 @@ Object {
|
|
|
888
892
|
\\"pluginId\\": \\"community\\",
|
|
889
893
|
\\"version\\": \\"current\\",
|
|
890
894
|
\\"label\\": \\"Next\\",
|
|
895
|
+
\\"banner\\": \\"unreleased\\",
|
|
891
896
|
\\"isLast\\": false,
|
|
892
897
|
\\"docsSidebars\\": {
|
|
893
898
|
\\"community\\": [
|
|
@@ -1400,6 +1405,7 @@ Object {
|
|
|
1400
1405
|
\\"pluginId\\": \\"default\\",
|
|
1401
1406
|
\\"version\\": \\"1.0.0\\",
|
|
1402
1407
|
\\"label\\": \\"1.0.0\\",
|
|
1408
|
+
\\"banner\\": \\"unmaintained\\",
|
|
1403
1409
|
\\"isLast\\": false,
|
|
1404
1410
|
\\"docsSidebars\\": {
|
|
1405
1411
|
\\"version-1.0.0/docs\\": [
|
|
@@ -1444,6 +1450,7 @@ Object {
|
|
|
1444
1450
|
\\"pluginId\\": \\"default\\",
|
|
1445
1451
|
\\"version\\": \\"1.0.1\\",
|
|
1446
1452
|
\\"label\\": \\"1.0.1\\",
|
|
1453
|
+
\\"banner\\": \\"none\\",
|
|
1447
1454
|
\\"isLast\\": true,
|
|
1448
1455
|
\\"docsSidebars\\": {
|
|
1449
1456
|
\\"version-1.0.1/docs\\": [
|
|
@@ -1482,6 +1489,7 @@ Object {
|
|
|
1482
1489
|
\\"pluginId\\": \\"default\\",
|
|
1483
1490
|
\\"version\\": \\"current\\",
|
|
1484
1491
|
\\"label\\": \\"Next\\",
|
|
1492
|
+
\\"banner\\": \\"unreleased\\",
|
|
1485
1493
|
\\"isLast\\": false,
|
|
1486
1494
|
\\"docsSidebars\\": {
|
|
1487
1495
|
\\"docs\\": [
|
|
@@ -1520,6 +1528,7 @@ Object {
|
|
|
1520
1528
|
\\"pluginId\\": \\"default\\",
|
|
1521
1529
|
\\"version\\": \\"withSlugs\\",
|
|
1522
1530
|
\\"label\\": \\"withSlugs\\",
|
|
1531
|
+
\\"banner\\": \\"unmaintained\\",
|
|
1523
1532
|
\\"isLast\\": false,
|
|
1524
1533
|
\\"docsSidebars\\": {
|
|
1525
1534
|
\\"version-1.0.1/docs\\": [
|
|
@@ -35,7 +35,7 @@ describe('docsVersion', () => {
|
|
|
35
35
|
DEFAULT_OPTIONS,
|
|
36
36
|
),
|
|
37
37
|
).toThrowErrorMatchingInlineSnapshot(
|
|
38
|
-
`"[docs]
|
|
38
|
+
`"[docs]: no version tag specified! Pass the version you wish to create as an argument, for example: 1.0.0."`,
|
|
39
39
|
);
|
|
40
40
|
expect(() =>
|
|
41
41
|
cliDocsVersionCommand(
|
|
@@ -45,7 +45,7 @@ describe('docsVersion', () => {
|
|
|
45
45
|
DEFAULT_OPTIONS,
|
|
46
46
|
),
|
|
47
47
|
).toThrowErrorMatchingInlineSnapshot(
|
|
48
|
-
`"[docs]
|
|
48
|
+
`"[docs]: no version tag specified! Pass the version you wish to create as an argument, for example: 1.0.0."`,
|
|
49
49
|
);
|
|
50
50
|
expect(() =>
|
|
51
51
|
cliDocsVersionCommand(
|
|
@@ -55,7 +55,7 @@ describe('docsVersion', () => {
|
|
|
55
55
|
DEFAULT_OPTIONS,
|
|
56
56
|
),
|
|
57
57
|
).toThrowErrorMatchingInlineSnapshot(
|
|
58
|
-
`"[docs]
|
|
58
|
+
`"[docs]: no version tag specified! Pass the version you wish to create as an argument, for example: 1.0.0."`,
|
|
59
59
|
);
|
|
60
60
|
});
|
|
61
61
|
|
|
@@ -68,7 +68,7 @@ describe('docsVersion', () => {
|
|
|
68
68
|
DEFAULT_OPTIONS,
|
|
69
69
|
),
|
|
70
70
|
).toThrowErrorMatchingInlineSnapshot(
|
|
71
|
-
`"[docs]
|
|
71
|
+
`"[docs]: invalid version tag specified! Do not include slash (/) or backslash (\\\\). Try something like: 1.0.0."`,
|
|
72
72
|
);
|
|
73
73
|
expect(() =>
|
|
74
74
|
cliDocsVersionCommand(
|
|
@@ -78,7 +78,7 @@ describe('docsVersion', () => {
|
|
|
78
78
|
DEFAULT_OPTIONS,
|
|
79
79
|
),
|
|
80
80
|
).toThrowErrorMatchingInlineSnapshot(
|
|
81
|
-
`"[docs]
|
|
81
|
+
`"[docs]: invalid version tag specified! Do not include slash (/) or backslash (\\\\). Try something like: 1.0.0."`,
|
|
82
82
|
);
|
|
83
83
|
});
|
|
84
84
|
|
|
@@ -91,7 +91,7 @@ describe('docsVersion', () => {
|
|
|
91
91
|
DEFAULT_OPTIONS,
|
|
92
92
|
),
|
|
93
93
|
).toThrowErrorMatchingInlineSnapshot(
|
|
94
|
-
`"[docs]
|
|
94
|
+
`"[docs]: invalid version tag specified! Length cannot exceed 32 characters. Try something like: 1.0.0."`,
|
|
95
95
|
);
|
|
96
96
|
});
|
|
97
97
|
|
|
@@ -104,7 +104,7 @@ describe('docsVersion', () => {
|
|
|
104
104
|
DEFAULT_OPTIONS,
|
|
105
105
|
),
|
|
106
106
|
).toThrowErrorMatchingInlineSnapshot(
|
|
107
|
-
`"[docs]
|
|
107
|
+
`"[docs]: invalid version tag specified! Do not name your version \\".\\" or \\"..\\". Try something like: 1.0.0."`,
|
|
108
108
|
);
|
|
109
109
|
expect(() =>
|
|
110
110
|
cliDocsVersionCommand(
|
|
@@ -114,7 +114,7 @@ describe('docsVersion', () => {
|
|
|
114
114
|
DEFAULT_OPTIONS,
|
|
115
115
|
),
|
|
116
116
|
).toThrowErrorMatchingInlineSnapshot(
|
|
117
|
-
`"[docs]
|
|
117
|
+
`"[docs]: invalid version tag specified! Do not name your version \\".\\" or \\"..\\". Try something like: 1.0.0."`,
|
|
118
118
|
);
|
|
119
119
|
});
|
|
120
120
|
|
|
@@ -127,7 +127,7 @@ describe('docsVersion', () => {
|
|
|
127
127
|
DEFAULT_OPTIONS,
|
|
128
128
|
),
|
|
129
129
|
).toThrowErrorMatchingInlineSnapshot(
|
|
130
|
-
`"[docs]
|
|
130
|
+
`"[docs]: invalid version tag specified! Please ensure its a valid pathname too. Try something like: 1.0.0."`,
|
|
131
131
|
);
|
|
132
132
|
expect(() =>
|
|
133
133
|
cliDocsVersionCommand(
|
|
@@ -137,7 +137,7 @@ describe('docsVersion', () => {
|
|
|
137
137
|
DEFAULT_OPTIONS,
|
|
138
138
|
),
|
|
139
139
|
).toThrowErrorMatchingInlineSnapshot(
|
|
140
|
-
`"[docs]
|
|
140
|
+
`"[docs]: invalid version tag specified! Please ensure its a valid pathname too. Try something like: 1.0.0."`,
|
|
141
141
|
);
|
|
142
142
|
expect(() =>
|
|
143
143
|
cliDocsVersionCommand(
|
|
@@ -147,7 +147,7 @@ describe('docsVersion', () => {
|
|
|
147
147
|
DEFAULT_OPTIONS,
|
|
148
148
|
),
|
|
149
149
|
).toThrowErrorMatchingInlineSnapshot(
|
|
150
|
-
`"[docs]
|
|
150
|
+
`"[docs]: invalid version tag specified! Please ensure its a valid pathname too. Try something like: 1.0.0."`,
|
|
151
151
|
);
|
|
152
152
|
});
|
|
153
153
|
|
|
@@ -160,7 +160,7 @@ describe('docsVersion', () => {
|
|
|
160
160
|
DEFAULT_OPTIONS,
|
|
161
161
|
),
|
|
162
162
|
).toThrowErrorMatchingInlineSnapshot(
|
|
163
|
-
`"[docs]
|
|
163
|
+
`"[docs]: this version already exists! Use a version tag that does not already exist."`,
|
|
164
164
|
);
|
|
165
165
|
});
|
|
166
166
|
|
|
@@ -174,7 +174,7 @@ describe('docsVersion', () => {
|
|
|
174
174
|
DEFAULT_OPTIONS,
|
|
175
175
|
),
|
|
176
176
|
).toThrowErrorMatchingInlineSnapshot(
|
|
177
|
-
`"[docs]
|
|
177
|
+
`"[docs]: there is no docs to version!"`,
|
|
178
178
|
);
|
|
179
179
|
});
|
|
180
180
|
|
|
@@ -218,7 +218,7 @@ describe('docsVersion', () => {
|
|
|
218
218
|
getVersionsFilePath(simpleSiteDir, DEFAULT_PLUGIN_ID),
|
|
219
219
|
);
|
|
220
220
|
expect(versions).toEqual(['1.0.0']);
|
|
221
|
-
expect(consoleMock).toHaveBeenCalledWith('[docs]
|
|
221
|
+
expect(consoleMock).toHaveBeenCalledWith('[docs]: version 1.0.0 created!');
|
|
222
222
|
|
|
223
223
|
copyMock.mockRestore();
|
|
224
224
|
writeMock.mockRestore();
|
|
@@ -271,7 +271,7 @@ describe('docsVersion', () => {
|
|
|
271
271
|
getVersionsFilePath(versionedSiteDir, DEFAULT_PLUGIN_ID),
|
|
272
272
|
);
|
|
273
273
|
expect(versions).toEqual(['2.0.0', '1.0.1', '1.0.0', 'withSlugs']);
|
|
274
|
-
expect(consoleMock).toHaveBeenCalledWith('[docs]
|
|
274
|
+
expect(consoleMock).toHaveBeenCalledWith('[docs]: version 2.0.0 created!');
|
|
275
275
|
|
|
276
276
|
copyMock.mockRestore();
|
|
277
277
|
writeMock.mockRestore();
|
|
@@ -322,7 +322,7 @@ describe('docsVersion', () => {
|
|
|
322
322
|
);
|
|
323
323
|
expect(versions).toEqual(['2.0.0', '1.0.0']);
|
|
324
324
|
expect(consoleMock).toHaveBeenCalledWith(
|
|
325
|
-
'[community]
|
|
325
|
+
'[community]: version 2.0.0 created!',
|
|
326
326
|
);
|
|
327
327
|
|
|
328
328
|
copyMock.mockRestore();
|