@remotion/cli 4.0.367 → 4.0.368

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/add.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ import { type LogLevel } from '@remotion/renderer';
2
+ export declare const addCommand: ({ remotionRoot, packageManager, packageNames, logLevel, args, }: {
3
+ remotionRoot: string;
4
+ packageManager: string | undefined;
5
+ packageNames: string[];
6
+ logLevel: LogLevel;
7
+ args: string[];
8
+ }) => Promise<void>;
package/dist/add.js ADDED
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addCommand = void 0;
4
+ const renderer_1 = require("@remotion/renderer");
5
+ const studio_server_1 = require("@remotion/studio-server");
6
+ const node_child_process_1 = require("node:child_process");
7
+ const chalk_1 = require("./chalk");
8
+ const list_of_remotion_packages_1 = require("./list-of-remotion-packages");
9
+ const log_1 = require("./log");
10
+ const addCommand = async ({ remotionRoot, packageManager, packageNames, logLevel, args, }) => {
11
+ // Validate that all package names are Remotion packages
12
+ const invalidPackages = packageNames.filter((pkg) => !list_of_remotion_packages_1.listOfRemotionPackages.includes(pkg));
13
+ if (invalidPackages.length > 0) {
14
+ throw new Error(`The following packages are not Remotion packages: ${invalidPackages.join(', ')}. Must be one of the Remotion packages.`);
15
+ }
16
+ const { dependencies, devDependencies, optionalDependencies, peerDependencies, } = studio_server_1.StudioServerInternals.getInstalledDependencies(remotionRoot);
17
+ // Check if packages are already installed
18
+ const allDeps = [
19
+ ...dependencies,
20
+ ...devDependencies,
21
+ ...optionalDependencies,
22
+ ...peerDependencies,
23
+ ];
24
+ const alreadyInstalled = packageNames.filter((pkg) => allDeps.includes(pkg));
25
+ const toInstall = packageNames.filter((pkg) => !allDeps.includes(pkg));
26
+ // Log already installed packages
27
+ for (const pkg of alreadyInstalled) {
28
+ log_1.Log.info({ indent: false, logLevel }, `○ ${pkg} ${chalk_1.chalk.gray('(already installed)')}`);
29
+ }
30
+ // If nothing to install, return early
31
+ if (toInstall.length === 0) {
32
+ return;
33
+ }
34
+ // Find the version of installed Remotion packages
35
+ const installedRemotionPackages = list_of_remotion_packages_1.listOfRemotionPackages.filter((pkg) => allDeps.includes(pkg));
36
+ if (installedRemotionPackages.length === 0) {
37
+ throw new Error('No Remotion packages found in your project. Install Remotion first.');
38
+ }
39
+ // Get the version from the first installed Remotion package
40
+ const packageJsonPath = `${remotionRoot}/node_modules/${installedRemotionPackages[0]}/package.json`;
41
+ let targetVersion;
42
+ try {
43
+ const packageJson = require(packageJsonPath);
44
+ targetVersion = packageJson.version;
45
+ const packageList = toInstall.length === 1
46
+ ? toInstall[0]
47
+ : `${toInstall.length} packages (${toInstall.join(', ')})`;
48
+ log_1.Log.info({ indent: false, logLevel }, `Installing ${packageList}@${targetVersion} to match your other Remotion packages`);
49
+ }
50
+ catch (err) {
51
+ throw new Error(`Could not determine version of installed Remotion packages: ${err.message}`);
52
+ }
53
+ const manager = studio_server_1.StudioServerInternals.getPackageManager(remotionRoot, packageManager, 0);
54
+ if (manager === 'unknown') {
55
+ throw new Error(`No lockfile was found in your project (one of ${studio_server_1.StudioServerInternals.lockFilePaths
56
+ .map((p) => p.path)
57
+ .join(', ')}). Install dependencies using your favorite manager!`);
58
+ }
59
+ const command = studio_server_1.StudioServerInternals.getInstallCommand({
60
+ manager: manager.manager,
61
+ packages: toInstall,
62
+ version: targetVersion,
63
+ additionalArgs: args,
64
+ });
65
+ log_1.Log.info({ indent: false, logLevel }, chalk_1.chalk.gray(`$ ${manager.manager} ${command.join(' ')}`));
66
+ const task = (0, node_child_process_1.spawn)(manager.manager, command, {
67
+ env: {
68
+ ...process.env,
69
+ ADBLOCK: '1',
70
+ DISABLE_OPENCOLLECTIVE: '1',
71
+ },
72
+ stdio: renderer_1.RenderInternals.isEqualOrBelowLogLevel(logLevel, 'info')
73
+ ? 'inherit'
74
+ : 'ignore',
75
+ });
76
+ await new Promise((resolve) => {
77
+ task.on('close', (code) => {
78
+ if (code === 0) {
79
+ resolve();
80
+ }
81
+ else if (renderer_1.RenderInternals.isEqualOrBelowLogLevel(logLevel, 'info')) {
82
+ throw new Error(`Failed to install packages, see logs above`);
83
+ }
84
+ else {
85
+ throw new Error(`Failed to install packages, run with --log=info to see logs`);
86
+ }
87
+ });
88
+ });
89
+ for (const pkg of alreadyInstalled) {
90
+ log_1.Log.info({ indent: false, logLevel }, `○ ${pkg}@${targetVersion} ${chalk_1.chalk.gray('(already installed)')}`);
91
+ }
92
+ for (const pkg of toInstall) {
93
+ log_1.Log.info({ indent: false, logLevel }, `+ ${pkg}@${targetVersion}`);
94
+ }
95
+ };
96
+ exports.addCommand = addCommand;
package/dist/index.js CHANGED
@@ -7,6 +7,7 @@ exports.CliInternals = exports.cli = void 0;
7
7
  const renderer_1 = require("@remotion/renderer");
