| |
| |
| |
| |
| |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| import { execSync } from 'node:child_process'; |
| import { writeFileSync, existsSync, cpSync, rmSync } from 'node:fs'; |
| import { join, basename } from 'node:path'; |
|
|
| if (!process.cwd().includes('packages')) { |
| console.error('must be invoked from a package directory'); |
| process.exit(1); |
| } |
|
|
| const packageName = basename(process.cwd()); |
|
|
| |
| execSync('tsc --build', { stdio: 'inherit' }); |
|
|
| |
| const bundleScript = join(process.cwd(), 'scripts', 'bundle-browser-mcp.mjs'); |
| if (packageName === 'core' && existsSync(bundleScript)) { |
| console.log('Running chrome devtools MCP bundling...'); |
| execSync('npm run bundle:browser-mcp', { |
| stdio: 'inherit', |
| }); |
| } |
|
|
| |
| execSync('node ../../scripts/copy_files.js', { stdio: 'inherit' }); |
|
|
| |
| if (packageName === 'core') { |
| const docsSource = join(process.cwd(), '..', '..', 'docs'); |
| const docsTarget = join(process.cwd(), 'dist', 'docs'); |
| if (existsSync(docsSource)) { |
| if (existsSync(docsTarget)) { |
| rmSync(docsTarget, { recursive: true, force: true }); |
| } |
| cpSync(docsSource, docsTarget, { recursive: true, dereference: true }); |
| console.log('Copied documentation to dist/docs'); |
| } |
| } |
|
|
| |
| writeFileSync(join(process.cwd(), 'dist', '.last_build'), ''); |
| process.exit(0); |
|
|