@speedkit/cli 2.47.0 → 2.47.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [2.47.1](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.47.0...v2.47.1) (2024-07-24)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **diff-service:** resolve escaped spaces issue for macos ([1cf2d57](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/1cf2d577ab4ba15f3bd53394d95b2fa53e28fcd5))
7
+
1
8
  # [2.47.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.46.0...v2.47.0) (2024-07-24)
2
9
 
3
10
 
package/README.md CHANGED
@@ -21,7 +21,7 @@ $ npm install -g @speedkit/cli
21
21
  $ sk COMMAND
22
22
  running command...
23
23
  $ sk (--version)
24
- @speedkit/cli/2.47.0 linux-x64 node-v20.15.1
24
+ @speedkit/cli/2.47.1 linux-x64 node-v20.15.1
25
25
  $ sk --help [COMMAND]
26
26
  USAGE
27
27
  $ sk COMMAND
@@ -39,3 +39,9 @@ export declare function transformNoValueParameters(url: URL, manipulatedUrl: URL
39
39
  * @returns The normalized URL.
40
40
  */
41
41
  export declare function normalize(urlString: string, withParameterSorting: boolean): string;
42
+ /**
43
+ * Remove backslashes before spaces from given string.
44
+ *
45
+ * @param string_
46
+ */
47
+ export declare function unescapeSpaces(string_: string): string;
@@ -4,6 +4,7 @@ exports.sortParameters = sortParameters;
4
4
  exports.convertNotEncodedParameters = convertNotEncodedParameters;
5
5
  exports.transformNoValueParameters = transformNoValueParameters;
6
6
  exports.normalize = normalize;
7
+ exports.unescapeSpaces = unescapeSpaces;
7
8
  const node_url_1 = require("node:url");
8
9
  /**
9
10
  * Sorts all urls params manually.
@@ -113,3 +114,11 @@ function normalize(urlString, withParameterSorting) {
113
114
  transformNoValueParameters(new node_url_1.URL(urlString), url);
114
115
  return url.toString();
115
116
  }
117
+ /**
118
+ * Remove backslashes before spaces from given string.
119
+ *
120
+ * @param string_
121
+ */
122
+ function unescapeSpaces(string_) {
123
+ return string_.replaceAll("\\ ", " ");
124
+ }
@@ -0,0 +1 @@
1
+ export declare const DEFAULT_INTELLIJ_IDEA_PATH_MACOS = "/Applications/IntelliJ IDEA.app/Contents/MacOS";
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_INTELLIJ_IDEA_PATH_MACOS = void 0;
4
+ exports.DEFAULT_INTELLIJ_IDEA_PATH_MACOS = "/Applications/IntelliJ IDEA.app/Contents/MacOS";
@@ -6,6 +6,8 @@ const node_path_1 = tslib_1.__importDefault(require("node:path"));
6
6
  const promises_1 = tslib_1.__importStar(require("node:fs/promises"));
7
7
  const node_child_process_1 = require("node:child_process");
8
8
  const file_helper_1 = require("../../helpers/file-helper");
9
+ const normalize_1 = require("../../helpers/normalize");
10
+ const os_1 = require("../../models/os");
9
11
  class DiffService {
10
12
  cli;
11
13
  diffExecutablePath;
@@ -113,10 +115,11 @@ class DiffService {
113
115
  }
114
116
  return false;
115
117
  }
116
- const isWindows = process.platform.startsWith("win");
117
118
  let ideaCommandAvailable;
118
119
  try {
119
- (0, node_child_process_1.execSync)(`idea diff "${localPath}" "${remotePath}"`);
120
+ (0, node_child_process_1.execSync)(`idea diff "${localPath}" "${remotePath}"`, {
121
+ stdio: ["pipe", "ignore", "pipe"], // prevent output of "/bin/sh: idea: command not found"
122
+ });
120
123
  ideaCommandAvailable = true;
121
124
  }
122
125
  catch {
@@ -124,17 +127,20 @@ class DiffService {
124
127
  }
125
128
  try {
126
129
  if (!ideaCommandAvailable) {
130
+ const isWindows = process.platform.startsWith("win");
127
131
  if (isWindows) {
128
132
  (0, node_child_process_1.execSync)(`"%IDEA_INITIAL_DIRECTORY%\\idea" diff ${localPath} ${remotePath}`, { stdio: "pipe" });
129
133
  }
130
134
  else {
131
- (0, node_child_process_1.execSync)(`"$IDEA_INITIAL_DIRECTORY/idea" diff ${localPath} ${remotePath}`, { stdio: "pipe" });
135
+ const ideaInitialDirectory = (0, normalize_1.unescapeSpaces)(process.env.IDEA_INITIAL_DIRECTORY ||
136
+ os_1.DEFAULT_INTELLIJ_IDEA_PATH_MACOS);
137
+ (0, node_child_process_1.execSync)(`"${ideaInitialDirectory}/idea" diff ${localPath} ${remotePath}`, { stdio: "pipe" });
132
138
  }
133
139
  }
134
140
  return false;
135
141
  }
136
142
  catch (error) {
137
- this.cli.writeError(`Error executing diff command: ${error.message}`);
143
+ this.cli.writeError(`Error executing diff command: ${error.message} (diff/diff-service)`);
138
144
  return false;
139
145
  }
140
146
  }
@@ -6,6 +6,8 @@ const fs = tslib_1.__importStar(require("node:fs/promises"));
6
6
  const node_child_process_1 = require("node:child_process");
7
7
  const node_path_1 = tslib_1.__importDefault(require("node:path"));
8
8
  const file_helper_1 = require("../helpers/file-helper");
9
+ const normalize_1 = require("../helpers/normalize");
10
+ const os_1 = require("../models/os");
9
11
  /**
10
12
  * @deprecated
11
13
  */
@@ -86,10 +88,11 @@ class DiffService {
86
88
  else if (hide) {
87
89
  return true;
88
90
  }
89
- const isWindows = process.platform.startsWith("win");
90
91
  let ideaCommandAvailable;
91
92
  try {
92
- (0, node_child_process_1.execSync)(`idea diff "${filePath1}" "${filePath2}"`, { stdio: "pipe" });
93
+ (0, node_child_process_1.execSync)(`idea diff "${filePath1}" "${filePath2}"`, {
94
+ stdio: ["pipe", "ignore", "pipe"], // prevent output of "/bin/sh: idea: command not found"
95
+ });
93
96
  ideaCommandAvailable = true;
94
97
  }
95
98
  catch {
@@ -97,16 +100,19 @@ class DiffService {
97
100
  }
98
101
  try {
99
102
  if (!ideaCommandAvailable) {
103
+ const isWindows = process.platform.startsWith("win");
100
104
  if (isWindows) {
101
105
  (0, node_child_process_1.execSync)(`"%IDEA_INITIAL_DIRECTORY%\\idea" diff ${filePath1} ${filePath2}`, { stdio: "pipe" });
102
106
  }
103
107
  else {
104
- (0, node_child_process_1.execSync)(`"$IDEA_INITIAL_DIRECTORY/idea" diff ${filePath1} ${filePath2}`, { stdio: "pipe" });
108
+ const ideaInitialDirectory = (0, normalize_1.unescapeSpaces)(process.env.IDEA_INITIAL_DIRECTORY ||
109
+ os_1.DEFAULT_INTELLIJ_IDEA_PATH_MACOS);
110
+ (0, node_child_process_1.execSync)(`"${ideaInitialDirectory}/idea" diff ${filePath1} ${filePath2}`, { stdio: "pipe" });
105
111
  }
106
112
  }
107
113
  }
108
114
  catch (error) {
109
- this.cli.writeError(`Error executing diff command: ${error.message}`);
115
+ this.cli.writeError(`Error executing diff command: ${error.message} (services/diff-service)`);
110
116
  this.cli.exit(1);
111
117
  }
112
118
  return true;
@@ -712,5 +712,5 @@
712
712
  ]
713
713
  }
714
714
  },
715
- "version": "2.47.0"
715
+ "version": "2.47.1"
716
716
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@speedkit/cli",
3
3
  "description": "Speed Kit CLI",
4
- "version": "2.47.0",
4
+ "version": "2.47.1",
5
5
  "author": {
6
6
  "name": "Baqend.com",
7
7
  "email": "info@baqend.com"