8
8
  const studio_server_1 = require("@remotion/studio-server");
9
9
  const minimist_1 = __importDefault(require("minimist"));
10
+ const add_1 = require("./add");
10
11
  const benchmark_1 = require("./benchmark");
11
12
  const browser_1 = require("./browser");
12
13
  const browser_download_bar_1 = require("./browser-download-bar");
@@ -114,6 +115,22 @@ const cli = async () => {
114
115
  args,
115
116
  });
116
117
  }
118
+ else if (command === 'add') {
119
+ if (args.length === 0) {
120
+ throw new Error('Please specify at least one package name. Example: npx remotion add @remotion/transitions');
121
+ }
122
+ // Find where additional flags start (arguments starting with -)
123
+ const flagIndex = args.findIndex((arg) => arg.startsWith('-'));
124
+ const packageNames = flagIndex === -1 ? args : args.slice(0, flagIndex);
125
+ const additionalArgs = flagIndex === -1 ? [] : args.slice(flagIndex);
126
+ await (0, add_1.addCommand)({
127
+ remotionRoot,
128
+ packageManager: parsed_cli_1.parsedCli['package-manager'],
129
+ packageNames,
130
+ logLevel,
131
+ args: additionalArgs,
132
+ });
133
+ }
117
134
  else if (command === versions_1.VERSIONS_COMMAND) {
118
135
  await (0, versions_1.versionsCommand)(remotionRoot, logLevel);
119
136
  }
@@ -52,6 +52,10 @@ const printHelp = (logLevel) => {
52
52
  log_1.Log.info({ indent: false, logLevel }, 'Ensure Remotion is on the newest version.');
53
53
  log_1.Log.info({ indent: false, logLevel }, chalk_1.chalk.gray('https://www.remotion.dev/docs/cli/upgrade'));
54
54
  log_1.Log.info({ indent: false, logLevel });
55
+ log_1.Log.info({ indent: false, logLevel }, chalk_1.chalk.blue('remotion add') + chalk_1.chalk.gray(' <package-name...>'));
56
+ log_1.Log.info({ indent: false, logLevel }, 'Add Remotion packages with the correct version.');
57
+ log_1.Log.info({ indent: false, logLevel }, chalk_1.chalk.gray('https://www.remotion.dev/docs/cli/add'));
58
+ log_1.Log.info({ indent: false, logLevel });
55
59
  log_1.Log.info({ indent: false, logLevel }, chalk_1.chalk.blue(`remotion ${browser_1.BROWSER_COMMAND}`));
56
60
  log_1.Log.info({ indent: false, logLevel }, 'Ensure Remotion has a browser it can use for rendering.');
57
61
  log_1.Log.info({ indent: false, logLevel }, chalk_1.chalk.gray('https://www.remotion.dev/docs/cli/browser'));
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/cli"
4
4
  },
5
5
  "name": "@remotion/cli",
6
- "version": "4.0.367",
6
+ "version": "4.0.368",
7
7
  "description": "Control Remotion features using the `npx remotion` command",
8
8
  "main": "dist/index.js",
9
9
  "sideEffects": false,
@@ -36,17 +36,17 @@
36
36
  "author": "Jonny Burger <jonny@remotion.dev>",
37
37
  "license": "SEE LICENSE IN LICENSE.md",
38
38
  "dependencies": {
39
- "@remotion/bundler": "4.0.367",
40
- "@remotion/media-utils": "4.0.367",
41
- "@remotion/player": "4.0.367",
42
- "@remotion/renderer": "4.0.367",
43
- "@remotion/studio-shared": "4.0.367",
44
- "@remotion/studio-server": "4.0.367",
45
- "@remotion/studio": "4.0.367",
39
+ "@remotion/bundler": "4.0.368",
40
+ "@remotion/media-utils": "4.0.368",
41
+ "@remotion/player": "4.0.368",
42
+ "@remotion/renderer": "4.0.368",
43
+ "@remotion/studio-shared": "4.0.368",
44
+ "@remotion/studio-server": "4.0.368",
45
+ "@remotion/studio": "4.0.368",
46
46
  "dotenv": "9.0.2",
47
47
  "minimist": "1.2.6",
48
48
  "prompts": "2.4.2",
49
- "remotion": "4.0.367"
49
+ "remotion": "4.0.368"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "react": ">=16.8.0",
@@ -57,14 +57,14 @@
57
57
  "@types/prompts": "^2.4.1",
58
58
  "@types/prettier": "^2.7.2",
59
59
  "@types/node": "20.12.14",
60
- "@remotion/zod-types": "4.0.367",
61
- "@remotion/tailwind-v4": "4.0.367",
62
- "@remotion/enable-scss": "4.0.367",
63
- "@remotion/skia": "4.0.367",
60
+ "@remotion/zod-types": "4.0.368",
61
+ "@remotion/tailwind-v4": "4.0.368",
62
+ "@remotion/enable-scss": "4.0.368",
63
+ "@remotion/skia": "4.0.368",
64
64
  "react": "19.0.0",
65
65
  "react-dom": "19.0.0",
66
66
  "zod": "3.22.3",
67
- "@remotion/eslint-config-internal": "4.0.367",
67
+ "@remotion/eslint-config-internal": "4.0.368",
68
68
  "eslint": "9.19.0"
69
69
  },
70
70
  "keywords": [