Skip to content

Commit 19da98f

Browse files
fix(deps): merge dependabot updates and fix type/test regressions
2 parents b89f01b + b28c732 commit 19da98f

9 files changed

Lines changed: 1879 additions & 1042 deletions

File tree

package-lock.json

Lines changed: 1807 additions & 1009 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/cli/jest.config.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,19 @@ module.exports = {
66
roots: ['<rootDir>/src', '<rootDir>/tests'],
77
testMatch: ['**/__tests__/**/*.ts', '**/*.test.ts', '**/*.spec.ts'],
88
setupFilesAfterEnv: ['<rootDir>/tests/setup.ts'],
9+
transform: {
10+
'^.+\\.[tj]sx?$': [
11+
'ts-jest',
12+
{
13+
tsconfig: {
14+
allowJs: true,
15+
},
16+
},
17+
],
18+
},
19+
transformIgnorePatterns: [
20+
'node_modules/(?!(chalk|glob|inquirer|open|ora|jiti|cli-cursor|restore-cursor|onetime|mimic-function|is-interactive|is-unicode-supported|log-symbols|stdin-discarder|string-width|strip-ansi|ansi-escapes|wcwidth)/)',
21+
],
922
collectCoverageFrom: [
1023
'src/**/*.ts',
1124
'!src/**/*.d.ts',

packages/cli/package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,19 @@
2828
},
2929
"dependencies": {
3030
"@opensyntaxhq/autodocs-core": "^1.0.0",
31-
"chalk": "^4.1.2",
32-
"chokidar": "^3.6.0",
33-
"commander": "^12.0.0",
31+
"chalk": "^5.6.2",
32+
"chokidar": "^5.0.0",
33+
"commander": "^14.0.3",
3434
"cosmiconfig": "^9.0.0",
35-
"express": "^4.18.0",
36-
"glob": "^10.3.0",
37-
"inquirer": "^8.2.6",
38-
"jiti": "^1.21.0",
39-
"open": "^8.4.2",
40-
"ora": "^5.4.1"
35+
"express": "^5.2.1",
36+
"glob": "^13.0.1",
37+
"inquirer": "^13.2.2",
38+
"jiti": "^2.6.1",
39+
"open": "^11.0.0",
40+
"ora": "^9.3.0"
4141
},
4242
"devDependencies": {
43-
"@types/express": "^4.17.21",
43+
"@types/express": "^5.0.6",
4444
"@types/inquirer": "^8.2.10",
4545
"@types/jest": "^30.0.0",
4646
"@types/node": "^20.11.0",

packages/cli/src/config/loader.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { cosmiconfig } from 'cosmiconfig';
22
import fs from 'fs';
33
import path from 'path';
4-
import jiti from 'jiti';
4+
import { createJiti } from 'jiti';
55
import { AutodocsConfig } from './types';
66
import { DEFAULT_CONFIG } from './defaults';
77

88
// Setup jiti for loading TS files
9-
const jitiLoader = jiti(__filename);
9+
const jiti = createJiti(__filename);
1010

1111
export async function loadConfig(searchFrom?: string): Promise<AutodocsConfig | null> {
1212
const explorer = cosmiconfig('autodocs', {
@@ -19,7 +19,7 @@ export async function loadConfig(searchFrom?: string): Promise<AutodocsConfig |
1919
'package.json',
2020
],
2121
loaders: {
22-
'.ts': (filepath: string) => jitiLoader(filepath) as unknown,
22+
'.ts': (filepath: string) => jiti.import(filepath, { default: true }),
2323
},
2424
});
2525

@@ -39,7 +39,7 @@ export async function loadConfig(searchFrom?: string): Promise<AutodocsConfig |
3939
return mergeConfig(DEFAULT_CONFIG, JSON.parse(raw) as Partial<AutodocsConfig>);
4040
}
4141
if (['.ts', '.js', '.mjs', '.cjs'].includes(ext)) {
42-
const loaded = jitiLoader(resolvedPath) as unknown;
42+
const loaded = await jiti.import(resolvedPath, { default: true });
4343
const config = (loaded as { default?: unknown }).default || loaded;
4444
return mergeConfig(DEFAULT_CONFIG, config as Partial<AutodocsConfig>);
4545
}

packages/cli/src/utils/watcher.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import chokidar from 'chokidar';
1+
import { watch, type FSWatcher } from 'chokidar';
22
import { EventEmitter } from 'events';
33

44
export interface WatchOptions {
@@ -8,7 +8,7 @@ export interface WatchOptions {
88
}
99

1010
export class FileWatcher extends EventEmitter {
11-
private watcher: chokidar.FSWatcher | null = null;
11+
private watcher: FSWatcher | null = null;
1212
private debounceTimer: NodeJS.Timeout | null = null;
1313
private options: Required<WatchOptions>;
1414

@@ -23,7 +23,7 @@ export class FileWatcher extends EventEmitter {
2323
}
2424

2525
start(): void {
26-
this.watcher = chokidar.watch(this.options.paths, {
26+
const watcher = watch(this.options.paths, {
2727
ignored: this.options.ignored,
2828
persistent: true,
2929
ignoreInitial: true,
@@ -33,13 +33,15 @@ export class FileWatcher extends EventEmitter {
3333
},
3434
});
3535

36-
this.watcher.on('change', (path) => {
36+
this.watcher = watcher;
37+
38+
watcher.on('change', (path: string) => {
3739
this.handleChange(path);
3840
});
39-
this.watcher.on('add', (path) => {
41+
watcher.on('add', (path: string) => {
4042
this.handleChange(path);
4143
});
42-
this.watcher.on('unlink', (path) => {
44+
watcher.on('unlink', (path: string) => {
4345
this.handleChange(path);
4446
});
4547

packages/cli/tests/build.test.ts

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,26 @@ jest.mock('child_process', () => ({
1717

1818
import { buildReactUI } from '../src/commands/build';
1919

20-
const createSpinner = () => ({
21-
text: '',
22-
start: jest.fn().mockReturnThis(),
23-
succeed: jest.fn().mockReturnThis(),
24-
fail: jest.fn().mockReturnThis(),
25-
warn: jest.fn().mockReturnThis(),
26-
});
20+
import type { Ora } from 'ora';
21+
22+
const createSpinner = (): Ora =>
23+
({
24+
text: '',
25+
isSpinning: false,
26+
color: 'cyan',
27+
prefixText: '',
28+
indent: 0,
29+
start: jest.fn().mockReturnThis(),
30+
succeed: jest.fn().mockReturnThis(),
31+
fail: jest.fn().mockReturnThis(),
32+
warn: jest.fn().mockReturnThis(),
33+
info: jest.fn().mockReturnThis(),
34+
stop: jest.fn().mockReturnThis(),
35+
stopAndPersist: jest.fn().mockReturnThis(),
36+
clear: jest.fn().mockReturnThis(),
37+
render: jest.fn().mockReturnThis(),
38+
frame: jest.fn().mockReturnValue(''),
39+
}) as unknown as Ora;
2740

2841
describe('buildReactUI', () => {
2942
it('writes docs.json and config.json into the output directory', async () => {
@@ -54,7 +67,7 @@ describe('buildReactUI', () => {
5467
await fs.writeFile(faviconPath, '<svg></svg>', 'utf-8');
5568

5669
const outputDir = path.join(tempDir, 'out');
57-
const spinner = createSpinner() as unknown as ReturnType<typeof import('ora')>;
70+
const spinner = createSpinner();
5871

5972
const configDir = path.join(tempDir, 'config');
6073
const docsDir = path.join(configDir, 'docs');
@@ -66,7 +79,7 @@ describe('buildReactUI', () => {
6679
uiDir,
6780
configDir,
6881
uiConfig: {
69-
theme: { primaryColor: '#123456', logo: logoPath, favicon: faviconPath },
82+
theme: { name: 'Test', primaryColor: '#123456', logo: logoPath, favicon: faviconPath },
7083
features: { search: false },
7184
sidebar: [{ title: 'Guide', path: '/docs/intro.md' }],
7285
},

packages/core/jest.config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ module.exports = {
66
roots: ['<rootDir>/src', '<rootDir>/tests'],
77
testMatch: ['**/__tests__/**/*.ts', '**/*.test.ts', '**/*.spec.ts'],
88
setupFilesAfterEnv: ['<rootDir>/tests/setup.ts'],
9+
transform: {
10+
'^.+\\.[tj]sx?$': [
11+
'ts-jest',
12+
{
13+
tsconfig: {
14+
allowJs: true,
15+
},
16+
},
17+
],
18+
},
19+
transformIgnorePatterns: ['node_modules/(?!(marked|glob)/)'],
920
collectCoverageFrom: [
1021
'src/**/*.ts',
1122
'!src/**/*.d.ts',

packages/plugins/markdown/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@
4242
"clean": "rm -rf dist"
4343
},
4444
"dependencies": {
45-
"glob": "^11.0.0",
45+
"glob": "^13.0.1",
4646
"gray-matter": "^4.0.3",
47-
"marked": "^15.0.0"
47+
"marked": "^17.0.1"
4848
},
4949
"peerDependencies": {
5050
"@opensyntaxhq/autodocs-core": "^1.0.0"

packages/ui/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"class-variance-authority": "^0.7.1",
1616
"clsx": "^2.1.1",
1717
"cmdk": "^1.1.1",
18-
"flexsearch": "^0.7.43",
19-
"lucide-react": "^0.475.0",
18+
"flexsearch": "^0.8.212",
19+
"lucide-react": "^0.563.0",
2020
"radix-ui": "^1.4.3",
2121
"react": "^19.2.4",
2222
"react-dom": "^19.2.4",

0 commit comments

Comments
 (0)