feat(cli): add @videojs/cli docs command for LLM-friendly installation (#1214)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Darius Cepulis
2026-04-14 11:07:49 -05:00
committed by GitHub
co-authored by Claude Opus 4.6
parent 9681515446
commit 24b8b77c8a
49 changed files with 2061 additions and 460 deletions
+43
View File
@@ -0,0 +1,43 @@
import { cpSync, existsSync, mkdirSync, rmSync, statSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
const __dirname = dirname(fileURLToPath(import.meta.url));
function findWorkspaceRoot(start) {
let dir = start;
while (dir !== dirname(dir)) {
if (existsSync(join(dir, 'pnpm-workspace.yaml'))) return dir;
dir = dirname(dir);
}
throw new Error('Could not find pnpm-workspace.yaml — is this script running inside the monorepo?');
}
const WORKSPACE_ROOT = findWorkspaceRoot(__dirname);
const SITE_DIST = join(WORKSPACE_ROOT, 'site', 'dist');
const CLI_DOCS = join(__dirname, '..', 'docs');
if (!existsSync(SITE_DIST)) {
console.warn('⚠ site/dist not found — skipping docs copy. Build the site first.');
process.exit(1);
}
// Clean and recreate docs dir
rmSync(CLI_DOCS, { recursive: true, force: true });
mkdirSync(CLI_DOCS, { recursive: true });
for (const framework of ['html', 'react']) {
const src = join(SITE_DIST, 'docs', 'framework', framework);
if (!existsSync(src)) continue;
const dest = join(CLI_DOCS, framework);
cpSync(src, dest, {
recursive: true,
filter: (path) => {
if (statSync(path).isDirectory()) return true;
return path.endsWith('.md') || path.endsWith('.txt');
},
});
}
console.log('✓ Docs copied to packages/cli/docs/');