create-video 4.0.381 → 4.0.383
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 +3 -1
- package/dist/resolve-project-root.js +36 -17
- package/package.json +3 -3
package/dist/init.js
CHANGED
|
@@ -148,7 +148,9 @@ const init = async () => {
|
|
|
148
148
|
log_1.Log.info(`Copied to ${chalk_1.default.blue(cdToFolder)}.`);
|
|
149
149
|
log_1.Log.info();
|
|
150
150
|
log_1.Log.info('Get started by running:');
|
|
151
|
-
|
|
151
|
+
if (cdToFolder !== '') {
|
|
152
|
+
log_1.Log.info(' ' + chalk_1.default.blue(`cd ${cdToFolder}`));
|
|
153
|
+
}
|
|
152
154
|
log_1.Log.info(' ' + chalk_1.default.blue((0, pkg_managers_1.getInstallCommand)(pkgManager)));
|
|
153
155
|
log_1.Log.info(' ' + chalk_1.default.blue((0, pkg_managers_1.getDevCommand)(pkgManager, selectedTemplate)));
|
|
154
156
|
log_1.Log.info('');
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.resolveProjectRoot = void 0;
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
8
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
|
+
const promises_1 = require("node:fs/promises");
|
|
9
10
|
const node_os_1 = require("node:os");
|
|
10
11
|
const node_path_1 = __importDefault(require("node:path"));
|
|
11
12
|
const log_1 = require("./log");
|
|
@@ -41,6 +42,7 @@ const resolveProjectRoot = async (options) => {
|
|
|
41
42
|
return { projectRoot: randomRoot, folderName: randomName };
|
|
42
43
|
}
|
|
43
44
|
let projectName = '';
|
|
45
|
+
let directlyCreateInCurrentDir = false;
|
|
44
46
|
// If a directory argument was provided, use it directly
|
|
45
47
|
if (options === null || options === void 0 ? void 0 : options.directoryArgument) {
|
|
46
48
|
projectName = options.directoryArgument;
|
|
@@ -52,21 +54,35 @@ const resolveProjectRoot = async (options) => {
|
|
|
52
54
|
log_1.Log.info();
|
|
53
55
|
}
|
|
54
56
|
try {
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
57
|
+
const currentMs = Date.now();
|
|
58
|
+
const hour = 60 * 60 * 1000;
|
|
59
|
+
const dirCreateMs = (await (0, promises_1.stat)(process.cwd())).ctimeMs;
|
|
60
|
+
const fileList = await (0, promises_1.readdir)(process.cwd());
|
|
61
|
+
const fileCount = fileList.filter((f) => !f.startsWith('.')).length;
|
|
62
|
+
if (fileCount === 0 && currentMs - dirCreateMs < hour) {
|
|
63
|
+
// User seems to have created a new directory which is empty, and cd'd into it. Let's create the project here!
|
|
64
|
+
directlyCreateInCurrentDir = true;
|
|
65
|
+
}
|
|
66
|
+
if (directlyCreateInCurrentDir) {
|
|
67
|
+
projectName = process.cwd();
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
const { answer } = await (0, prompts_1.default)({
|
|
71
|
+
type: 'text',
|
|
72
|
+
name: 'answer',
|
|
73
|
+
message: 'Directory to create your project',
|
|
74
|
+
initial: 'my-video',
|
|
75
|
+
validate: (name) => {
|
|
76
|
+
const validation = (0, validate_name_1.validateName)(node_path_1.default.basename(node_path_1.default.resolve(name)));
|
|
77
|
+
if (typeof validation === 'string') {
|
|
78
|
+
return 'Invalid project name: ' + validation;
|
|
79
|
+
}
|
|
80
|
+
return true;
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
if (typeof answer === 'string') {
|
|
84
|
+
projectName = answer.trim();
|
|
85
|
+
}
|
|
70
86
|
}
|
|
71
87
|
}
|
|
72
88
|
catch (error) {
|
|
@@ -78,8 +94,11 @@ const resolveProjectRoot = async (options) => {
|
|
|
78
94
|
}
|
|
79
95
|
const projectRoot = node_path_1.default.resolve(projectName);
|
|
80
96
|
const folderName = node_path_1.default.basename(projectRoot);
|
|
81
|
-
|
|
82
|
-
|
|
97
|
+
if (!directlyCreateInCurrentDir) {
|
|
98
|
+
// if a folder is already created, no point of checking if it's valid
|
|
99
|
+
assertValidName(folderName);
|
|
100
|
+
(0, mkdirp_1.mkdirp)(projectRoot);
|
|
101
|
+
}
|
|
83
102
|
if (assertFolderEmptyAsync(projectRoot).exists) {
|
|
84
103
|
return (0, exports.resolveProjectRoot)(options);
|
|
85
104
|
}
|
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.
|
|
6
|
+
"version": "4.0.383",
|
|
7
7
|
"description": "Create a new Remotion project",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"bin": {
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"@types/minimist": "1.2.2",
|
|
29
29
|
"@types/prompts": "^2.0.12",
|
|
30
30
|
"@types/tar": "6.1.1",
|
|
31
|
-
"react": "19.
|
|
32
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
31
|
+
"react": "19.2.1",
|
|
32
|
+
"@remotion/eslint-config-internal": "4.0.383",
|
|
33
33
|
"eslint": "9.19.0"
|
|
34
34
|
},
|
|
35
35
|
"exports": {
|