create-video 4.0.321 → 4.0.323

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/init.js CHANGED
@@ -69,7 +69,16 @@ const getGitStatus = async (root) => {
69
69
  };
70
70
  const init = async () => {
71
71
  log_1.Log.info(`Welcome to ${chalk_1.default.blue('Remotion')}!`);
72
- const { projectRoot, folderName } = await (0, resolve_project_root_1.resolveProjectRoot)();
72
+ // Get directory argument if provided
73
+ const directoryArgument = (0, select_template_1.getDirectoryArgument)();
74
+ // Select template first
75
+ const selectedTemplate = await (0, select_template_1.selectTemplate)();
76
+ log_1.Log.info(`Selected ${chalk_1.default.blue(selectedTemplate.shortName)}.`);
77
+ // Then resolve project root with template info and directory argument
78
+ const { projectRoot, folderName } = await (0, resolve_project_root_1.resolveProjectRoot)({
79
+ directoryArgument,
80
+ selectedTemplate,
81
+ });
73
82
  log_1.Log.info();
74
83
  const result = await (0, exports.checkGitAvailability)(projectRoot, 'git', ['--version']);
75
84
  if (result.type === 'git-not-installed') {
@@ -86,7 +95,6 @@ const init = async () => {
86
95
  }
87
96
  }
88
97
  const latestRemotionVersionPromise = (0, latest_remotion_version_1.getLatestRemotionVersion)();
89
- const selectedTemplate = await (0, select_template_1.selectTemplate)();
90
98
  const shouldOverrideTailwind = selectedTemplate.allowEnableTailwind
91
99
  ? await (0, ask_tailwind_1.askTailwind)()
92
100
  : false;
@@ -130,7 +138,7 @@ const init = async () => {
130
138
  ? projectRoot
131
139
  : relativeToCurrent;
132
140
  log_1.Log.info();
133
- log_1.Log.info(`Copied ${chalk_1.default.blue(selectedTemplate.shortName)} to ${chalk_1.default.blue(cdToFolder)}.`);
141
+ log_1.Log.info(`Copied to ${chalk_1.default.blue(cdToFolder)}.`);
134
142
  log_1.Log.info();
135
143
  log_1.Log.info('Get started by running:');
136
144
  log_1.Log.info(' ' + chalk_1.default.blue(`cd ${cdToFolder}`));
@@ -140,9 +148,9 @@ const init = async () => {
140
148
  log_1.Log.info('To render a video, run:');
141
149
  log_1.Log.info(' ' + chalk_1.default.blue((0, pkg_managers_1.getRenderCommand)(pkgManager)));
142
150
  log_1.Log.info('');
143
- log_1.Log.info('Docs to get you started:', chalk_1.default.underline('https://www.remotion.dev/docs/the-fundamentals'));
144
151
  log_1.Log.info();
145
152
  await (0, open_in_editor_flow_1.openInEditorFlow)(projectRoot);
153
+ log_1.Log.info('Docs to get you started:', chalk_1.default.underline('https://www.remotion.dev/docs/the-fundamentals'));
146
154
  log_1.Log.info('Enjoy Remotion!');
147
155
  };
148
156
  exports.init = init;
@@ -1,4 +1,8 @@
1
- export declare const resolveProjectRoot: () => Promise<{
1
+ import type { Template } from './templates';
2
+ export declare const resolveProjectRoot: (options?: {
3
+ directoryArgument?: string | null;
4
+ selectedTemplate?: Template;
5
+ }) => Promise<{
2
6
  projectRoot: string;
3
7
  folderName: string;
4
8
  }>;
@@ -32,7 +32,7 @@ function assertFolderEmptyAsync(projectRoot) {
32
32
  }
33
33
  return { exists: false };
34
34
  }
35
- const resolveProjectRoot = async () => {
35
+ const resolveProjectRoot = async (options) => {
36
36
  if ((0, select_template_1.isTmpFlagSelected)()) {
37
37
  log_1.Log.info('Creating the video in a temporary directory.');
38
38
  const randomName = `remotion-video-${Math.random().toString(36).slice(2)}`;
@@ -41,28 +41,39 @@ const resolveProjectRoot = async () => {
41
41
  return { projectRoot: randomRoot, folderName: randomName };
42
42
  }
43
43
  let projectName = '';
44
- try {
45
- const { answer } = await (0, prompts_1.default)({
46
- type: 'text',
47
- name: 'answer',
48
- message: 'What would you like to name your video?',
49
- initial: 'my-video',
50
- validate: (name) => {
51
- const validation = (0, validate_name_1.validateName)(node_path_1.default.basename(node_path_1.default.resolve(name)));
52
- if (typeof validation === 'string') {
53
- return 'Invalid project name: ' + validation;
54
- }
55
- return true;
56
- },
57
- });
58
- if (typeof answer === 'string') {
59
- projectName = answer.trim();
60
- }
44
+ // If a directory argument was provided, use it directly
45
+ if (options === null || options === void 0 ? void 0 : options.directoryArgument) {
46
+ projectName = options.directoryArgument;
61
47
  }
62
- catch (error) {
63
- // Handle the aborted message in a custom way.
64
- if (error.code !== 'ABORTED') {
65
- throw error;
48
+ else {
49
+ // Print selected template info before prompting for directory
50
+ if (options === null || options === void 0 ? void 0 : options.selectedTemplate) {
51
+ log_1.Log.info(`Selected template: ${chalk_1.default.blue(options.selectedTemplate.shortName)}`);
52
+ log_1.Log.info();
53
+ }
54
+ try {
55
+ const { answer } = await (0, prompts_1.default)({
56
+ type: 'text',
57
+ name: 'answer',
58
+ message: 'Directory to create your project',
59
+ initial: 'my-video',
60
+ validate: (name) => {
61
+ const validation = (0, validate_name_1.validateName)(node_path_1.default.basename(node_path_1.default.resolve(name)));
62
+ if (typeof validation === 'string') {
63
+ return 'Invalid project name: ' + validation;
64
+ }
65
+ return true;
66
+ },
67
+ });
68
+ if (typeof answer === 'string') {
69
+ projectName = answer.trim();
70
+ }
71
+ }
72
+ catch (error) {
73
+ // Handle the aborted message in a custom way.
74
+ if (error.code !== 'ABORTED') {
75
+ throw error;
76
+ }
66
77
  }
67
78
  }
68
79
  const projectRoot = node_path_1.default.resolve(projectName);
@@ -70,7 +81,7 @@ const resolveProjectRoot = async () => {
70
81
  assertValidName(folderName);
71
82
  (0, mkdirp_1.mkdirp)(projectRoot);
72
83
  if (assertFolderEmptyAsync(projectRoot).exists) {
73
- return (0, exports.resolveProjectRoot)();
84
+ return (0, exports.resolveProjectRoot)(options);
74
85
  }
75
86
  return { projectRoot, folderName };
76
87
  };
@@ -1,3 +1,5 @@
1
1
  import type { Template } from './templates';
2
2
  export declare const isTmpFlagSelected: () => boolean;
3
+ export declare const getPositionalArguments: () => string[];
4
+ export declare const getDirectoryArgument: () => string | null;
3
5
  export declare const selectTemplate: () => Promise<Template>;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.selectTemplate = exports.isTmpFlagSelected = void 0;
6
+ exports.selectTemplate = exports.getDirectoryArgument = exports.getPositionalArguments = exports.isTmpFlagSelected = void 0;
7
7
  const chalk_1 = __importDefault(require("chalk"));
8
8
  const minimist_1 = __importDefault(require("minimist"));
9
9
  const make_link_1 = require("./hyperlinks/make-link");
@@ -11,9 +11,17 @@ const prompts_1 = require("./prompts");
11
11
  const templates_1 = require("./templates");
12
12
  const parsed = (0, minimist_1.default)(process.argv.slice(2), {
13
13
  boolean: [...templates_1.FEATURED_TEMPLATES.map((f) => f.cliId), 'tmp'],
14
+ string: ['_'],
14
15
  });
15
16
  const isTmpFlagSelected = () => parsed.tmp;
16
17
  exports.isTmpFlagSelected = isTmpFlagSelected;
18
+ const getPositionalArguments = () => parsed._;
19
+ exports.getPositionalArguments = getPositionalArguments;
20
+ const getDirectoryArgument = () => {
21
+ const positionalArgs = (0, exports.getPositionalArguments)();
22
+ return positionalArgs.length > 0 ? positionalArgs[0] || null : null;
23
+ };
24
+ exports.getDirectoryArgument = getDirectoryArgument;
17
25
  const selectTemplate = async () => {
18
26
  const isFlagSelected = templates_1.FEATURED_TEMPLATES.find((f) => {
19
27
  return parsed[f.cliId];
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/create-video"
4
4
  },
5
5
  "name": "create-video",
6
- "version": "4.0.321",
6
+ "version": "4.0.323",
7
7
  "description": "Create a new Remotion project",
8
8
  "main": "dist/index.js",
9
9
  "bin": {
@@ -27,7 +27,7 @@
27
27
  "@types/tar": "6.1.1",
28
28
  "react": "19.0.0",
29
29
  "eslint": "9.19.0",
30
- "@remotion/eslint-config-internal": "4.0.321"
30
+ "@remotion/eslint-config-internal": "4.0.323"
31
31
  },
32
32
  "exports": {
33
33
  "./package.json": "./package.json",