Skip to content

Commit 593bea6

Browse files
Copilotvobu
andcommitted
build: Include default-plugins in distribution
- Add copy-plugins script to copy default-plugins to dist/ during build - Update plugin-loader to check both dev and prod paths for default-plugins - Ensure default-plugins are bundled with transpiled JS in dist/ - Verified with npm pack --dry-run that plugins are included - Both dev mode (node src/index.ts) and built mode (node dist/index.js) work correctly Co-authored-by: vobu <6573426+vobu@users.noreply.github.com>
1 parent 8059928 commit 593bea6

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919
"LICENSE"
2020
],
2121
"scripts": {
22-
"build": "npm run clean && tsc",
22+
"build": "npm run clean && tsc && npm run copy-plugins",
2323
"clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",
24+
"copy-plugins": "node -e \"const fs=require('fs');const path=require('path');const src='default-plugins';const dest='dist/default-plugins';if(fs.existsSync(src)){fs.cpSync(src,dest,{recursive:true})}\"",
2425
"prepublishOnly": "npm run build",
2526
"test": "node --test tests/unit/setup.test.ts tests/unit/*.test.ts tests/integration/*.test.ts",
2627
"test:unit": "node --test tests/unit/setup.test.ts tests/unit/*.test.ts",

src/plugin-loader.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,24 @@ async function loadDefaultPlugins(): Promise<void> {
4242
// Get the directory where this file is located
4343
const __filename = fileURLToPath(import.meta.url);
4444
const __dirname = dirname(__filename);
45-
const defaultPluginsDir = join(__dirname, '..', 'default-plugins');
4645

47-
if (!existsSync(defaultPluginsDir)) {
46+
// Check both possible locations:
47+
// In development: src/plugin-loader.ts -> ../default-plugins
48+
// In production: dist/plugin-loader.js -> dist/default-plugins
49+
const possiblePaths = [
50+
join(__dirname, 'default-plugins'), // Production path
51+
join(__dirname, '..', 'default-plugins'), // Development path
52+
];
53+
54+
let defaultPluginsDir: string | null = null;
55+
for (const path of possiblePaths) {
56+
if (existsSync(path)) {
57+
defaultPluginsDir = path;
58+
break;
59+
}
60+
}
61+
62+
if (!defaultPluginsDir) {
4863
logger.debug('No default-plugins directory found');
4964
return;
5065
}

0 commit comments

Comments
 (0)