Skip to content
This repository was archived by the owner on Aug 2, 2025. It is now read-only.

Commit 14bc524

Browse files
committed
CQL: Apply lint fixes [skip ci]
1 parent 84e3f20 commit 14bc524

3 files changed

Lines changed: 763 additions & 764 deletions

File tree

src/core/plugins/loader.ts

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -5,50 +5,50 @@ import { logger } from "../utils/logger";
55
import { pluginManager } from "./plugin-manager";
66

77
export async function loadPlugins(pluginDir: string) {
8-
const pluginPath = path.join(process.cwd(), pluginDir);
9-
10-
logger.debug(`Loading plugins (${pluginPath})`);
11-
12-
if (!fs.existsSync(pluginPath)) {
13-
throw new Error("Failed to check plugin directory");
14-
}
15-
logger.debug("Plugin directory exists");
16-
17-
let pluginCount = 0;
18-
let files: string[];
19-
try {
20-
files = fs.readdirSync(pluginPath);
21-
logger.debug(`Found ${files.length} files in plugin directory`);
22-
} catch (error) {
23-
throw new Error(`Failed to read plugin-directory: ${error}`);
24-
}
25-
26-
if (!files) {
27-
logger.info(`No plugins found in ${pluginPath}`);
28-
return;
29-
}
30-
31-
for (const file of files) {
32-
if (!file.endsWith(".plugin.ts")) {
33-
logger.debug(`Skipping non-plugin file: ${file}`);
34-
continue;
35-
}
36-
37-
const absolutePath = path.join(pluginPath, file);
38-
logger.info(`Loading plugin: ${absolutePath}`);
39-
try {
40-
await checkFileForChangeMe(absolutePath);
41-
const module = await import(absolutePath);
42-
const plugin = module.default;
43-
pluginManager.register(plugin);
44-
pluginCount++;
45-
} catch (error) {
46-
pluginManager.fail({ name: file });
47-
logger.error(
48-
`Error while registering plugin ${absolutePath}: ${error as string}`
49-
);
50-
}
51-
}
52-
53-
logger.info(`Registered ${pluginCount} plugin(s)`);
8+
const pluginPath = path.join(process.cwd(), pluginDir);
9+
10+
logger.debug(`Loading plugins (${pluginPath})`);
11+
12+
if (!fs.existsSync(pluginPath)) {
13+
throw new Error("Failed to check plugin directory");
14+
}
15+
logger.debug("Plugin directory exists");
16+
17+
let pluginCount = 0;
18+
let files: string[];
19+
try {
20+
files = fs.readdirSync(pluginPath);
21+
logger.debug(`Found ${files.length} files in plugin directory`);
22+
} catch (error) {
23+
throw new Error(`Failed to read plugin-directory: ${error}`);
24+
}
25+
26+
if (!files) {
27+
logger.info(`No plugins found in ${pluginPath}`);
28+
return;
29+
}
30+
31+
for (const file of files) {
32+
if (!file.endsWith(".plugin.ts")) {
33+
logger.debug(`Skipping non-plugin file: ${file}`);
34+
continue;
35+
}
36+
37+
const absolutePath = path.join(pluginPath, file);
38+
logger.info(`Loading plugin: ${absolutePath}`);
39+
try {
40+
await checkFileForChangeMe(absolutePath);
41+
const module = await import(absolutePath);
42+
const plugin = module.default;
43+
pluginManager.register(plugin);
44+
pluginCount++;
45+
} catch (error) {
46+
pluginManager.fail({ name: file });
47+
logger.error(
48+
`Error while registering plugin ${absolutePath}: ${error as string}`,
49+
);
50+
}
51+
}
52+
53+
logger.info(`Registered ${pluginCount} plugin(s)`);
5454
}

0 commit comments

Comments
 (0)