Files
claude-task-master/apps/extension/esbuild.js
DavidMaliglowka 8e59647229 feat(extension): add VS Code extension with kanban board interface
- Complete VS Code extension with React-based kanban board UI
- MCP integration for real-time Task Master synchronization
- Professional CI/CD workflows for marketplace publishing
- Comprehensive configuration system with user preferences
- ShadCN UI components with VS Code theme integration
- Drag-and-drop task management with status transitions
- AI-powered task features via MCP protocol
- Robust error handling and connection management
- Multi-registry publishing (VS Code Marketplace + Open VSX)
- Security audit completed with hardcoded paths removed

BREAKING CHANGE: Extension requires publisher setup and marketplace keys

Publisher and extension naming decisions required:
- Update publisher field from placeholder 'DavidMaliglowka'
- Choose unique extension name (currently 'taskr-kanban')
- Select appropriate extension icon
- Configure CI secrets (VSCE_PAT, OVSX_PAT) for publishing

See apps/extension/docs/ for detailed setup instructions
2025-07-17 04:36:36 -05:00

136 lines
3.1 KiB
JavaScript

const esbuild = require("esbuild");
const path = require("path");
const production = process.argv.includes('--production');
const watch = process.argv.includes('--watch');
/**
* @type {import('esbuild').Plugin}
*/
const esbuildProblemMatcherPlugin = {
name: 'esbuild-problem-matcher',
setup(build) {
build.onStart(() => {
console.log('[watch] build started');
});
build.onEnd((result) => {
result.errors.forEach(({ text, location }) => {
console.error(`✘ [ERROR] ${text}`);
console.error(` ${location.file}:${location.line}:${location.column}:`);
});
console.log('[watch] build finished');
});
},
};
/**
* @type {import('esbuild').Plugin}
*/
const aliasPlugin = {
name: 'alias',
setup(build) {
// Handle @/ aliases for shadcn/ui
build.onResolve({ filter: /^@\// }, args => {
const resolvedPath = path.resolve(__dirname, 'src', args.path.slice(2));
// Try to resolve with common TypeScript extensions
const fs = require('fs');
const extensions = ['.tsx', '.ts', '.jsx', '.js'];
// Check if it's a file first
for (const ext of extensions) {
const fullPath = resolvedPath + ext;
if (fs.existsSync(fullPath)) {
return { path: fullPath };
}
}
// Check if it's a directory with index file
for (const ext of extensions) {
const indexPath = path.join(resolvedPath, 'index' + ext);
if (fs.existsSync(indexPath)) {
return { path: indexPath };
}
}
// Fallback to original behavior
return { path: resolvedPath };
});
},
};
async function main() {
// Build configuration for the VS Code extension
const extensionCtx = await esbuild.context({
entryPoints: ['src/extension.ts'],
bundle: true,
format: 'cjs',
minify: production,
sourcemap: !production,
sourcesContent: false,
platform: 'node',
outdir: 'dist',
external: ['vscode'],
logLevel: 'silent',
// Add production optimizations
...(production && {
drop: ['debugger'],
pure: ['console.log', 'console.debug', 'console.trace'],
}),
plugins: [
esbuildProblemMatcherPlugin,
aliasPlugin,
],
});
// Build configuration for the React webview
const webviewCtx = await esbuild.context({
entryPoints: ['src/webview/index.tsx'],
bundle: true,
format: 'iife',
globalName: 'App',
minify: production,
sourcemap: !production,
sourcesContent: false,
platform: 'browser',
outdir: 'dist',
logLevel: 'silent',
target: ['es2020'],
jsx: 'automatic',
jsxImportSource: 'react',
external: ['*.css'],
define: {
'process.env.NODE_ENV': production ? '"production"' : '"development"',
'global': 'globalThis'
},
// Add production optimizations for webview too
...(production && {
drop: ['debugger'],
pure: ['console.log', 'console.debug', 'console.trace'],
}),
plugins: [
esbuildProblemMatcherPlugin,
aliasPlugin,
],
});
if (watch) {
await Promise.all([
extensionCtx.watch(),
webviewCtx.watch()
]);
} else {
await Promise.all([
extensionCtx.rebuild(),
webviewCtx.rebuild()
]);
await extensionCtx.dispose();
await webviewCtx.dispose();
}
}
main().catch(e => {
console.error(e);
process.exit(1);
});