gitsu-cli 1.0.3 → 1.0.4

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
+ ## [1.0.4](https://github.com/jamieweavis/gitsu/compare/v1.0.3...v1.0.4) (2025-03-16)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * save local and global git configs ([37c6b96](https://github.com/jamieweavis/gitsu/commit/37c6b960dddc41c180c6f99ec0a3c6e9bfd600fe))
7
+
1
8
  ## [1.0.3](https://github.com/jamieweavis/gitsu/compare/v1.0.2...v1.0.3) (2025-03-16)
2
9
 
3
10
 
package/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitsu-cli",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Command line util for quickly & easily switching git users",
5
5
  "author": "Jamie Weavis",
6
6
  "homepage": "https://github.com/jamieweavis/gitsu#readme",
@@ -12,11 +12,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- const node_child_process_1 = __importDefault(require("node:child_process"));
15
+ const node_child_process_1 = require("node:child_process");
16
16
  const log_symbols_1 = __importDefault(require("log-symbols"));
17
17
  exports.default = (user) => __awaiter(void 0, void 0, void 0, function* () {
18
18
  try {
19
- yield node_child_process_1.default.exec(`git config --global user.name "${user.name}" && git config --global user.email "${user.email}"`);
19
+ // If user is in a git repo, save user to local git config
20
+ yield (0, node_child_process_1.exec)(`cd ${process.cwd()} && git config user.name "${user.name}" && git config user.email "${user.email}"`);
21
+ // Save user to global git config
22
+ yield (0, node_child_process_1.exec)(`git config --global user.name "${user.name}" && git config --global user.email "${user.email}"`);
20
23
  return true;
21
24
  }
22
25
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitsu-cli",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Command line util for quickly & easily switching git users",
5
5
  "author": "Jamie Weavis",
6
6
  "homepage": "https://github.com/jamieweavis/gitsu#readme",
@@ -1,14 +1,18 @@
1
- import child_process from 'node:child_process';
1
+ import { exec } from 'node:child_process';
2
2
  import logSymbols from 'log-symbols';
3
3
 
4
4
  import type { IUser } from '../types';
5
5
 
6
6
  export default async (user: IUser): Promise<boolean> => {
7
7
  try {
8
- await child_process.exec(
8
+ // If user is in a git repo, save user to local git config
9
+ await exec(
10
+ `cd ${process.cwd()} && git config user.name "${user.name}" && git config user.email "${user.email}"`,
11
+ );
12
+ // Save user to global git config
13
+ await exec(
9
14
  `git config --global user.name "${user.name}" && git config --global user.email "${user.email}"`,
10
15
  );
11
-
12
16
  return true;
13
17
  } catch (error) {
14
18
  console.error(`${logSymbols.error} Failed to save git config`, error);