llmxml
Version:
Convert between markdown and LLM-friendly pseudo-XML
24 lines (19 loc) • 676 B
text/typescript
import { execSync } from 'child_process';
import { rmSync } from 'fs';
// Clean dist
console.log('Cleaning dist directory...');
try {
rmSync('./dist', { recursive: true, force: true });
} catch (e) {
// Ignore if directory doesn't exist
}
// Build CJS
console.log('Building CommonJS...');
execSync('tsc -p tsconfig.cjs.json', { stdio: 'inherit' });
// Build ESM
console.log('Building ESM...');
execSync('tsc -p tsconfig.esm.json', { stdio: 'inherit' });
// Add package.json to CJS directory
console.log('Adding package.json to CJS directory...');
execSync('echo \'{"type":"commonjs"}\' > dist/cjs/package.json', { stdio: 'inherit' });
console.log('Build complete!');