@remotion/cli 4.0.88 → 4.0.89

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/benchmark.js CHANGED
@@ -125,6 +125,8 @@ const benchmarkCommand = async (remotionRoot, args, logLevel) => {
125
125
  (0, cleanup_before_quit_1.registerCleanupJob)(() => renderer_1.RenderInternals.deleteDirectory(dir));
126
126
  },
127
127
  quietProgress: false,
128
+ quietFlag: (0, parse_command_line_1.quietFlagProvided)(),
129
+ outDir: null,
128
130
  });
129
131
  (0, cleanup_before_quit_1.registerCleanupJob)(() => cleanupBundle());
130
132
  const puppeteerInstance = await browserInstance;
@@ -0,0 +1,2 @@
1
+ import type { LogLevel } from '@remotion/renderer';
2
+ export declare const bundleCommand: (remotionRoot: string, args: string[], logLevel: LogLevel) => Promise<void>;
package/dist/bundle.js ADDED
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.bundleCommand = void 0;
7
+ const bundler_1 = require("@remotion/bundler");
8
+ const studio_1 = require("@remotion/studio");
9
+ const fs_1 = require("fs");
10
+ const path_1 = __importDefault(require("path"));
11
+ const chalk_1 = require("./chalk");
12
+ const entry_point_1 = require("./entry-point");
13
+ const get_cli_options_1 = require("./get-cli-options");
14
+ const log_1 = require("./log");
15
+ const parse_command_line_1 = require("./parse-command-line");
16
+ const setup_cache_1 = require("./setup-cache");
17
+ const should_use_non_overlaying_logger_1 = require("./should-use-non-overlaying-logger");
18
+ const yes_or_no_1 = require("./yes-or-no");
19
+ const bundleCommand = async (remotionRoot, args, logLevel) => {
20
+ const { file, reason } = (0, entry_point_1.findEntryPoint)(args, remotionRoot, logLevel);
21
+ const explicitlyPassed = args[0];
22
+ if (explicitlyPassed &&
23
+ reason !== 'argument passed' &&
24
+ reason !== 'argument passed - found in cwd' &&
25
+ reason !== 'argument passed - found in root') {
26
+ log_1.Log.error(`Entry point was specified as ${chalk_1.chalk.bold(explicitlyPassed)}, but it was not found.`);
27
+ process.exit(1);
28
+ }
29
+ const updatesDontOverwrite = (0, should_use_non_overlaying_logger_1.shouldUseNonOverlayingLogger)({ logLevel });
30
+ if (!file) {
31
+ log_1.Log.error('No entry point found.');
32
+ log_1.Log.error('Pass another argument to the command specifying the entry point.');
33
+ log_1.Log.error('See: https://www.remotion.dev/docs/terminology#entry-point');
34
+ process.exit(1);
35
+ }
36
+ const { publicDir } = await (0, get_cli_options_1.getCliOptions)({
37
+ isLambda: false,
38
+ type: 'get-compositions',
39
+ remotionRoot,
40
+ logLevel,
41
+ });
42
+ const outputPath = parse_command_line_1.parsedCli['out-dir']
43
+ ? path_1.default.resolve(process.cwd(), parse_command_line_1.parsedCli['out-dir'])
44
+ : path_1.default.join(remotionRoot, 'build');
45
+ const gitignoreFolder = bundler_1.BundlerInternals.findClosestFolderWithFile(outputPath, '.gitignore');
46
+ const existed = (0, fs_1.existsSync)(outputPath);
47
+ if (existed) {
48
+ if (!(0, fs_1.existsSync)(path_1.default.join(outputPath, 'index.html'))) {
49
+ log_1.Log.error(`The folder at ${outputPath} already exists, and needs to be deleted before a new bundle can be created.`);
50
+ log_1.Log.error('However, it does not look like the folder was created by `npx remotion bundle` (no index.html).');
51
+ log_1.Log.error('Aborting to prevent accidental data loss.');
52
+ process.exit(1);
53
+ }
54
+ (0, fs_1.rmSync)(outputPath, { recursive: true });
55
+ }
56
+ const output = await (0, setup_cache_1.bundleOnCli)({
57
+ fullPath: file,
58
+ logLevel,
59
+ onDirectoryCreated: () => { },
60
+ bundlingStep: 0,
61
+ indent: false,
62
+ quietProgress: updatesDontOverwrite,
63
+ publicDir,
64
+ steps: 1,
65
+ remotionRoot,
66
+ onProgressCallback: ({ bundling, copying }) => {
67
+ // Handle floating point inaccuracies
68
+ if (bundling.progress < 0.99999) {
69
+ if (updatesDontOverwrite) {
70
+ log_1.Log.info(`Bundling ${Math.round(bundling.progress * 100)}%`);
71
+ }
72
+ }
73
+ if (copying.doneIn === null) {
74
+ if (updatesDontOverwrite) {
75
+ return `Copying public dir ${studio_1.StudioInternals.formatBytes(copying.bytes)}`;
76
+ }
77
+ }
78
+ },
79
+ quietFlag: (0, parse_command_line_1.quietFlagProvided)(),
80
+ outDir: outputPath,
81
+ });
82
+ log_1.Log.infoAdvanced({ indent: false, logLevel }, chalk_1.chalk.blue(`${existed ? '○' : '+'} ${output}`));
83
+ if (!gitignoreFolder) {
84
+ return;
85
+ }
86
+ // Non-interactive terminal
87
+ if (!process.stdout.isTTY) {
88
+ return;
89
+ }
90
+ const gitignorePath = path_1.default.join(gitignoreFolder, '.gitignore');
91
+ const gitIgnoreContents = (0, fs_1.readFileSync)(gitignorePath, 'utf-8');
92
+ const relativePathToGitIgnore = path_1.default.relative(gitignoreFolder, outputPath);
93
+ const isInGitIgnore = gitIgnoreContents
94
+ .split('\n')
95
+ .includes(relativePathToGitIgnore);
96
+ if (isInGitIgnore) {
97
+ return;
98
+ }
99
+ const answer = await (0, yes_or_no_1.yesOrNo)({
100
+ defaultValue: true,
101
+ question: `Recommended: Add ${chalk_1.chalk.bold(relativePathToGitIgnore)} to your ${chalk_1.chalk.bold('.gitignore')} file? (Y/n)`,
102
+ });
103
+ if (!answer) {
104
+ return;
105
+ }
106
+ const newGitIgnoreContents = gitIgnoreContents + '\n' + relativePathToGitIgnore;
107
+ (0, fs_1.writeFileSync)(gitignorePath, newGitIgnoreContents);
108
+ log_1.Log.infoAdvanced({ indent: false, logLevel }, chalk_1.chalk.blue(`Added to .gitignore!`));
109
+ };
110
+ exports.bundleCommand = bundleCommand;
@@ -8,6 +8,7 @@ const preview_server_1 = require("./config/preview-server");
8
8
  const entry_point_1 = require("./entry-point");
