@alauda/doom 0.0.0-alpha.6 → 0.0.0-alpha.8

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/index.js CHANGED
File without changes
@@ -37,9 +37,6 @@ const COMMON_CONFIG = {
37
37
  },
38
38
  plugins: [autoSidebarPlugin(), globalPlugin()],
39
39
  builderConfig: {
40
- dev: {
41
- lazyCompilation: true,
42
- },
43
40
  server: {
44
41
  open: true,
45
42
  },
@@ -100,7 +100,7 @@ export async function scanSideMeta(workDir, rootDir, docsDir, routePrefix, exten
100
100
  _fileKey: path.relative(docsDir, path.join(workDir, metaItem)),
101
101
  };
102
102
  }
103
- const { type = 'file', name, label = '', collapsible, collapsed, link, tag, dashed, overviewHeaders, context, } = metaItem;
103
+ const { type = 'file', name, label = '', collapsible, collapsed = true, link, tag, dashed, overviewHeaders, context, } = metaItem;
104
104
  // when type is divider, name maybe undefined, and link is not used
105
105
  const pureLink = `${relativePath}/${name.replace(/\.mdx?$/, '')}`;
106
106
  if (type === 'file') {
@@ -190,8 +190,8 @@ export async function walk(workDir, routePrefix = '/', docsDir, extensions) {
190
190
  for (const subDir of subDirs) {
191
191
  const { index, others } = await scanSideMeta(path.join(workDir, subDir), workDir, docsDir, routePrefix, extensions);
192
192
  const sidebar = index
193
- ? { ...index, collapsed: true, items: others }
194
- : { text: subDir, collapsed: true, items: others };
193
+ ? { ...index, items: others }
194
+ : { text: subDir, items: others };
195
195
  if (!sidebar.items.length) {
196
196
  // @ts-expect-error -- FIXME: rspress should handle `undefined` items
197
197
  delete sidebar.items;
@@ -1,10 +1,11 @@
1
1
  import fs from 'node:fs';
2
2
  import path from 'node:path';
3
- const componentsDir = path.resolve(import.meta.dirname, '../../runtime/components');
3
+ import { baseResolve, pkgResolve } from '../../utils/index.js';
4
+ const componentsDir = baseResolve('runtime/components');
4
5
  export const globalPlugin = () => {
5
6
  return {
6
7
  name: 'doom-global',
7
- globalStyles: path.resolve(import.meta.dirname, '../../../styles/global.scss'),
8
+ globalStyles: pkgResolve('styles/global.scss'),
8
9
  markdown: {
9
10
  globalComponents: fs
10
11
  .readdirSync(componentsDir)
@@ -1 +1,2 @@
1
+ /// <reference path="../../global.d.ts" preserve="true" />
1
2
  export * from './components/index.js';
@@ -1,3 +1,3 @@
1
1
  // eslint-disable-next-line @typescript-eslint/triple-slash-reference
2
- /// <reference path="../../global.d.ts" />
2
+ /// <reference path="../../global.d.ts" preserve="true" />
3
3
  export * from './components/index.js';
@@ -0,0 +1,2 @@
1
+ export declare const BASE_DIR: string;
2
+ export declare const PKG_DIR: string;
@@ -0,0 +1,4 @@
1
+ import path from 'node:path';
2
+ import { fileURLToPath } from 'node:url';
3
+ export const BASE_DIR = path.resolve(fileURLToPath(import.meta.url), '../..');
4
+ export const PKG_DIR = path.resolve(BASE_DIR, '..');
@@ -0,0 +1,2 @@
1
+ export declare const baseResolve: (...paths: string[]) => string;
2
+ export declare const pkgResolve: (...paths: string[]) => string;
@@ -0,0 +1,4 @@
1
+ import path from 'node:path';
2
+ import { BASE_DIR, PKG_DIR } from './constants.js';
3
+ export const baseResolve = (...paths) => path.resolve(BASE_DIR, ...paths);
4
+ export const pkgResolve = (...paths) => path.resolve(PKG_DIR, ...paths);
@@ -0,0 +1,2 @@
1
+ export * from './constants.js';
2
+ export * from './helpers.js';
@@ -0,0 +1,2 @@
1
+ export * from './constants.js';
2
+ export * from './helpers.js';
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@alauda/doom",
3
- "version": "0.0.0-alpha.6",
3
+ "version": "0.0.0-alpha.8",
4
4
  "type": "module",
5
5
  "description": "Doctor Doom making docs.",
6
6
  "repository": "https://gitlab-ce.alauda.cn/idp/Doom",
7
7
  "packageManager": "yarn@4.5.0",
8
8
  "engines": {
9
- "node": ">=20.11.0"
9
+ "node": ">=18.12.0"
10
10
  },
11
11
  "bin": "./lib/cli/index.js",
12
12
  "exports": {
@@ -45,7 +45,7 @@
45
45
  "@swc/core": "1.7.40",
46
46
  "@types/eslint__js": "^8.42.3",
47
47
  "@types/fs-extra": "^11.0.4",
48
- "@types/node": "^22.8.4",
48
+ "@types/node": "~18.13.0",
49
49
  "eslint": "^9.13.0",
50
50
  "lint-staged": "^15.2.10",
51
51
  "npm-run-all2": "^7.0.1",