alex-c-line 1.5.2 → 1.5.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/dist/index.cjs +30 -20
- package/dist/index.js +30 -20
- package/package.json +36 -24
package/dist/index.cjs
CHANGED
|
@@ -80,7 +80,7 @@ function checkForFileDependencies(program2) {
|
|
|
80
80
|
"Check for existence of file dependencies in package.json and give exit code 1 if such dependencies are found"
|
|
81
81
|
).action(() => __async(null, null, function* () {
|
|
82
82
|
var _a, _b, _c;
|
|
83
|
-
console.
|
|
83
|
+
console.info("Checking for file dependencies...");
|
|
84
84
|
const { dependencies, devDependencies, peerDependencies } = JSON.parse(
|
|
85
85
|
yield (0, import_promises.readFile)(import_path.default.resolve(process.cwd(), "package.json"), "utf-8")
|
|
86
86
|
);
|
|
@@ -103,7 +103,7 @@ function checkForFileDependencies(program2) {
|
|
|
103
103
|
console.error(JSON.stringify(allFileDependencies, void 0, 2));
|
|
104
104
|
process.exit(1);
|
|
105
105
|
}
|
|
106
|
-
console.
|
|
106
|
+
console.info("No file dependencies found!");
|
|
107
107
|
process.exit(0);
|
|
108
108
|
}));
|
|
109
109
|
}
|
|
@@ -114,7 +114,7 @@ var import_fs = require("fs");
|
|
|
114
114
|
var import_path2 = __toESM(require("path"), 1);
|
|
115
115
|
function checkLockfileVersionDiscrepancy(program2) {
|
|
116
116
|
program2.command("check-lockfile-version-discrepancy").description("Check that version numbers in package.json and package-lock.json match").action(() => {
|
|
117
|
-
console.
|
|
117
|
+
console.info("Checking for package.json and package-lock.json discrepancies...");
|
|
118
118
|
const { version: packageVersion } = JSON.parse(
|
|
119
119
|
(0, import_fs.readFileSync)(import_path2.default.resolve(process.cwd(), "package.json"), "utf-8")
|
|
120
120
|
);
|
|
@@ -128,7 +128,7 @@ function checkLockfileVersionDiscrepancy(program2) {
|
|
|
128
128
|
process.exitCode = 1;
|
|
129
129
|
return;
|
|
130
130
|
}
|
|
131
|
-
console.
|
|
131
|
+
console.info("package.json and package-lock.json versions in sync.");
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
134
|
var check_lockfile_version_discrepancy_default = checkLockfileVersionDiscrepancy;
|
|
@@ -160,10 +160,10 @@ function execaNoFail(command, args, options) {
|
|
|
160
160
|
|
|
161
161
|
// src/commands/check-version-number-change.ts
|
|
162
162
|
function checkVersionNumberChange(program2) {
|
|
163
|
-
|
|
163
|
+
program2.command("check-version-number-change").description(
|
|
164
164
|
"Check that version number on branch has changed if source code differs between main and current branch"
|
|
165
165
|
).action(() => __async(null, null, function* () {
|
|
166
|
-
console.
|
|
166
|
+
console.info("Checking for version change...");
|
|
167
167
|
const { exitCode } = yield execaNoFail("git", [
|
|
168
168
|
"diff",
|
|
169
169
|
"origin/main...HEAD",
|
|
@@ -171,7 +171,7 @@ function checkVersionNumberChange(program2) {
|
|
|
171
171
|
"src/*"
|
|
172
172
|
]);
|
|
173
173
|
if (exitCode === 0) {
|
|
174
|
-
console.
|
|
174
|
+
console.info("No source code changes found. Version does not need changing.");
|
|
175
175
|
process.exit(0);
|
|
176
176
|
}
|
|
177
177
|
const { stdout: packageContents } = yield import_execa2.execa`git show origin/main:package.json`;
|
|
@@ -196,7 +196,7 @@ function checkVersionNumberChange(program2) {
|
|
|
196
196
|
);
|
|
197
197
|
process.exit(1);
|
|
198
198
|
}
|
|
199
|
-
console.
|
|
199
|
+
console.info("Version has been updated!");
|
|
200
200
|
}));
|
|
201
201
|
}
|
|
202
202
|
var check_version_number_change_default = checkVersionNumberChange;
|
|
@@ -230,7 +230,7 @@ function editEnv(program2) {
|
|
|
230
230
|
`${(0, import_dotenv_stringify.default)(currentEnvFileContents)}
|
|
231
231
|
`
|
|
232
232
|
);
|
|
233
|
-
console.
|
|
233
|
+
console.info(".env file updated");
|
|
234
234
|
}));
|
|
235
235
|
}
|
|
236
236
|
var edit_env_default = editEnv;
|
|
@@ -256,7 +256,7 @@ function gitPostMergeCleanup(program2) {
|
|
|
256
256
|
}
|
|
257
257
|
const alexCLineConfig = JSON.parse(alexCLineConfigJSON);
|
|
258
258
|
const rebase = (_c = (_b = alexCLineConfig["git-post-merge-cleanup"]) == null ? void 0 : _b.rebase) != null ? _c : rebaseOption;
|
|
259
|
-
console.
|
|
259
|
+
console.info(`Running git-post-merge-cleanup in ${rebase ? "rebase" : "merge"} mode...`);
|
|
260
260
|
const { stdout: currentBranch } = yield import_execa3.execa`git branch --show-current`;
|
|
261
261
|
if (currentBranch === "main") {
|
|
262
262
|
console.error("\u274C ERROR: Cannot run cleanup on main branch!");
|
|
@@ -284,7 +284,7 @@ function gitPostMergeCleanup(program2) {
|
|
|
284
284
|
} else {
|
|
285
285
|
try {
|
|
286
286
|
const { stdout: branchDeletedMessage } = yield import_execa3.execa`git branch --delete ${currentBranch}`;
|
|
287
|
-
console.
|
|
287
|
+
console.info(branchDeletedMessage);
|
|
288
288
|
} catch (error) {
|
|
289
289
|
if (error instanceof import_execa3.ExecaError) {
|
|
290
290
|
console.error("\u274C ERROR: Changes on branch not fully merged!");
|
|
@@ -301,21 +301,31 @@ var git_post_merge_cleanup_default = gitPostMergeCleanup;
|
|
|
301
301
|
// src/commands/say-hello.ts
|
|
302
302
|
function sayHello(program2) {
|
|
303
303
|
program2.command("say-hello").description("Quick test command").action(() => {
|
|
304
|
-
console.
|
|
304
|
+
console.info("Hello!");
|
|
305
305
|
});
|
|
306
306
|
}
|
|
307
307
|
var say_hello_default = sayHello;
|
|
308
308
|
|
|
309
|
+
// src/utils/loadCommands.ts
|
|
310
|
+
function loadCommands(program2, commandMap) {
|
|
311
|
+
for (const loader of Object.values(commandMap)) {
|
|
312
|
+
loader(program2);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
var loadCommands_default = loadCommands;
|
|
316
|
+
|
|
309
317
|
// src/commands/index.ts
|
|
310
|
-
function
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
318
|
+
function createCommands(program2) {
|
|
319
|
+
loadCommands_default(program2, {
|
|
320
|
+
checkForFileDependencies: check_for_file_dependencies_default,
|
|
321
|
+
checkLockfileVersionDiscrepancy: check_lockfile_version_discrepancy_default,
|
|
322
|
+
checkVersionNumberChange: check_version_number_change_default,
|
|
323
|
+
editEnv: edit_env_default,
|
|
324
|
+
gitPostMergeCleanup: git_post_merge_cleanup_default,
|
|
325
|
+
sayHello: say_hello_default
|
|
326
|
+
});
|
|
317
327
|
}
|
|
318
|
-
var commands_default =
|
|
328
|
+
var commands_default = createCommands;
|
|
319
329
|
|
|
320
330
|
// src/index.ts
|
|
321
331
|
var program = new import_commander.Command();
|
package/dist/index.js
CHANGED
|
@@ -59,7 +59,7 @@ function checkForFileDependencies(program2) {
|
|
|
59
59
|
"Check for existence of file dependencies in package.json and give exit code 1 if such dependencies are found"
|
|
60
60
|
).action(() => __async(null, null, function* () {
|
|
61
61
|
var _a, _b, _c;
|
|
62
|
-
console.
|
|
62
|
+
console.info("Checking for file dependencies...");
|
|
63
63
|
const { dependencies, devDependencies, peerDependencies } = JSON.parse(
|
|
64
64
|
yield readFile(path.resolve(process.cwd(), "package.json"), "utf-8")
|
|
65
65
|
);
|
|
@@ -82,7 +82,7 @@ function checkForFileDependencies(program2) {
|
|
|
82
82
|
console.error(JSON.stringify(allFileDependencies, void 0, 2));
|
|
83
83
|
process.exit(1);
|
|
84
84
|
}
|
|
85
|
-
console.
|
|
85
|
+
console.info("No file dependencies found!");
|
|
86
86
|
process.exit(0);
|
|
87
87
|
}));
|
|
88
88
|
}
|
|
@@ -93,7 +93,7 @@ import { readFileSync } from "fs";
|
|
|
93
93
|
import path2 from "path";
|
|
94
94
|
function checkLockfileVersionDiscrepancy(program2) {
|
|
95
95
|
program2.command("check-lockfile-version-discrepancy").description("Check that version numbers in package.json and package-lock.json match").action(() => {
|
|
96
|
-
console.
|
|
96
|
+
console.info("Checking for package.json and package-lock.json discrepancies...");
|
|
97
97
|
const { version: packageVersion } = JSON.parse(
|
|
98
98
|
readFileSync(path2.resolve(process.cwd(), "package.json"), "utf-8")
|
|
99
99
|
);
|
|
@@ -107,7 +107,7 @@ function checkLockfileVersionDiscrepancy(program2) {
|
|
|
107
107
|
process.exitCode = 1;
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
110
|
-
console.
|
|
110
|
+
console.info("package.json and package-lock.json versions in sync.");
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
113
|
var check_lockfile_version_discrepancy_default = checkLockfileVersionDiscrepancy;
|
|
@@ -139,10 +139,10 @@ function execaNoFail(command, args, options) {
|
|
|
139
139
|
|
|
140
140
|
// src/commands/check-version-number-change.ts
|
|
141
141
|
function checkVersionNumberChange(program2) {
|
|
142
|
-
|
|
142
|
+
program2.command("check-version-number-change").description(
|
|
143
143
|
"Check that version number on branch has changed if source code differs between main and current branch"
|
|
144
144
|
).action(() => __async(null, null, function* () {
|
|
145
|
-
console.
|
|
145
|
+
console.info("Checking for version change...");
|
|
146
146
|
const { exitCode } = yield execaNoFail("git", [
|
|
147
147
|
"diff",
|
|
148
148
|
"origin/main...HEAD",
|
|
@@ -150,7 +150,7 @@ function checkVersionNumberChange(program2) {
|
|
|
150
150
|
"src/*"
|
|
151
151
|
]);
|
|
152
152
|
if (exitCode === 0) {
|
|
153
|
-
console.
|
|
153
|
+
console.info("No source code changes found. Version does not need changing.");
|
|
154
154
|
process.exit(0);
|
|
155
155
|
}
|
|
156
156
|
const { stdout: packageContents } = yield execa2`git show origin/main:package.json`;
|
|
@@ -175,7 +175,7 @@ function checkVersionNumberChange(program2) {
|
|
|
175
175
|
);
|
|
176
176
|
process.exit(1);
|
|
177
177
|
}
|
|
178
|
-
console.
|
|
178
|
+
console.info("Version has been updated!");
|
|
179
179
|
}));
|
|
180
180
|
}
|
|
181
181
|
var check_version_number_change_default = checkVersionNumberChange;
|
|
@@ -209,7 +209,7 @@ function editEnv(program2) {
|
|
|
209
209
|
`${dotenvStringify(currentEnvFileContents)}
|
|
210
210
|
`
|
|
211
211
|
);
|
|
212
|
-
console.
|
|
212
|
+
console.info(".env file updated");
|
|
213
213
|
}));
|
|
214
214
|
}
|
|
215
215
|
var edit_env_default = editEnv;
|
|
@@ -235,7 +235,7 @@ function gitPostMergeCleanup(program2) {
|
|
|
235
235
|
}
|
|
236
236
|
const alexCLineConfig = JSON.parse(alexCLineConfigJSON);
|
|
237
237
|
const rebase = (_c = (_b = alexCLineConfig["git-post-merge-cleanup"]) == null ? void 0 : _b.rebase) != null ? _c : rebaseOption;
|
|
238
|
-
console.
|
|
238
|
+
console.info(`Running git-post-merge-cleanup in ${rebase ? "rebase" : "merge"} mode...`);
|
|
239
239
|
const { stdout: currentBranch } = yield execa3`git branch --show-current`;
|
|
240
240
|
if (currentBranch === "main") {
|
|
241
241
|
console.error("\u274C ERROR: Cannot run cleanup on main branch!");
|
|
@@ -263,7 +263,7 @@ function gitPostMergeCleanup(program2) {
|
|
|
263
263
|
} else {
|
|
264
264
|
try {
|
|
265
265
|
const { stdout: branchDeletedMessage } = yield execa3`git branch --delete ${currentBranch}`;
|
|
266
|
-
console.
|
|
266
|
+
console.info(branchDeletedMessage);
|
|
267
267
|
} catch (error) {
|
|
268
268
|
if (error instanceof ExecaError2) {
|
|
269
269
|
console.error("\u274C ERROR: Changes on branch not fully merged!");
|
|
@@ -280,21 +280,31 @@ var git_post_merge_cleanup_default = gitPostMergeCleanup;
|
|
|
280
280
|
// src/commands/say-hello.ts
|
|
281
281
|
function sayHello(program2) {
|
|
282
282
|
program2.command("say-hello").description("Quick test command").action(() => {
|
|
283
|
-
console.
|
|
283
|
+
console.info("Hello!");
|
|
284
284
|
});
|
|
285
285
|
}
|
|
286
286
|
var say_hello_default = sayHello;
|
|
287
287
|
|
|
288
|
+
// src/utils/loadCommands.ts
|
|
289
|
+
function loadCommands(program2, commandMap) {
|
|
290
|
+
for (const loader of Object.values(commandMap)) {
|
|
291
|
+
loader(program2);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
var loadCommands_default = loadCommands;
|
|
295
|
+
|
|
288
296
|
// src/commands/index.ts
|
|
289
|
-
function
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
297
|
+
function createCommands(program2) {
|
|
298
|
+
loadCommands_default(program2, {
|
|
299
|
+
checkForFileDependencies: check_for_file_dependencies_default,
|
|
300
|
+
checkLockfileVersionDiscrepancy: check_lockfile_version_discrepancy_default,
|
|
301
|
+
checkVersionNumberChange: check_version_number_change_default,
|
|
302
|
+
editEnv: edit_env_default,
|
|
303
|
+
gitPostMergeCleanup: git_post_merge_cleanup_default,
|
|
304
|
+
sayHello: say_hello_default
|
|
305
|
+
});
|
|
296
306
|
}
|
|
297
|
-
var commands_default =
|
|
307
|
+
var commands_default = createCommands;
|
|
298
308
|
|
|
299
309
|
// src/index.ts
|
|
300
310
|
var program = new Command();
|
package/package.json
CHANGED
|
@@ -1,51 +1,63 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "alex-c-line",
|
|
3
|
-
"version": "1.5.
|
|
4
|
-
"description": "",
|
|
3
|
+
"version": "1.5.4",
|
|
4
|
+
"description": "Command-line tool with commands to streamline the developer workflow",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/AlexMan123456/alex-c-line.git"
|
|
8
|
+
},
|
|
9
|
+
"license": "ISC",
|
|
10
|
+
"author": "alextheman",
|
|
11
|
+
"type": "module",
|
|
5
12
|
"main": "dist/index.js",
|
|
6
13
|
"types": "dist/index.d.ts",
|
|
7
|
-
"files": [
|
|
8
|
-
"dist"
|
|
9
|
-
],
|
|
10
14
|
"bin": {
|
|
11
15
|
"alex-c-line": "dist/index.js"
|
|
12
16
|
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
13
20
|
"scripts": {
|
|
14
|
-
"test": "vitest run",
|
|
15
|
-
"test-watch": "vitest",
|
|
16
|
-
"format": "prettier --write --parser typescript \"src/**/*.ts\" \"tests/**/*.ts\" && eslint --fix --suppress-all \"src/**/*.ts\" \"tests/**/*.ts\" && rm -f eslint-suppressions.json",
|
|
17
|
-
"lint": "tsc --noEmit && eslint \"src/**/*.ts\" \"tests/**/*.ts\" && prettier --check --parser typescript \"src/**/*.ts\" \"tests/**/*.ts\"",
|
|
18
21
|
"build": "tsup",
|
|
19
|
-
"command": "npm run build && echo && echo \"Command output:\" && npx alex-c-line",
|
|
20
|
-
"prepare": "husky",
|
|
21
|
-
"update-dependencies": "bash -c 'npx npm-check-updates -u \"$@\" && npm install' --",
|
|
22
22
|
"change-major": "npm version major -m \"Change version number to v%s\"",
|
|
23
23
|
"change-minor": "npm version minor -m \"Change version number to v%s\"",
|
|
24
|
-
"change-patch": "npm version patch -m \"Change version number to v%s\""
|
|
24
|
+
"change-patch": "npm version patch -m \"Change version number to v%s\"",
|
|
25
|
+
"command": "npm run build && echo && echo \"Command output:\" && npx alex-c-line",
|
|
26
|
+
"format": "npm run format-prettier && npm run format-eslint",
|
|
27
|
+
"format-eslint": "eslint --fix --suppress-all \"package.json\" \"src/**/*.ts\" \"tests/**/*.ts\" && rm -f eslint-suppressions.json",
|
|
28
|
+
"format-prettier": "npm run format-prettier-typescript && npm run format-prettier-javascript",
|
|
29
|
+
"format-prettier-javascript": "prettier --write \"./**/*.js\"",
|
|
30
|
+
"format-prettier-typescript": "prettier --write --parser typescript \"./**/*.ts\"",
|
|
31
|
+
"lint": "npm run lint-tsc && npm run lint-eslint && npm run lint-prettier",
|
|
32
|
+
"lint-eslint": "eslint \"package.json\" \"src/**/*.ts\" \"tests/**/*.ts\"",
|
|
33
|
+
"lint-prettier": "npm run lint-prettier-typescript && npm run lint-prettier-javascript",
|
|
34
|
+
"lint-prettier-javascript": "prettier --check \"./**.js\"",
|
|
35
|
+
"lint-prettier-typescript": "prettier --check --parser typescript \"./**/*.ts\"",
|
|
36
|
+
"lint-tsc": "tsc --noEmit",
|
|
37
|
+
"prepare": "husky",
|
|
38
|
+
"test": "vitest run",
|
|
39
|
+
"test-watch": "vitest",
|
|
40
|
+
"update-dependencies": "bash -c 'npx npm-check-updates -u \"$@\" && npm install' --"
|
|
25
41
|
},
|
|
26
|
-
"keywords": [],
|
|
27
|
-
"author": "",
|
|
28
|
-
"license": "ISC",
|
|
29
|
-
"type": "module",
|
|
30
42
|
"dependencies": {
|
|
31
|
-
"commander": "^14.0.
|
|
32
|
-
"dotenv": "^17.2.
|
|
43
|
+
"commander": "^14.0.2",
|
|
44
|
+
"dotenv": "^17.2.3",
|
|
33
45
|
"dotenv-stringify": "^3.0.1",
|
|
34
46
|
"execa": "^9.6.0"
|
|
35
47
|
},
|
|
36
48
|
"devDependencies": {
|
|
37
|
-
"@alextheman/eslint-plugin": "^
|
|
49
|
+
"@alextheman/eslint-plugin": "^2.7.7",
|
|
38
50
|
"@types/eslint": "^9.6.1",
|
|
39
|
-
"@types/node": "^24.
|
|
40
|
-
"eslint": "^9.
|
|
51
|
+
"@types/node": "^24.10.0",
|
|
52
|
+
"eslint": "^9.39.1",
|
|
41
53
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
42
54
|
"husky": "^9.1.7",
|
|
43
55
|
"prettier": "^3.6.2",
|
|
44
56
|
"tempy": "^3.1.0",
|
|
45
57
|
"ts-node": "^10.9.2",
|
|
46
58
|
"tsup": "^8.5.0",
|
|
47
|
-
"typescript": "^5.9.
|
|
59
|
+
"typescript": "^5.9.3",
|
|
48
60
|
"vite-tsconfig-paths": "^5.1.4",
|
|
49
|
-
"vitest": "^
|
|
61
|
+
"vitest": "^4.0.8"
|
|
50
62
|
}
|
|
51
63
|
}
|