9
9
  const get_cli_options_1 = require("./get-cli-options");
10
10
  const log_1 = require("./log");
11
+ const parse_command_line_1 = require("./parse-command-line");
11
12
  const print_compositions_1 = require("./print-compositions");
12
13
  const setup_cache_1 = require("./setup-cache");
13
14
  const listCompositionsCommand = async (remotionRoot, args, logLevel) => {
@@ -38,6 +39,8 @@ const listCompositionsCommand = async (remotionRoot, args, logLevel) => {
38
39
  (0, cleanup_before_quit_1.registerCleanupJob)(() => renderer_1.RenderInternals.deleteDirectory(dir));
39
40
  },
40
41
  quietProgress: false,
42
+ quietFlag: (0, parse_command_line_1.quietFlagProvided)(),
43
+ outDir: null,
41
44
  });
42
45
  (0, cleanup_before_quit_1.registerCleanupJob)(() => cleanupBundle());
43
46
  const compositions = await renderer_1.RenderInternals.internalGetCompositions({
@@ -1,6 +1,8 @@
1
1
  import type { LogLevel } from '@remotion/renderer';
2
+ type FoundReason = 'argument passed - found in cwd' | 'argument passed - found in root' | 'argument passed' | 'config file' | 'common paths' | 'none found';
2
3
  export declare const findEntryPoint: (args: string[], remotionRoot: string, logLevel: LogLevel) => {
3
4
  file: string | null;
4
5
  remainingArgs: string[];
5
- reason: string;
6
+ reason: FoundReason;
6
7
  };
8
+ export {};
package/dist/index.d.ts CHANGED
@@ -169,6 +169,7 @@ export declare const CliInternals: {
169
169
  browser: string;
170
170
  "browser-args": string;
171
171
  "user-agent": string;
172
+ "out-dir": string;
172
173
  repro: boolean;
173
174
  "number-of-gif-loops": number;
174
175
  "offthreadvideo-cache-size-in-bytes": number | null;
@@ -205,7 +206,7 @@ export declare const CliInternals: {
205
206
  findEntryPoint: (args: string[], remotionRoot: string, logLevel: "verbose" | "info" | "warn" | "error") => {
206
207
  file: string | null;
207
208
  remainingArgs: string[];
208
- reason: string;
209
+ reason: "argument passed - found in cwd" | "argument passed - found in root" | "argument passed" | "config file" | "common paths" | "none found";
209
210
  };
210
211
  getVideoImageFormat: ({ codec, uiImageFormat, }: {
211
212
  codec: import("@remotion/renderer").CodecOrUndefined;
package/dist/index.js CHANGED
@@ -8,6 +8,7 @@ const renderer_1 = require("@remotion/renderer");
8
8
  const studio_1 = require("@remotion/studio");
9
9
  const minimist_1 = __importDefault(require("minimist"));
10
10
  const benchmark_1 = require("./benchmark");
11
+ const bundle_1 = require("./bundle");
11
12
  const chalk_1 = require("./chalk");
12
13
  const cleanup_before_quit_1 = require("./cleanup-before-quit");
13
14
  const cloudrun_command_1 = require("./cloudrun-command");
@@ -69,7 +70,10 @@ const cli = async () => {
69
70
  const logLevel = await (0, initialize_cli_1.initializeCli)(remotionRoot);
70
71
  (0, cleanup_before_quit_1.handleCtrlC)({ indent: false, logLevel });
71
72
  try {
72
- if (command === 'compositions') {
73
+ if (command === 'bundle') {
74
+ await (0, bundle_1.bundleCommand)(remotionRoot, args, logLevel);
75
+ }
76
+ else if (command === 'compositions') {
73
77
  await (0, compositions_1.listCompositionsCommand)(remotionRoot, args, logLevel);
74
78
  }
75
79
  else if (isStudio) {
@@ -122,6 +122,7 @@ type CommandLineOptions = {
122
122
  ['browser']: string;
123
123
  ['browser-args']: string;
124
124
  ['user-agent']: string;
125
+ ['out-dir']: string;
125
126
  [deleteAfterOption.cliFlag]: string | undefined;
126
127
  [folderExpiryOption.cliFlag]: boolean | undefined;
127
128
  [enableMultiprocessOnLinuxOption.cliFlag]: boolean;
@@ -8,10 +8,10 @@ const versions_1 = require("./versions");
8
8
  const packagejson = require('../package.json');
9
9
  const printHelp = () => {
10
10
  log_1.Log.info(`@remotion/cli ${packagejson.version}`);
11
- log_1.Log.info(`© ${new Date().getFullYear()} The Remotion AG`);
11
+ log_1.Log.info(`© ${new Date().getFullYear()} Remotion AG`);
12
12
  log_1.Log.info();
13
13
  log_1.Log.info('Available commands:');
14
- log_1.Log.info('');
14
+ log_1.Log.info();
15
15
  log_1.Log.info(chalk_1.chalk.blue('remotion studio') + chalk_1.chalk.gray(' <entry-point.ts>'));
16
16
  log_1.Log.info('Start the Remotion studio.');
17
17
  log_1.Log.info(chalk_1.chalk.gray('https://www.remotion.dev/docs/cli/studio'));
@@ -26,6 +26,10 @@ const printHelp = () => {
26
26
  log_1.Log.info('Render a still frame and save it as an image.');
27
27
  log_1.Log.info(chalk_1.chalk.gray('https://www.remotion.dev/docs/cli/still'));
28
28
  log_1.Log.info();
29
+ log_1.Log.info(chalk_1.chalk.blue('remotion bundle') + chalk_1.chalk.gray(' <entry-point.ts>'));
30
+ log_1.Log.info('Create a Remotion bundle to be deployed to the web.');
31
+ log_1.Log.info(chalk_1.chalk.gray('https://www.remotion.dev/docs/cli/bundle'));
32
+ log_1.Log.info();
29
33
  log_1.Log.info(chalk_1.chalk.blue('remotion compositions') + chalk_1.chalk.gray(' <index-file.ts>'));
30
34
  log_1.Log.info('Prints the available compositions.');
31
35
  log_1.Log.info(chalk_1.chalk.gray('https://www.remotion.dev/docs/cli/compositions'));
@@ -118,6 +118,8 @@ const renderVideoFlow = async ({ remotionRoot, fullEntryPoint, indent, logLevel,
118
118
  addCleanupCallback(() => renderer_1.RenderInternals.deleteDirectory(dir));
119
119
  },
120
120
  quietProgress: updatesDontOverwrite,
121
+ quietFlag: (0, parse_command_line_1.quietFlagProvided)(),
122
+ outDir: null,
121
123
  });
122
124
  addCleanupCallback(() => cleanupBundle());
123
125
  const onDownload = (0, make_on_download_1.makeOnDownload)({
@@ -82,6 +82,8 @@ const renderStillFlow = async ({ remotionRoot, fullEntryPoint, entryPointReason,
82
82
  });
83
83
  },
84
84
  quietProgress: updatesDontOverwrite,
85
+ quietFlag: (0, parse_command_line_1.quietFlagProvided)(),
86
+ outDir: null,
85
87
  });
86
88
  const server = await renderer_1.RenderInternals.prepareServer({
87
89
  concurrency: 1,
@@ -1,6 +1,6 @@
1
1
  import type { LogLevel } from '@remotion/renderer';
2
2
  import type { BundlingState, CopyingState } from '@remotion/studio';
3
- export declare const bundleOnCliOrTakeServeUrl: ({ fullPath, remotionRoot, publicDir, onProgress, indentOutput, logLevel, bundlingStep, steps, onDirectoryCreated, quietProgress, }: {
3
+ export declare const bundleOnCliOrTakeServeUrl: ({ fullPath, remotionRoot, publicDir, onProgress, indentOutput, logLevel, bundlingStep, steps, onDirectoryCreated, quietProgress, quietFlag, outDir, }: {
4
4
  fullPath: string;
5
5
  remotionRoot: string;
6
6
  publicDir: string | null;
@@ -14,7 +14,26 @@ export declare const bundleOnCliOrTakeServeUrl: ({ fullPath, remotionRoot, publi
14
14
  steps: number;
15
15
  onDirectoryCreated: (path: string) => void;
16
16
  quietProgress: boolean;
17
+ quietFlag: boolean;
18
+ outDir: string | null;
17
19
  }) => Promise<{
18
20
  urlOrBundle: string;
19
21
  cleanup: () => void;
20
22
  }>;
23
+ export declare const bundleOnCli: ({ fullPath, remotionRoot, publicDir, onProgressCallback, indent, logLevel, bundlingStep, steps, onDirectoryCreated, quietProgress, quietFlag, outDir, }: {
24
+ fullPath: string;
25
+ remotionRoot: string;
26
+ publicDir: string | null;
27
+ onProgressCallback: (params: {
28
+ bundling: BundlingState;
29
+ copying: CopyingState;
30
+ }) => void;
31
+ indent: boolean;
32
+ logLevel: LogLevel;
33
+ bundlingStep: number;
34
+ steps: number;
35
+ onDirectoryCreated: (path: string) => void;
36
+ quietProgress: boolean;
37
+ quietFlag: boolean;
38
+ outDir: string | null;
39
+ }) => Promise<string>;
@@ -1,14 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.bundleOnCliOrTakeServeUrl = void 0;
3
+ exports.bundleOnCli = exports.bundleOnCliOrTakeServeUrl = void 0;
4
4
  const bundler_1 = require("@remotion/bundler");
5
5
  const renderer_1 = require("@remotion/renderer");
6
6
  const config_1 = require("./config");
7
7
  const log_1 = require("./log");
8
- const parse_command_line_1 = require("./parse-command-line");
9
8
  const progress_bar_1 = require("./progress-bar");
10
9
  const should_use_non_overlaying_logger_1 = require("./should-use-non-overlaying-logger");
11
- const bundleOnCliOrTakeServeUrl = async ({ fullPath, remotionRoot, publicDir, onProgress, indentOutput, logLevel, bundlingStep, steps, onDirectoryCreated, quietProgress, }) => {
10
+ const bundleOnCliOrTakeServeUrl = async ({ fullPath, remotionRoot, publicDir, onProgress, indentOutput, logLevel, bundlingStep, steps, onDirectoryCreated, quietProgress, quietFlag, outDir, }) => {
12
11
  if (renderer_1.RenderInternals.isServeUrl(fullPath)) {
13
12
  onProgress({
14
13
  bundling: {
@@ -25,7 +24,7 @@ const bundleOnCliOrTakeServeUrl = async ({ fullPath, remotionRoot, publicDir, on
25
24
  cleanup: () => Promise.resolve(undefined),
26
25
  };
27
26
  }
28
- const bundled = await bundleOnCli({
27
+ const bundled = await (0, exports.bundleOnCli)({
29
28
  fullPath,
30
29
  remotionRoot,
31
30
  publicDir,
@@ -36,6 +35,8 @@ const bundleOnCliOrTakeServeUrl = async ({ fullPath, remotionRoot, publicDir, on
36
35
  steps,
37
36
  onDirectoryCreated,
38
37
  quietProgress,
38
+ quietFlag,
39
+ outDir,
39
40
  });
40
41
  return {
41
42
  urlOrBundle: bundled,
@@ -43,7 +44,7 @@ const bundleOnCliOrTakeServeUrl = async ({ fullPath, remotionRoot, publicDir, on
43
44
  };
44
45
  };
45
46
  exports.bundleOnCliOrTakeServeUrl = bundleOnCliOrTakeServeUrl;
46
- const bundleOnCli = async ({ fullPath, remotionRoot, publicDir, onProgressCallback, indent, logLevel, bundlingStep, steps, onDirectoryCreated, quietProgress, }) => {
47
+ const bundleOnCli = async ({ fullPath, remotionRoot, publicDir, onProgressCallback, indent, logLevel, bundlingStep, steps, onDirectoryCreated, quietProgress, quietFlag, outDir, }) => {
47
48
  var _a;
48
49
  const shouldCache = config_1.ConfigInternals.getWebpackCaching();
49
50
  const symlinkState = {
@@ -112,7 +113,7 @@ const bundleOnCli = async ({ fullPath, remotionRoot, publicDir, onProgressCallba
112
113
  }
113
114
  const bundleStartTime = Date.now();
114
115
  const bundlingProgress = (0, progress_bar_1.createOverwriteableCliOutput)({
115
- quiet: quietProgress || (0, parse_command_line_1.quietFlagProvided)(),
116
+ quiet: quietProgress || quietFlag,
116
117
  cancelSignal: null,
117
118
  updatesDontOverwrite: (0, should_use_non_overlaying_logger_1.shouldUseNonOverlayingLogger)({ logLevel }),
118
119
  indent,
@@ -131,6 +132,7 @@ const bundleOnCli = async ({ fullPath, remotionRoot, publicDir, onProgressCallba
131
132
  updateProgress(false);
132
133
  },
133
134
  onDirectoryCreated,
135
+ outDir: outDir !== null && outDir !== void 0 ? outDir : undefined,
134
136
  ...options,
135
137
  });
136
138
  bundlingState = {
@@ -154,3 +156,4 @@ const bundleOnCli = async ({ fullPath, remotionRoot, publicDir, onProgressCallba
154
156
  }
155
157
  return bundled;
156
158
  };
159
+ exports.bundleOnCli = bundleOnCli;
@@ -0,0 +1,4 @@
1
+ export declare const yesOrNo: ({ question, defaultValue, }: {
2
+ question: string;
3
+ defaultValue: boolean;
4
+ }) => Promise<boolean>;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.yesOrNo = void 0;
7
+ const readline_1 = __importDefault(require("readline"));
8
+ const options = {
9
+ yes: ['yes', 'y'],
10
+ no: ['no', 'n'],
11
+ };
12
+ function defaultInvalidHandler({ yesValues, noValues, }) {
13
+ process.stdout.write('\nInvalid Response.\n');
14
+ process.stdout.write('Answer either yes : (' + yesValues.join(', ') + ') \n');
15
+ process.stdout.write('Or no: (' + noValues.join(', ') + ') \n\n');
16
+ }
17
+ const yesOrNo = ({ question, defaultValue, }) => {
18
+ const invalid = defaultInvalidHandler;
19
+ const yesValues = options.yes.map((v) => v.toLowerCase());
20
+ const noValues = options.no.map((v) => v.toLowerCase());
21
+ const rl = readline_1.default.createInterface({
22
+ input: process.stdin,
23
+ output: process.stdout,
24
+ });
25
+ return new Promise((resolve) => {
26
+ rl.question(question + ' ', async (answer) => {
27
+ rl.close();
28
+ const cleaned = answer.trim().toLowerCase();
29
+ if (cleaned === '' && defaultValue !== null)
30
+ return resolve(defaultValue);
31
+ if (yesValues.indexOf(cleaned) >= 0)
32
+ return resolve(true);
33
+ if (noValues.indexOf(cleaned) >= 0)
34
+ return resolve(false);
35
+ invalid({ question, yesValues, noValues });
36
+ const result = await (0, exports.yesOrNo)({
37
+ question,
38
+ defaultValue,
39
+ });
40
+ resolve(result);
41
+ });
42
+ });
43
+ };
44
+ exports.yesOrNo = yesOrNo;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/cli",
3
- "version": "4.0.88",
3
+ "version": "4.0.89",
4
4
  "description": "CLI for Remotion",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -31,12 +31,12 @@
31
31
  "dotenv": "9.0.2",
32
32
  "minimist": "1.2.6",
33
33
  "prompts": "2.4.2",
34
- "@remotion/bundler": "4.0.88",
35
- "@remotion/media-utils": "4.0.88",
36
- "@remotion/renderer": "4.0.88",
37
- "remotion": "4.0.88",
38
- "@remotion/studio": "4.0.88",
39
- "@remotion/player": "4.0.88"
34
+ "@remotion/player": "4.0.89",
35
+ "@remotion/media-utils": "4.0.89",
36
+ "@remotion/bundler": "4.0.89",
37
+ "@remotion/renderer": "4.0.89",
38
+ "remotion": "4.0.89",
39
+ "@remotion/studio": "4.0.89"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "react": ">=16.8.0",
@@ -61,8 +61,8 @@
61
61
  "react-dom": "18.2.0",
62
62
  "vitest": "0.31.1",
63
63
  "zod": "^3.22.3",
64
- "@remotion/zod-types": "4.0.88",
65
- "@remotion/tailwind": "4.0.88"
64
+ "@remotion/zod-types": "4.0.89",
65
+ "@remotion/tailwind": "4.0.89"
66
66
  },
67
67
  "keywords": [
68
68
  "remotion",