Skip to content

🎥 Make videos programmatically with React

1.2 KB
Raw Blame
import type {AnyRemotionOption} from './option';

const cliFlag = 'package-manager' as const;

let currentPackageManager: string | null = null;

export const packageManagerOption = {
	name: 'Package Manager',
	addedIn: '3.2.33',
	cliFlag,
	description: () => {
		return (
			<>
				Forces a specific package manager to be used. By default, Remotion will
				auto-detect the package manager based on your lockfile.
				<br />
				Acceptable values are <code>npm</code>, <code>yarn</code>,{' '}
				<code>pnpm</code>, <code>bun</code> and <code>nub</code>.
			</>
		);
	},
	ssrName: 'packageManager' as const,
	docLink: 'https://www.remotion.dev/docs/options/package-manager',
	getValue: ({commandLine}) => {
		if (commandLine[cliFlag] !== undefined) {
			return {
				source: 'cli',
				value: commandLine[cliFlag] as string,
			};
		}

		if (currentPackageManager !== null) {
			return {
				source: 'config',
				value: currentPackageManager,
			};
		}

		return {
			source: 'default',
			value: null,
		};
	},
	setConfig: (value: string | null) => {
		currentPackageManager = value;
	},
	type: '' as string | null,
	id: cliFlag,
} satisfies AnyRemotionOption<string | null>;