@alauda/doom 0.12.0 → 0.12.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.
@@ -0,0 +1,4 @@
1
+ import { type Sidebar } from '@rspress/core';
2
+ import { Command } from 'commander';
3
+ export declare const processExport: (sidebar: Sidebar, lang: string) => Promise<void>;
4
+ export declare const exportCommand: Command;
@@ -0,0 +1,33 @@
1
+ import { serve } from '@rspress/core';
2
+ import { Command } from 'commander';
3
+ import { chromium } from 'playwright';
4
+ import { autoSidebar } from '../plugins/auto-sidebar/index.js';
5
+ import { loadConfig } from './load-config.js';
6
+ export const processExport = async (sidebar, lang) => {
7
+ console.log(sidebar, lang);
8
+ chromium.launch({
9
+ headless: false,
10
+ });
11
+ };
12
+ export const exportCommand = new Command('export')
13
+ .description('Export the documentation to docx/pdf format')
14
+ .argument('[root]', 'Root directory of the documentation')
15
+ .option('--host [host]', 'Host name')
16
+ .option('--port [port]', 'Port number', '4173')
17
+ .action(async function (root) {
18
+ const { port, host, ...globalOptions } = this.optsWithGlobals();
19
+ const { config } = await loadConfig(root, globalOptions);
20
+ const { hasLocales } = await autoSidebar({
21
+ ...config.sidebar,
22
+ excludeRoutes: (globalOptions.ignore && config.internalRoutes) || [],
23
+ }, config);
24
+ await serve({ config, host, port });
25
+ if (hasLocales) {
26
+ for (const { lang, sidebar } of config.themeConfig.locales) {
27
+ await processExport(sidebar, lang);
28
+ }
29
+ }
30
+ else {
31
+ await processExport(config.themeConfig.sidebar, config.lang);
32
+ }
33
+ });
@@ -165,7 +165,6 @@ export const autoSidebarPlugin = ({ excludeRoutes, collapsed, } = {}) => {
165
165
  const root = config.root;
166
166
  const langs = config.themeConfig.locales.map((locale) => locale.lang);
167
167
  const hasLocales = langs.length > 0;
168
- const hasLang = Boolean(config.lang);
169
168
  const versions = config.multiVersion?.versions || [];
170
169
  const defaultLang = config.lang || '';
171
170
  const { default: defaultVersion = '' } = config.multiVersion || {};
@@ -178,9 +177,6 @@ export const autoSidebarPlugin = ({ excludeRoutes, collapsed, } = {}) => {
178
177
  }));
179
178
  }
180
179
  else {
181
- if (hasLang) {
182
- return config;
183
- }
184
180
  const walks = versions.length
185
181
  ? await Promise.all(versions.map((version) => {
186
182
  const routePrefix = addTrailingSlash(version === defaultVersion ? '' : `/${version}`);
@@ -4,7 +4,7 @@ export const permissionPlugin = ({ localBasePath, functionresources = [], rolete
4
4
  name: 'doom-permission',
5
5
  async addRuntimeModules(config, isProd) {
6
6
  return {
7
- ...(await generateRuntimeModule(functionresources, 'permission-functionResources', localBasePath, config.root, isProd, ({ items }) => items)),
7
+ ...(await generateRuntimeModule(functionresources, 'permission-functionResources', config.root, localBasePath, isProd, ({ items }) => items)),
8
8
  ...(await generateRuntimeModule(roletemplates, 'permission-roleTemplates', config.root, localBasePath, isProd, ({ items }) => items)),
9
9
  };
10
10
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alauda/doom",
3
- "version": "0.12.0",
3
+ "version": "0.12.2",
4
4
  "type": "module",
5
5
  "description": "Doctor Doom making docs.",
6
6
  "repository": {