alex-c-line 1.1.6 → 1.2.0

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/index.cjs CHANGED
@@ -90,6 +90,9 @@ var check_lockfile_version_discrepancy_default = checkLockfileVersionDiscrepancy
90
90
 
91
91
  // src/commands/git-post-merge-cleanup.ts
92
92
  var import_execa2 = require("execa");
93
+ var import_promises = require("fs/promises");
94
+ var import_os = __toESM(require("os"), 1);
95
+ var import_path2 = __toESM(require("path"), 1);
93
96
 
94
97
  // src/utils/execa-helpers.ts
95
98
  var import_execa = require("execa");
@@ -101,7 +104,24 @@ function createExecaClientWithDefaultOptions(defaultOptions) {
101
104
 
102
105
  // src/commands/git-post-merge-cleanup.ts
103
106
  function gitPostMergeCleanup(program2) {
104
- program2.command("git-post-merge-cleanup").alias("git-cleanup").description("Run after merging into main to quickly clean up").option("--rebase", "Enable if your repository mainly rebases into main").action((_0) => __async(null, [_0], function* ({ rebase }) {
107
+ program2.command("git-post-merge-cleanup").alias("git-cleanup").description("Run after merging into main to quickly clean up").option("--rebase", "Enable if your repository mainly rebases into main").action((_0) => __async(null, [_0], function* ({ rebase: rebaseOption }) {
108
+ var _a, _b, _c;
109
+ let alexCLineConfigJSON;
110
+ try {
111
+ alexCLineConfigJSON = yield (0, import_promises.readFile)(
112
+ import_path2.default.join(
113
+ (_a = process.env.HOME) != null ? _a : import_os.default.homedir(),
114
+ "alex-c-line-config.json"
115
+ ),
116
+ "utf-8"
117
+ );
118
+ } catch (e) {
119
+ }
120
+ const alexCLineConfig = JSON.parse(alexCLineConfigJSON != null ? alexCLineConfigJSON : "{}");
121
+ const rebase = (_c = (_b = alexCLineConfig["git-post-merge-cleanup"]) == null ? void 0 : _b.rebase) != null ? _c : rebaseOption;
122
+ console.log(
123
+ `Running git-post-merge-cleanup in ${rebase ? "rebase" : "merge"} mode...`
124
+ );
105
125
  const { stdout: currentBranch } = yield import_execa2.execa`git branch --show-current`;
106
126
  if (currentBranch === "main") {
107
127
  console.error("\u274C ERROR: Cannot run cleanup on main branch!");
@@ -112,6 +132,7 @@ function gitPostMergeCleanup(program2) {
112
132
  stdio: "inherit"
113
133
  });
114
134
  if (rebase) {
135
+ console.log("Using rebase mode...");
115
136
  yield runCommandAndLogToConsole("git", ["fetch", "origin", "main"]);
116
137
  yield runCommandAndLogToConsole("git", ["pull", "origin", "main"]);
117
138
  }
package/dist/index.js CHANGED
@@ -69,6 +69,9 @@ var check_lockfile_version_discrepancy_default = checkLockfileVersionDiscrepancy
69
69
 
70
70
  // src/commands/git-post-merge-cleanup.ts
71
71
  import { execa as execa2, ExecaError } from "execa";
72
+ import { readFile } from "fs/promises";
73
+ import os from "os";
74
+ import path2 from "path";
72
75
 
73
76
  // src/utils/execa-helpers.ts
74
77
  import { execa } from "execa";
@@ -80,7 +83,24 @@ function createExecaClientWithDefaultOptions(defaultOptions) {
80
83
 
81
84
  // src/commands/git-post-merge-cleanup.ts
82
85
  function gitPostMergeCleanup(program2) {
83
- program2.command("git-post-merge-cleanup").alias("git-cleanup").description("Run after merging into main to quickly clean up").option("--rebase", "Enable if your repository mainly rebases into main").action((_0) => __async(null, [_0], function* ({ rebase }) {
86
+ program2.command("git-post-merge-cleanup").alias("git-cleanup").description("Run after merging into main to quickly clean up").option("--rebase", "Enable if your repository mainly rebases into main").action((_0) => __async(null, [_0], function* ({ rebase: rebaseOption }) {
87
+ var _a, _b, _c;
88
+ let alexCLineConfigJSON;
89
+ try {
90
+ alexCLineConfigJSON = yield readFile(
91
+ path2.join(
92
+ (_a = process.env.HOME) != null ? _a : os.homedir(),
93
+ "alex-c-line-config.json"
94
+ ),
95
+ "utf-8"
96
+ );
97
+ } catch (e) {
98
+ }
99
+ const alexCLineConfig = JSON.parse(alexCLineConfigJSON != null ? alexCLineConfigJSON : "{}");
100
+ const rebase = (_c = (_b = alexCLineConfig["git-post-merge-cleanup"]) == null ? void 0 : _b.rebase) != null ? _c : rebaseOption;
101
+ console.log(
102
+ `Running git-post-merge-cleanup in ${rebase ? "rebase" : "merge"} mode...`
103
+ );
84
104
  const { stdout: currentBranch } = yield execa2`git branch --show-current`;
85
105
  if (currentBranch === "main") {
86
106
  console.error("\u274C ERROR: Cannot run cleanup on main branch!");
@@ -91,6 +111,7 @@ function gitPostMergeCleanup(program2) {
91
111
  stdio: "inherit"
92
112
  });
93
113
  if (rebase) {
114
+ console.log("Using rebase mode...");
94
115
  yield runCommandAndLogToConsole("git", ["fetch", "origin", "main"]);
95
116
  yield runCommandAndLogToConsole("git", ["pull", "origin", "main"]);
96
117
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alex-c-line",
3
- "version": "1.1.6",
3
+ "version": "1.2.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",