create-video 3.3.33 → 3.3.35
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.d.ts +8 -0
- package/dist/init.js +29 -10
- package/dist/test/git-status.test.d.ts +1 -0
- package/dist/test/git-status.test.js +24 -0
- package/package.json +2 -2
package/dist/init.d.ts
CHANGED
package/dist/init.js
CHANGED
|
@@ -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.init = void 0;
|
|
6
|
+
exports.init = exports.checkGitAvailability = void 0;
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
8
|
const execa_1 = __importDefault(require("execa"));
|
|
9
9
|
const degit_1 = require("./degit");
|
|
@@ -15,19 +15,29 @@ const patch_readme_1 = require("./patch-readme");
|
|
|
15
15
|
const pkg_managers_1 = require("./pkg-managers");
|
|
16
16
|
const resolve_project_root_1 = require("./resolve-project-root");
|
|
17
17
|
const select_template_1 = require("./select-template");
|
|
18
|
-
const
|
|
18
|
+
const checkGitAvailability = async (cwd, command) => {
|
|
19
19
|
try {
|
|
20
|
-
await (0, execa_1.default)('
|
|
21
|
-
|
|
20
|
+
const result = await (0, execa_1.default)(command, ['rev-parse', '--show-toplevel'], {
|
|
21
|
+
cwd,
|
|
22
|
+
});
|
|
23
|
+
return { type: 'is-git-repo', location: result.stdout };
|
|
22
24
|
}
|
|
23
25
|
catch (e) {
|
|
24
|
-
if (e.
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
if (e.message.toLowerCase().includes('not a git repository')) {
|
|
27
|
+
return { type: 'no-git-repo' };
|
|
28
|
+
}
|
|
29
|
+
if (e.code === 'ENOENT') {
|
|
30
|
+
return { type: 'git-not-installed' };
|
|
27
31
|
}
|
|
32
|
+
// win32
|
|
33
|
+
if (e.stderr.includes('is not recognized')) {
|
|
34
|
+
return { type: 'git-not-installed' };
|
|
35
|
+
}
|
|
36
|
+
throw e;
|
|
28
37
|
}
|
|
29
38
|
};
|
|
30
|
-
|
|
39
|
+
exports.checkGitAvailability = checkGitAvailability;
|
|
40
|
+
const getGitStatus = async (root) => {
|
|
31
41
|
// not in git tree, so let's init
|
|
32
42
|
try {
|
|
33
43
|
await (0, execa_1.default)('git', ['init'], { cwd: root });
|
|
@@ -49,8 +59,17 @@ const initGitRepoAsync = async (root) => {
|
|
|
49
59
|
};
|
|
50
60
|
const init = async () => {
|
|
51
61
|
var _a, _b, _c, _d, _e, _f;
|
|
62
|
+
const result = await (0, exports.checkGitAvailability)(process.cwd(), 'git');
|
|
63
|
+
if (result.type === 'git-not-installed') {
|
|
64
|
+
log_1.Log.error('Git is not installed or not in the path. Install Git to continue.');
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
if (result.type === 'is-git-repo') {
|
|
68
|
+
log_1.Log.error(`You are already inside a Git repo (${result.location}).`);
|
|
69
|
+
log_1.Log.error('Create a Remotion project somewhere else.');
|
|
70
|
+
process.exit(1);
|
|
71
|
+
}
|
|
52
72
|
const [projectRoot, folderName] = await (0, resolve_project_root_1.resolveProjectRoot)();
|
|
53
|
-
await isGitExecutableAvailable();
|
|
54
73
|
const latestRemotionVersionPromise = (0, latest_remotion_version_1.getLatestRemotionVersion)();
|
|
55
74
|
const selectedTemplate = await (0, select_template_1.selectTemplate)();
|
|
56
75
|
const pkgManager = (0, pkg_managers_1.selectPackageManager)();
|
|
@@ -111,7 +130,7 @@ const init = async () => {
|
|
|
111
130
|
(_f = promise.stdout) === null || _f === void 0 ? void 0 : _f.pipe(process.stdout);
|
|
112
131
|
await promise;
|
|
113
132
|
}
|
|
114
|
-
await
|
|
133
|
+
await getGitStatus(projectRoot);
|
|
115
134
|
log_1.Log.info();
|
|
116
135
|
log_1.Log.info(`Welcome to ${chalk_1.default.blueBright('Remotion')}!`);
|
|
117
136
|
log_1.Log.info(`✨ Your video has been created at ${chalk_1.default.blueBright(folderName)}.`);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
const path_1 = __importDefault(require("path"));
|
|
7
|
+
const vitest_1 = require("vitest");
|
|
8
|
+
const init_1 = require("../init");
|
|
9
|
+
(0, vitest_1.test)('Get git status', async () => {
|
|
10
|
+
const status = await (0, init_1.checkGitAvailability)(process.cwd(), 'git');
|
|
11
|
+
(0, vitest_1.expect)(status).toEqual({
|
|
12
|
+
type: 'is-git-repo',
|
|
13
|
+
location: path_1.default.posix
|
|
14
|
+
.join(__dirname, '..', '..', '..', '..')
|
|
15
|
+
.replace(/\\/g, '/'),
|
|
16
|
+
});
|
|
17
|
+
if (status.type !== 'is-git-repo') {
|
|
18
|
+
throw new Error('is git repo');
|
|
19
|
+
}
|
|
20
|
+
const status2 = await (0, init_1.checkGitAvailability)(path_1.default.dirname(status.location), 'git');
|
|
21
|
+
(0, vitest_1.expect)(status2).toEqual({ type: 'no-git-repo' });
|
|
22
|
+
const status3 = await (0, init_1.checkGitAvailability)(path_1.default.dirname(status.location), 'wronggitbinary');
|
|
23
|
+
(0, vitest_1.expect)(status3).toEqual({ type: 'git-not-installed' });
|
|
24
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-video",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.35",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"typescript": "^4.7.0",
|
|
40
40
|
"vitest": "0.24.3"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "92344ca937e4c51b8484f79528e3c38d598f7053"
|
|
43
43
|
}
|