create-video 3.3.34 → 3.3.36

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.
Files changed (2) hide show
  1. package/dist/init.js +18 -11
  2. package/package.json +2 -2
package/dist/init.js CHANGED
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.init = exports.checkGitAvailability = void 0;
7
7
  const chalk_1 = __importDefault(require("chalk"));
8
8
  const execa_1 = __importDefault(require("execa"));
9
+ const os_1 = __importDefault(require("os"));
9
10
  const degit_1 = require("./degit");
10
11
  const latest_remotion_version_1 = require("./latest-remotion-version");
11
12
  const log_1 = require("./log");
@@ -15,7 +16,21 @@ const patch_readme_1 = require("./patch-readme");
15
16
  const pkg_managers_1 = require("./pkg-managers");
16
17
  const resolve_project_root_1 = require("./resolve-project-root");
17
18
  const select_template_1 = require("./select-template");
19
+ const binaryExists = (name) => {
20
+ const isWin = os_1.default.platform() === 'win32';
21
+ const where = isWin ? 'where' : 'which';
22
+ try {
23
+ execa_1.default.sync(where, [name]);
24
+ return true;
25
+ }
26
+ catch (err) {
27
+ return false;
28
+ }
29
+ };
18
30
  const checkGitAvailability = async (cwd, command) => {
31
+ if (!binaryExists(command)) {
32
+ return { type: 'git-not-installed' };
33
+ }
19
34
  try {
20
35
  const result = await (0, execa_1.default)(command, ['rev-parse', '--show-toplevel'], {
21
36
  cwd,
@@ -23,17 +38,9 @@ const checkGitAvailability = async (cwd, command) => {
23
38
  return { type: 'is-git-repo', location: result.stdout };
24
39
  }
25
40
  catch (e) {
26
- if (e.message.includes('not a git repository')) {
27
- return { type: 'no-git-repo' };
28
- }
29
- if (e.code === 'ENOENT') {
30
- return { type: 'git-not-installed' };
31
- }
32
- // win32
33
- if (e.stderr.includes('is not recognized')) {
34
- return { type: 'git-not-installed' };
35
- }
36
- throw e;
41
+ return {
42
+ type: 'no-git-repo',
43
+ };
37
44
  }
38
45
  };
39
46
  exports.checkGitAvailability = checkGitAvailability;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-video",
3
- "version": "3.3.34",
3
+ "version": "3.3.36",
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": "b078979b3e2f5cc4d240f112b827e7ef951aa318"
42
+ "gitHead": "623bf1e883e7b26b9d02458037c930ccbe8857e4"
43
43
  }