Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/release-please/.release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"packages/cli": "10.0.0-beta.15",
"packages/core": "10.0.0-beta.15",
"packages/element": "10.0.0-beta.15",
"packages/html": "10.0.0-beta.15",
Expand Down
7 changes: 7 additions & 0 deletions .github/release-please/release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"type": "linked-versions",
"groupName": "videojs",
"components": [
"@videojs/cli",
"@videojs/core",
"@videojs/element",
"@videojs/html",
Expand All @@ -26,6 +27,12 @@
}
],
"packages": {
"packages/cli": {
"component": "@videojs/cli",
"prerelease": true,
"prerelease-type": "beta",
"versioning": "prerelease"
},
"packages/core": {
"component": "@videojs/core",
"prerelease": true,
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ jobs:
if: ${{ steps.release.outputs.releases_created == 'true' }}
run: pnpm build:cdn

- name: Build CLI (requires site build)
if: ${{ steps.release.outputs.releases_created == 'true' }}
run: pnpm build:cli

- name: Publish
if: ${{ steps.release.outputs.releases_created == 'true' }}
run: pnpm -r publish --filter "./packages/*" --access public --provenance --no-git-checks
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ site/src/content/generated-api-reference/
site/src/content/generated-component-reference/
site/src/content/generated-util-reference/
site/src/content/ejected-skins.json
packages/cli/docs/

# -------------------------
# Environment
Expand Down
1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default {
'cd',
'ci',
'claude',
'cli',
'core',
'design',
'element',
Expand Down
130 changes: 0 additions & 130 deletions internal/design/site/cli-llm-friendly-installation.md

This file was deleted.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"scripts": {
"prepare": "simple-git-hooks",
"postinstall": "node build/scripts/link-aliases.mjs",
"build:packages": "turbo run build --filter='./packages/*'",
"build:packages": "turbo run build --filter='./packages/*' --filter='!@videojs/cli'",
"build:cli": "turbo run build --filter=@videojs/cli...",
"build:sandbox": "turbo run build --filter=@videojs/sandbox...",
"build:cdn": "turbo run build:cdn --filter=@videojs/html",
"build:site": "turbo run build --filter=site",
Expand Down
37 changes: 37 additions & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "@videojs/cli",
"type": "module",
"version": "10.0.0-beta.15",
"description": "Video.js documentation CLI",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/videojs/v10",
"directory": "packages/cli"
},
"bin": "./dist/index.js",
"files": [
"dist",
"docs"
],
"scripts": {
"copy-docs": "node scripts/copy-docs.js",
"build": "pnpm run copy-docs && tsdown",
"dev": "tsdown --watch",
"test": "vitest run",
"clean": "rimraf dist docs"
},
"dependencies": {
"@bomb.sh/args": "^0.3.1",
"@clack/prompts": "^0.10.1"
},
"publishConfig": {
"access": "public"
},
"devDependencies": {
"site": "workspace:*",
"tsdown": "^0.21.4",
"typescript": "^6.0.2",
"vitest": "^4.1.0"
}
}
43 changes: 43 additions & 0 deletions packages/cli/scripts/copy-docs.js
Original file line number Diff line number Diff line change
@@ -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/');
66 changes: 66 additions & 0 deletions packages/cli/src/commands/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { getConfigValue, listConfig, setConfigValue } from '../utils/config.js';

const CONFIG_HELP = `Usage: @videojs/cli config <set|get|list>

Keys:
framework <html|react> JS framework for docs`;

export function handleConfig(args: string[], flags?: { help?: boolean }): void {
const [subcommand, key, value] = args;

if (flags?.help) {
console.log(CONFIG_HELP);
process.exit(0);
}

switch (subcommand) {
case 'set': {
if (!key || !value) {
console.error('Usage: @videojs/cli config set <key> <value>');
process.exit(1);
}
try {
setConfigValue(key, value);
} catch (error) {
console.error((error as Error).message);
process.exit(1);
}
console.log(`Set ${key} = ${value}`);
break;
}
case 'get': {
if (!key) {
console.error('Usage: @videojs/cli config get <key>');
process.exit(1);
}
try {
const val = getConfigValue(key);
if (val !== undefined) {
console.log(val);
} else {
console.error(`No value set for "${key}"`);
process.exit(1);
}
} catch (error) {
console.error((error as Error).message);
process.exit(1);
}
break;
}
case 'list': {
const config = listConfig();
const entries = Object.entries(config);
if (entries.length === 0) {
console.log('No configuration set.');
} else {
for (const [k, v] of entries) {
console.log(`${k} = ${v}`);
}
}
break;
}
default:
console.error(CONFIG_HELP);
process.exit(1);
}
}
Loading
Loading