create-video 4.0.438 → 4.0.439

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
@@ -74,6 +74,10 @@ const init = async () => {
74
74
  log_1.Log.info(`Welcome to ${chalk_1.default.blue('Remotion')}!`);
75
75
  // Get directory argument if provided
76
76
  const directoryArgument = (0, select_template_1.getDirectoryArgument)();
77
+ if ((0, select_template_1.isYesFlagSelected)() && !directoryArgument && !(0, select_template_1.isTmpFlagSelected)()) {
78
+ log_1.Log.error('A directory name must be specified when using --yes. Example: --yes --blank my-video');
79
+ process.exit(1);
80
+ }
77
81
  // Select template first
78
82
  const selectedTemplate = await (0, select_template_1.selectTemplate)();
79
83
  // If Editor Starter (paid) is selected, show purchase link and exit
@@ -95,6 +99,10 @@ const init = async () => {
95
99
  }
96
100
  const isInsideGitRepo = result.type === 'is-git-repo';
97
101
  if (isInsideGitRepo) {
102
+ if ((0, select_template_1.isYesFlagSelected)()) {
103
+ log_1.Log.error(`You are already inside a Git repo (${node_path_1.default.resolve(result.location)}). Cannot use --yes inside an existing Git repository.`);
104
+ process.exit(1);
105
+ }
98
106
  const { shouldContinue } = await (0, prompts_1.default)({
99
107
  type: 'toggle',
100
108
  name: 'shouldContinue',
@@ -109,9 +117,11 @@ const init = async () => {
109
117
  }
110
118
  const latestRemotionVersionPromise = (0, latest_remotion_version_1.getLatestRemotionVersion)();
111
119
  const shouldOverrideTailwind = selectedTemplate.allowEnableTailwind
112
- ? await (0, ask_tailwind_1.askTailwind)()
120
+ ? (0, select_template_1.isYesFlagSelected)()
121
+ ? !(0, select_template_1.isNoTailwindFlagSelected)()
122
+ : await (0, ask_tailwind_1.askTailwind)()
113
123
  : false;
114
- const shouldInstallSkills = await (0, ask_skills_1.askSkills)();
124
+ const shouldInstallSkills = (0, select_template_1.isYesFlagSelected)() ? false : await (0, ask_skills_1.askSkills)();
115
125
  const pkgManager = (0, pkg_managers_1.selectPackageManager)();
116
126
  const pkgManagerVersion = await (0, pkg_managers_1.getPackageManagerVersionOrNull)(pkgManager);
117
127
  try {
@@ -190,6 +200,8 @@ const init = async () => {
190
200
  fallback: 'https://www.remotion.pro/license',
191
201
  })));
192
202
  log_1.Log.info();
193
- await (0, open_in_editor_flow_1.openInEditorFlow)(projectRoot);
203
+ if (!(0, select_template_1.isYesFlagSelected)()) {
204
+ await (0, open_in_editor_flow_1.openInEditorFlow)(projectRoot);
205
+ }
194
206
  };
195
207
  exports.init = init;
@@ -4,10 +4,32 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getLatestRemotionVersion = void 0;
7
- const https_1 = __importDefault(require("https"));
7
+ const node_child_process_1 = require("node:child_process");
8
+ const node_http_1 = __importDefault(require("node:http"));
9
+ const node_https_1 = __importDefault(require("node:https"));
10
+ const DEFAULT_REGISTRY = 'https://registry.npmjs.org';
11
+ const getRegistry = () => {
12
+ try {
13
+ const registry = (0, node_child_process_1.execSync)('npm config get registry', {
14
+ encoding: 'utf-8',
15
+ timeout: 10000,
16
+ stdio: ['pipe', 'pipe', 'pipe'],
17
+ }).trim();
18
+ if (registry && registry !== 'undefined') {
19
+ return registry.replace(/\/$/, '');
20
+ }
21
+ }
22
+ catch (_a) {
23
+ // Fall through to default
24
+ }
25
+ return DEFAULT_REGISTRY;
26
+ };
8
27
  const getPackageJsonForRemotion = () => {
28
+ const registry = getRegistry();
29
+ const url = `${registry}/remotion`;
30
+ const client = url.startsWith('https') ? node_https_1.default : node_http_1.default;
9
31
  return new Promise((resolve, reject) => {
10
- const req = https_1.default.get('https://registry.npmjs.org/remotion', {
32
+ const req = client.get(url, {
11
33
  headers: {
12
34
  accept: 'application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*',
13
35
  },
@@ -26,6 +48,15 @@ const getPackageJsonForRemotion = () => {
26
48
  };
27
49
  const getLatestRemotionVersion = async () => {
28
50
  const pkgJson = await getPackageJsonForRemotion();
29
- return JSON.parse(pkgJson)['dist-tags'].latest;
51
+ try {
52
+ return JSON.parse(pkgJson)['dist-tags'].latest;
53
+ }
54
+ catch (_a) {
55
+ const registry = getRegistry();
56
+ throw new Error(`Failed to fetch the latest Remotion version from ${registry}. ` +
57
+ `The response was not valid JSON. ` +
58
+ `If you are behind a corporate proxy, make sure your npm registry is configured correctly ` +
59
+ `(npm config set registry <your-registry-url>).`);
60
+ }
30
61
  };
31
62
  exports.getLatestRemotionVersion = getLatestRemotionVersion;
@@ -43,9 +43,11 @@ const resolveProjectRoot = async (options) => {
43
43
  }
44
44
  let projectName = '';
45
45
  let directlyCreateInCurrentDir = false;
46
+ // eslint-disable-next-line no-control-regex
47
+ const stripControlChars = (s) => s.replace(/[\x00-\x1f\x7f]/g, '');
46
48
  // If a directory argument was provided, use it directly
47
49
  if (options === null || options === void 0 ? void 0 : options.directoryArgument) {
48
- projectName = options.directoryArgument;
50
+ projectName = stripControlChars(options.directoryArgument).trim();
49
51
  }
50
52
  else {
51
53
  // Print selected template info before prompting for directory
@@ -80,7 +82,7 @@ const resolveProjectRoot = async (options) => {
80
82
  },
81
83
  });
82
84
  if (typeof answer === 'string') {
83
- projectName = answer.trim();
85
+ projectName = stripControlChars(answer).trim();
84
86
  }
85
87
  }
86
88
  }
@@ -1,5 +1,7 @@
1
1
  import type { Template } from './templates';
2
2
  export declare const isTmpFlagSelected: () => boolean;
3
+ export declare const isYesFlagSelected: () => boolean;
4
+ export declare const isNoTailwindFlagSelected: () => boolean;
3
5
  export declare const getPositionalArguments: () => string[];
4
6
  export declare const getDirectoryArgument: () => string | null;
5
7
  export declare const isFlagSelected: {
@@ -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.isFlagSelected = exports.getDirectoryArgument = exports.getPositionalArguments = exports.isTmpFlagSelected = void 0;
6
+ exports.selectTemplate = exports.isFlagSelected = exports.getDirectoryArgument = exports.getPositionalArguments = exports.isNoTailwindFlagSelected = exports.isYesFlagSelected = 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,11 +11,16 @@ const prompts_1 = require("./prompts");
11
11
  const templates_1 = require("./templates");
12
12
  const ALL_TEMPLATES = [...templates_1.FEATURED_TEMPLATES, ...templates_1.PAID_TEMPLATES];
13
13
  const parsed = (0, minimist_1.default)(process.argv.slice(2), {
14
- boolean: [...ALL_TEMPLATES.map((f) => f.cliId), 'tmp'],
14
+ boolean: [...ALL_TEMPLATES.map((f) => f.cliId), 'tmp', 'yes', 'no-tailwind'],
15
15
  string: ['_'],
16
+ alias: { y: 'yes' },
16
17
  });
17
18
  const isTmpFlagSelected = () => parsed.tmp;
18
19
  exports.isTmpFlagSelected = isTmpFlagSelected;
20
+ const isYesFlagSelected = () => parsed.yes;
21
+ exports.isYesFlagSelected = isYesFlagSelected;
22
+ const isNoTailwindFlagSelected = () => parsed['no-tailwind'];
23
+ exports.isNoTailwindFlagSelected = isNoTailwindFlagSelected;
19
24
  const getPositionalArguments = () => parsed._;
20
25
  exports.getPositionalArguments = getPositionalArguments;
21
26
  const getDirectoryArgument = () => {
@@ -30,6 +35,9 @@ const selectTemplate = async () => {
30
35
  if (exports.isFlagSelected) {
31
36
  return exports.isFlagSelected;
32
37
  }
38
+ if ((0, exports.isYesFlagSelected)()) {
39
+ throw new Error('A template must be specified when using --yes. Example: --yes --blank');
40
+ }
33
41
  return (await (0, prompts_1.selectAsync)({
34
42
  message: 'Choose a template:',
35
43
  optionsPerPage: 20,
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.438",
6
+ "version": "4.0.439",
7
7
  "description": "Create a new Remotion project",
8
8
  "main": "dist/index.js",
9
9
  "bin": {
@@ -30,7 +30,7 @@
30
30
  "@types/prompts": "^2.0.12",
31
31
  "@types/tar": "6.1.1",
32
32
  "react": "19.2.3",
33
- "@remotion/eslint-config-internal": "4.0.438",
33
+ "@remotion/eslint-config-internal": "4.0.439",
34
34
  "eslint": "9.19.0",
35
35
  "@typescript/native-preview": "7.0.0-dev.20260217.1"
36
36
  },