Skip to content

🎥 Make videos programmatically with React

`@remotion/cli`: Fix output location name

Jonny Burger7ba04d02a2e7
diff --git a/packages/cli/src/benchmark.ts b/packages/cli/src/benchmark.ts
index c4e4b55e55..61309b9f41 100644
--- a/packages/cli/src/benchmark.ts
+++ b/packages/cli/src/benchmark.ts
@@ -507,7 +507,8 @@ export const benchmarkCommand = async (
benchmarkProgress.update('', false);
benchmarkProgress.update(getResults(timeTaken, runs), false);
- benchmark[composition.id][`${con}`] = timeTaken;
+ (benchmark[composition.id] as Record<string, number[]>)[`${con}`] =
+ timeTaken;
}
}
diff --git a/packages/cli/src/code-frame.ts b/packages/cli/src/code-frame.ts
index 3a7cf71e25..d40e8f5b15 100644
--- a/packages/cli/src/code-frame.ts
+++ b/packages/cli/src/code-frame.ts
@@ -89,7 +89,7 @@ export const printCodeFrameAndStack = (
chalk.bgRed(chalk.white(` ${err.name} `)),
err.message,
);
- printCodeFrame(firstFrame, logLevel);
+ printCodeFrame(firstFrame as SymbolicatedStackFrame, logLevel);
Log.info({indent: false, logLevel});
for (const frame of err.symbolicatedStackFrames) {
if (frame === firstFrame) {
diff --git a/packages/cli/src/config/frame-range.ts b/packages/cli/src/config/frame-range.ts
index 6b9b3e1bde..dae94312ad 100644
--- a/packages/cli/src/config/frame-range.ts
+++ b/packages/cli/src/config/frame-range.ts
@@ -23,7 +23,7 @@ export const setFrameRangeFromCli = (newFrameRange: string | number) => {
);
}
- if (parsed.length === 2 && parsed[1] < parsed[0]) {
+ if (parsed.length === 2 && (parsed[1] as number) < (parsed[0] as number)) {
throw new Error(
'The second number of the --frames flag number should be greater or equal than first number',
);
diff --git a/packages/cli/src/get-github-repository.ts b/packages/cli/src/get-github-repository.ts
index 572fef4e37..b955572c02 100644
--- a/packages/cli/src/get-github-repository.ts
+++ b/packages/cli/src/get-github-repository.ts
@@ -23,7 +23,7 @@ const getGitRemotes = (lines: string[]) => {
open = false;
}
} else if (open) {
- sections[sections.length - 1].push(line);
+ (sections[sections.length - 1] as string[]).push(line);
}
}
@@ -31,7 +31,7 @@ const getGitRemotes = (lines: string[]) => {
const url = s.find((l) => l.trimStart().startsWith('url = '));
return {
- remote: s[0].replace('[remote "', '').replace('"]', ''),
+ remote: (s[0] as string).replace('[remote "', '').replace('"]', ''),
url: url ? url.replace('url = ', '').trim() : null,
};
});
@@ -69,8 +69,8 @@ export const normalizeGitRemoteUrl = (url: string): ParsedGitRemote | null => {
if (matched) {
return {
type: 'github',
- name: matched[2],
- org: matched[1],
+ name: matched[2] as string,
+ org: matched[1] as string,
};
}
}
@@ -79,8 +79,8 @@ export const normalizeGitRemoteUrl = (url: string): ParsedGitRemote | null => {
if (gitHubMatch) {
return {
type: 'github',
- name: gitHubMatch[2],
- org: gitHubMatch[1],
+ name: gitHubMatch[2] as string,
+ org: gitHubMatch[1] as string,
};
}
@@ -88,8 +88,8 @@ export const normalizeGitRemoteUrl = (url: string): ParsedGitRemote | null => {
if (gitHubMatchWithoutGit) {
return {
type: 'github',
- name: gitHubMatchWithoutGit[2],
- org: gitHubMatchWithoutGit[1],
+ name: gitHubMatchWithoutGit[2] as string,
+ org: gitHubMatchWithoutGit[1] as string,
};
}
diff --git a/packages/cli/src/hyperlinks/is-supported.ts b/packages/cli/src/hyperlinks/is-supported.ts
index e2458e442a..2d09e5f866 100644
--- a/packages/cli/src/hyperlinks/is-supported.ts
+++ b/packages/cli/src/hyperlinks/is-supported.ts
@@ -14,8 +14,8 @@ function parseVersion(versionString: string) {
const m = /(\d{1,2})(\d{2})/.exec(versionString) || [];
return {
major: 0,
- minor: parseInt(m[1], 10),
- patch: parseInt(m[2], 10),
+ minor: parseInt(m[1] as string, 10),
+ patch: parseInt(m[2] as string, 10),
};
}
@@ -65,15 +65,16 @@ export function supportsHyperlink(): false | string {
switch (TERM_PROGRAM) {
case 'iTerm.app':
if (version.major === 3) {
- return version.minor >= 1 ? 'Cmd+Click' : false;
+ return (version.minor as number) >= 1 ? 'Cmd+Click' : false;
}
- return version.major > 3 ? 'Cmd+Click' : false;
+ return (version.major as number) > 3 ? 'Cmd+Click' : false;
case 'WezTerm':
- return version.major >= 20200620 ? 'Click' : false;
+ return (version.major as number) >= 20200620 ? 'Click' : false;
case 'vscode':
// eslint-disable-next-line no-mixed-operators
- return version.major > 1 || (version.major === 1 && version.minor >= 72)
+ return (version.major as number) > 1 ||
+ (version.major === 1 && (version.minor as number) >= 72)
? process.platform === 'darwin'
? 'Option+Click'
: 'Ctrl+Click'
@@ -89,7 +90,9 @@ export function supportsHyperlink(): false | string {
}
const version = parseVersion(VTE_VERSION);
- return version.major > 0 || version.minor >= 50 ? 'Click' : false;
+ return (version.major as number) > 0 || (version.minor as number) >= 50
+ ? 'Click'
+ : false;
}
return false;
diff --git a/packages/cli/src/load-config.ts b/packages/cli/src/load-config.ts
index 34fe748b4c..b704499800 100644
--- a/packages/cli/src/load-config.ts
+++ b/packages/cli/src/load-config.ts
@@ -49,7 +49,17 @@ export const loadConfigFile = async (
process.exit(1);
}
- let str = new TextDecoder().decode(result.outputFiles[0].contents);
+ const firstOutfile = result.outputFiles[0];
+
+ if (!firstOutfile) {
+ Log.error(
+ {indent: false, logLevel: 'error'},
+ 'No output files found in the config file.',
+ );
+ process.exit(1);
+ }
+
+ let str = new TextDecoder().decode(firstOutfile.contents);
const currentCwd = process.cwd();
diff --git a/packages/cli/src/parse-command-line.ts b/packages/cli/src/parse-command-line.ts
index 0820406ce6..787e22ea62 100644
--- a/packages/cli/src/parse-command-line.ts
+++ b/packages/cli/src/parse-command-line.ts
@@ -67,7 +67,7 @@ export type CommandLineOptions = {
[publicPathOption.cliFlag]: string;
crf: number;
force: boolean;
- output: string;
+ output: string | undefined;
overwrite: boolean;
png: boolean;
props: string;
diff --git a/packages/cli/src/print-compositions.ts b/packages/cli/src/print-compositions.ts
index e52fa66dd6..e74f0e7767 100644
--- a/packages/cli/src/print-compositions.ts
+++ b/packages/cli/src/print-compositions.ts
@@ -8,9 +8,9 @@ const max = (arr: number[]) => {
throw new Error('Array of 0 length');
}
- let biggest = arr[0];
+ let biggest = arr[0] as number;
for (let i = 0; i < arr.length; i++) {
- const elem = arr[i];
+ const elem = arr[i] as number;
if (elem > biggest) {
biggest = elem;
}
@@ -40,7 +40,8 @@ export const printCompositions = (
return;
}
- const firstColumnLength = max(compositions.map(({id}) => id.length)) + 4;
+ const firstColumnLength =
+ (max(compositions.map(({id}) => id.length)) as number) + 4;
const secondColumnLength = 8;
const thirdColumnLength = 15;
diff --git a/packages/cli/src/user-passed-output-location.ts b/packages/cli/src/user-passed-output-location.ts
index 782f3df625..bba3999d75 100644
--- a/packages/cli/src/user-passed-output-location.ts
+++ b/packages/cli/src/user-passed-output-location.ts
@@ -12,7 +12,7 @@ export const getUserPassedOutputLocation = (
parsedCli.output ??
ConfigInternals.getOutputLocation();
- return String(filename);
+ return filename ? String(filename) : null;
};
export const getOutputLocation = ({
diff --git a/packages/cli/src/versions.ts b/packages/cli/src/versions.ts
index 3a2ab45b87..bda76809a1 100644
--- a/packages/cli/src/versions.ts
+++ b/packages/cli/src/versions.ts
@@ -27,7 +27,7 @@ const groupBy = (vals: [string, string][]) => {
groups[version] = [];
}
- groups[version].push(pkg);
+ (groups[version] as string[]).push(pkg);
}
return groups;
@@ -72,7 +72,7 @@ export const validateVersionsBeforeCommand = async (
Log.warn(logOptions, 'Version mismatch:');
for (const version of installedVersions) {
Log.warn(logOptions, `- On version: ${version}`);
- for (const pkg of grouped[version]) {
+ for (const pkg of grouped[version] ?? []) {
Log.warn(logOptions, ` - ${pkg}`);
}
@@ -122,7 +122,7 @@ export const versionsCommand = async (
Log.info({indent: false, logLevel});
for (const version of installedVersions) {
Log.info({indent: false, logLevel}, `On version: ${version}`);
- for (const pkg of grouped[version]) {
+ for (const pkg of grouped[version] ?? []) {
Log.info({indent: false, logLevel}, `- ${pkg}`);
Log.verbose(
{indent: false, logLevel},
diff --git a/packages/cli/tsconfig.json b/packages/cli/tsconfig.json
index e49500526e..aecbd92b10 100644
--- a/packages/cli/tsconfig.json
+++ b/packages/cli/tsconfig.json
@@ -5,6 +5,8 @@
"outDir": "dist",
"jsx": "react-jsx",
"skipLibCheck": true,
+ "strict": true,
+ "noUncheckedIndexedAccess": true,
"lib": ["dom"]
},
"references": [