-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-plugin.js
More file actions
executable file
·49 lines (41 loc) · 1.5 KB
/
Copy pathtest-plugin.js
File metadata and controls
executable file
·49 lines (41 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env node
"use strict";
// Test script to verify the plugin loads and registers correctly
console.log("Testing hexo-codapi plugin...\n");
try {
// Try to load the plugin
const plugin = require('./index.js');
console.log("✓ Plugin module loads successfully");
console.log("✓ Plugin exports:", typeof plugin);
if (typeof plugin !== 'function') {
console.error("✗ ERROR: Plugin should export a function");
process.exit(1);
}
// Create a minimal Hexo mock to test registration
const hexoMock = {
config: { codapi: {} },
extend: {
tag: {
register: (name, fn, opts) => {
console.log(`✓ Tag registered: "${name}" with options:`, opts);
},
env: { extensions: {} }
},
filter: {
register: (name, fn, priority) => {
console.log(`✓ Filter registered: "${name}" with priority:`, priority);
}
}
}
};
// Call the plugin function with the mock
plugin(hexoMock);
console.log("\n✓ All checks passed! Plugin should work correctly.");
console.log("\nIf Hexo still doesn't see the plugin, try:");
console.log("1. npm pack (creates hexo-codapi-0.1.0.tgz)");
console.log("2. In your Hexo blog: npm install /path/to/hexo-codapi-0.1.0.tgz");
} catch (error) {
console.error("✗ ERROR:", error.message);
console.error(error.stack);
process.exit(1);
}