@constructor-io/constructorio-connect-cli 1.12.1 → 1.12.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAMA,OAAO,EAAQ,OAAO,EAAM,MAAM,aAAa,CAAC;AAyBhD,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,OAAO;IACvC,MAAM,CAAC,WAAW,SAA4D;IAE9E,MAAM,CAAC,QAAQ,WAGb;IAEF,MAAM,CAAC,IAAI;;MAKT;IAEW,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;YA8BnB,UAAU;IAmBxB,OAAO,CAAC,oBAAoB;YAUd,UAAU;YAsBV,uBAAuB;WA6BvB,mBAAmB,CAC/B,MAAM,EAAE,MAAM,EACd,4BAA4B,EAAE,OAAO,GACpC,IAAI;IAcP,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAWjC,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAuBlC,OAAO,CAAC,0BAA0B;CA4BnC"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAMA,OAAO,EAAQ,OAAO,EAAM,MAAM,aAAa,CAAC;AA0BhD,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,OAAO;IACvC,MAAM,CAAC,WAAW,SAA4D;IAE9E,MAAM,CAAC,QAAQ,WAGb;IAEF,MAAM,CAAC,IAAI;;MAKT;IAEW,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;YAyCnB,UAAU;IAmBxB,OAAO,CAAC,oBAAoB;YAUd,UAAU;YAsBV,uBAAuB;WA6BvB,mBAAmB,CAC/B,MAAM,EAAE,MAAM,EACd,4BAA4B,EAAE,OAAO,GACpC,IAAI;IAcP,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAWjC,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAuBlC,OAAO,CAAC,0BAA0B;CA4BnC"}
@@ -49,6 +49,7 @@ const ux_action_1 = require("../helpers/ux-action");
49
49
  const get_connect_token_1 = require("../customer/get-connect-token");
50
50
  const render_tip_1 = require("../rendering/render-tip");
51
51
  const is_git_repo_initialized_1 = require("../helpers/is-git-repo-initialized");
52
+ const is_git_installed_1 = require("../helpers/is-git-installed");
52
53
  const BOILERPLATE_REPO_PATH = "../../boilerplate-repo";
53
54
  /**
54
55
  * This ensures that the path will be fixed in Windows, since we're using `path.join()` to build the path.
@@ -73,6 +74,11 @@ class Init extends core_1.Command {
73
74
  const { args } = await this.parse(Init);
74
75
  const repoPath = path.join(process.cwd(), args.name);
75
76
  core_1.ux.info([`👋 Welcome to the ${kleur_1.default.bold("Constructor.io Connect CLI")}!\n`].join("\n"));
77
+ const hasGit = (0, is_git_installed_1.isGitInstalled)();
78
+ if (!hasGit) {
79
+ core_1.ux.log(kleur_1.default.red("⚠️ Git is not installed"), kleur_1.default.bold("Please install Git and try again."), kleur_1.default.dim("\nYou can download it from:"), kleur_1.default.blue("https://git-scm.com/downloads"));
80
+ return;
81
+ }
76
82
  const connectAuthToken = await (0, get_connect_token_1.getConnectToken)(false);
77
83
  const newDirExists = fs_extra_1.default.existsSync(repoPath);
78
84
  if (!newDirExists) {
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Check if Git is installed
3
+ *
4
+ * This function attempts to run the 'git --version' command.
5
+ * It will return true if the command succeeds, indicating Git is installed.
6
+ * It will return false if the command fails for any reason (including Git not being in PATH,
7
+ * not installed, or any other error).
8
+ *
9
+ * This implementation works across different operating systems (Windows, macOS, Linux)
10
+ * as it simply relies on the command execution succeeding or failing.
11
+ *
12
+ * @returns true if Git is installed, false otherwise
13
+ */
14
+ export declare function isGitInstalled(): boolean;
15
+ //# sourceMappingURL=is-git-installed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-git-installed.d.ts","sourceRoot":"","sources":["../../src/helpers/is-git-installed.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAOxC"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isGitInstalled = isGitInstalled;
4
+ const child_process_1 = require("child_process");
5
+ // const envWithoutGit = { ...process.env, PATH: "" }; // for manually triggering the error pass this in as the second argument to execSync
6
+ /**
7
+ * Check if Git is installed
8
+ *
9
+ * This function attempts to run the 'git --version' command.
10
+ * It will return true if the command succeeds, indicating Git is installed.
11
+ * It will return false if the command fails for any reason (including Git not being in PATH,
12
+ * not installed, or any other error).
13
+ *
14
+ * This implementation works across different operating systems (Windows, macOS, Linux)
15
+ * as it simply relies on the command execution succeeding or failing.
16
+ *
17
+ * @returns true if Git is installed, false otherwise
18
+ */
19
+ function isGitInstalled() {
20
+ try {
21
+ (0, child_process_1.execSync)("git --version");
22
+ return true;
23
+ }
24
+ catch (error) {
25
+ return false;
26
+ }
27
+ }
package/dist/version.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- declare const _default: "1.12.1";
1
+ declare const _default: "1.12.2";
2
2
  export default _default;
3
3
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = '1.12.1';
3
+ exports.default = '1.12.2';
@@ -190,5 +190,5 @@
190
190
  ]
191
191
  }
192
192
  },
193
- "version": "1.12.1"
193
+ "version": "1.12.2"
194
194
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructor-io/constructorio-connect-cli",
3
- "version": "1.12.1",
3
+ "version": "1.12.2",
4
4
  "description": "CLI tool to enable users to interface with the Constructor Connect Ecosystem",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",