@docusaurus/plugin-content-docs 3.7.0-canary-6211 → 3.7.0-canary-6212
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/cli.js +17 -0
- package/lib/versions/files.d.ts +4 -0
- package/lib/versions/files.js +9 -0
- package/package.json +11 -11
- package/src/cli.ts +18 -0
- package/src/versions/files.ts +15 -0
package/lib/cli.js
CHANGED
|
@@ -76,6 +76,23 @@ async function cliDocsVersionCommand(version, { id: pluginId, path: docsPath, si
|
|
|
76
76
|
versionName: version,
|
|
77
77
|
});
|
|
78
78
|
await fs_extra_1.default.copy(docsDir, newVersionDir);
|
|
79
|
+
// Copy version JSON translation file for this locale
|
|
80
|
+
// i18n/<l>/docusaurus-plugin-content-docs/current.json => version-v1.json
|
|
81
|
+
// See https://docusaurus.io/docs/next/api/plugins/@docusaurus/plugin-content-docs#translation-files-location
|
|
82
|
+
if (locale !== i18n.defaultLocale) {
|
|
83
|
+
const dir = (0, files_1.getPluginDirPathLocalized)({
|
|
84
|
+
localizationDir,
|
|
85
|
+
pluginId,
|
|
86
|
+
});
|
|
87
|
+
const sourceFile = path_1.default.join(dir, 'current.json');
|
|
88
|
+
const dest = path_1.default.join(dir, `version-${version}.json`);
|
|
89
|
+
if (await fs_extra_1.default.pathExists(sourceFile)) {
|
|
90
|
+
await fs_extra_1.default.copy(sourceFile, dest);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
logger_1.default.warn `${pluginIdLogPrefix}: i18n translation file does not exist in path=${sourceFile}. Skipping.`;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
79
96
|
}));
|
|
80
97
|
await createVersionedSidebarFile({
|
|
81
98
|
siteDir,
|
package/lib/versions/files.d.ts
CHANGED
|
@@ -15,6 +15,10 @@ export declare function getDocsDirPathLocalized({ localizationDir, pluginId, ver
|
|
|
15
15
|
pluginId: string;
|
|
16
16
|
versionName: string;
|
|
17
17
|
}): string;
|
|
18
|
+
export declare function getPluginDirPathLocalized({ localizationDir, pluginId, }: {
|
|
19
|
+
localizationDir: string;
|
|
20
|
+
pluginId: string;
|
|
21
|
+
}): string;
|
|
18
22
|
/** `community` => `[siteDir]/community_versions.json` */
|
|
19
23
|
export declare function getVersionsFilePath(siteDir: string, pluginId: string): string;
|
|
20
24
|
/**
|
package/lib/versions/files.js
CHANGED
|
@@ -9,6 +9,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.getVersionDocsDirPath = getVersionDocsDirPath;
|
|
10
10
|
exports.getVersionSidebarsPath = getVersionSidebarsPath;
|
|
11
11
|
exports.getDocsDirPathLocalized = getDocsDirPathLocalized;
|
|
12
|
+
exports.getPluginDirPathLocalized = getPluginDirPathLocalized;
|
|
12
13
|
exports.getVersionsFilePath = getVersionsFilePath;
|
|
13
14
|
exports.readVersionsFile = readVersionsFile;
|
|
14
15
|
exports.readVersionNames = readVersionNames;
|
|
@@ -45,6 +46,14 @@ function getDocsDirPathLocalized({ localizationDir, pluginId, versionName, }) {
|
|
|
45
46
|
],
|
|
46
47
|
});
|
|
47
48
|
}
|
|
49
|
+
function getPluginDirPathLocalized({ localizationDir, pluginId, }) {
|
|
50
|
+
return (0, utils_1.getPluginI18nPath)({
|
|
51
|
+
localizationDir,
|
|
52
|
+
pluginName: 'docusaurus-plugin-content-docs',
|
|
53
|
+
pluginId,
|
|
54
|
+
subPaths: [],
|
|
55
|
+
});
|
|
56
|
+
}
|
|
48
57
|
/** `community` => `[siteDir]/community_versions.json` */
|
|
49
58
|
function getVersionsFilePath(siteDir, pluginId) {
|
|
50
59
|
return path_1.default.join(siteDir, addPluginIdPrefix(constants_1.VERSIONS_JSON_FILE, pluginId));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/plugin-content-docs",
|
|
3
|
-
"version": "3.7.0-canary-
|
|
3
|
+
"version": "3.7.0-canary-6212",
|
|
4
4
|
"description": "Docs plugin for Docusaurus.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -35,15 +35,15 @@
|
|
|
35
35
|
},
|
|
36
36
|
"license": "MIT",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@docusaurus/core": "3.7.0-canary-
|
|
39
|
-
"@docusaurus/logger": "3.7.0-canary-
|
|
40
|
-
"@docusaurus/mdx-loader": "3.7.0-canary-
|
|
41
|
-
"@docusaurus/module-type-aliases": "3.7.0-canary-
|
|
42
|
-
"@docusaurus/theme-common": "3.7.0-canary-
|
|
43
|
-
"@docusaurus/types": "3.7.0-canary-
|
|
44
|
-
"@docusaurus/utils": "3.7.0-canary-
|
|
45
|
-
"@docusaurus/utils-common": "3.7.0-canary-
|
|
46
|
-
"@docusaurus/utils-validation": "3.7.0-canary-
|
|
38
|
+
"@docusaurus/core": "3.7.0-canary-6212",
|
|
39
|
+
"@docusaurus/logger": "3.7.0-canary-6212",
|
|
40
|
+
"@docusaurus/mdx-loader": "3.7.0-canary-6212",
|
|
41
|
+
"@docusaurus/module-type-aliases": "3.7.0-canary-6212",
|
|
42
|
+
"@docusaurus/theme-common": "3.7.0-canary-6212",
|
|
43
|
+
"@docusaurus/types": "3.7.0-canary-6212",
|
|
44
|
+
"@docusaurus/utils": "3.7.0-canary-6212",
|
|
45
|
+
"@docusaurus/utils-common": "3.7.0-canary-6212",
|
|
46
|
+
"@docusaurus/utils-validation": "3.7.0-canary-6212",
|
|
47
47
|
"@types/react-router-config": "^5.0.7",
|
|
48
48
|
"combine-promises": "^1.1.0",
|
|
49
49
|
"fs-extra": "^11.1.1",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"engines": {
|
|
68
68
|
"node": ">=18.0"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "617d6bf02bab666fd3a4e7237a721a17d42fe691"
|
|
71
71
|
}
|
package/src/cli.ts
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
getVersionDocsDirPath,
|
|
15
15
|
getVersionSidebarsPath,
|
|
16
16
|
getDocsDirPathLocalized,
|
|
17
|
+
getPluginDirPathLocalized,
|
|
17
18
|
readVersionsFile,
|
|
18
19
|
} from './versions/files';
|
|
19
20
|
import {validateVersionName} from './versions/validation';
|
|
@@ -123,6 +124,23 @@ async function cliDocsVersionCommand(
|
|
|
123
124
|
versionName: version,
|
|
124
125
|
});
|
|
125
126
|
await fs.copy(docsDir, newVersionDir);
|
|
127
|
+
|
|
128
|
+
// Copy version JSON translation file for this locale
|
|
129
|
+
// i18n/<l>/docusaurus-plugin-content-docs/current.json => version-v1.json
|
|
130
|
+
// See https://docusaurus.io/docs/next/api/plugins/@docusaurus/plugin-content-docs#translation-files-location
|
|
131
|
+
if (locale !== i18n.defaultLocale) {
|
|
132
|
+
const dir = getPluginDirPathLocalized({
|
|
133
|
+
localizationDir,
|
|
134
|
+
pluginId,
|
|
135
|
+
});
|
|
136
|
+
const sourceFile = path.join(dir, 'current.json');
|
|
137
|
+
const dest = path.join(dir, `version-${version}.json`);
|
|
138
|
+
if (await fs.pathExists(sourceFile)) {
|
|
139
|
+
await fs.copy(sourceFile, dest);
|
|
140
|
+
} else {
|
|
141
|
+
logger.warn`${pluginIdLogPrefix}: i18n translation file does not exist in path=${sourceFile}. Skipping.`;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
126
144
|
}),
|
|
127
145
|
);
|
|
128
146
|
|
package/src/versions/files.ts
CHANGED
|
@@ -75,6 +75,21 @@ export function getDocsDirPathLocalized({
|
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
export function getPluginDirPathLocalized({
|
|
79
|
+
localizationDir,
|
|
80
|
+
pluginId,
|
|
81
|
+
}: {
|
|
82
|
+
localizationDir: string;
|
|
83
|
+
pluginId: string;
|
|
84
|
+
}): string {
|
|
85
|
+
return getPluginI18nPath({
|
|
86
|
+
localizationDir,
|
|
87
|
+
pluginName: 'docusaurus-plugin-content-docs',
|
|
88
|
+
pluginId,
|
|
89
|
+
subPaths: [],
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
78
93
|
/** `community` => `[siteDir]/community_versions.json` */
|
|
79
94
|
export function getVersionsFilePath(siteDir: string, pluginId: string): string {
|
|
80
95
|
return path.join(siteDir, addPluginIdPrefix(VERSIONS_JSON_FILE, pluginId));
|