alex-c-line 1.3.7 → 1.4.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/dist/index.cjs +66 -15
- package/dist/index.js +65 -14
- package/package.json +9 -9
package/dist/index.cjs
CHANGED
|
@@ -60,17 +60,66 @@ var __async = (__this, __arguments, generator) => {
|
|
|
60
60
|
// src/index.ts
|
|
61
61
|
var import_commander = require("commander");
|
|
62
62
|
|
|
63
|
+
// src/commands/check-for-file-dependencies.ts
|
|
64
|
+
var import_promises = require("fs/promises");
|
|
65
|
+
var import_path = __toESM(require("path"), 1);
|
|
66
|
+
function findFileDependencies(dependencies) {
|
|
67
|
+
const fileDependencies = {};
|
|
68
|
+
if (!dependencies) {
|
|
69
|
+
return {};
|
|
70
|
+
}
|
|
71
|
+
for (const dependency in dependencies) {
|
|
72
|
+
if (dependencies[dependency].includes("file:")) {
|
|
73
|
+
fileDependencies[dependency] = dependencies[dependency];
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return fileDependencies;
|
|
77
|
+
}
|
|
78
|
+
function checkForFileDependencies(program2) {
|
|
79
|
+
program2.command("check-for-file-dependencies").description(
|
|
80
|
+
"Check for existence of file dependencies in package.json and give exit code 1 if such dependencies are found"
|
|
81
|
+
).action(() => __async(null, null, function* () {
|
|
82
|
+
var _a, _b, _c;
|
|
83
|
+
console.log("Checking for file dependencies...");
|
|
84
|
+
const { dependencies, devDependencies, peerDependencies } = JSON.parse(
|
|
85
|
+
yield (0, import_promises.readFile)(import_path.default.resolve(process.cwd(), "package.json"), "utf-8")
|
|
86
|
+
);
|
|
87
|
+
const allFileDependencies = {
|
|
88
|
+
dependencies: findFileDependencies(dependencies),
|
|
89
|
+
devDependencies: findFileDependencies(devDependencies),
|
|
90
|
+
peerDependencies: findFileDependencies(peerDependencies)
|
|
91
|
+
};
|
|
92
|
+
if (Object.keys((_a = allFileDependencies.dependencies) != null ? _a : {}).length === 0) {
|
|
93
|
+
delete allFileDependencies.dependencies;
|
|
94
|
+
}
|
|
95
|
+
if (Object.keys((_b = allFileDependencies.devDependencies) != null ? _b : {}).length === 0) {
|
|
96
|
+
delete allFileDependencies.devDependencies;
|
|
97
|
+
}
|
|
98
|
+
if (Object.keys((_c = allFileDependencies.peerDependencies) != null ? _c : {}).length === 0) {
|
|
99
|
+
delete allFileDependencies.peerDependencies;
|
|
100
|
+
}
|
|
101
|
+
if (Object.keys(allFileDependencies).length !== 0) {
|
|
102
|
+
console.error("ERROR: File dependencies found:");
|
|
103
|
+
console.error(JSON.stringify(allFileDependencies, void 0, 2));
|
|
104
|
+
process.exit(1);
|
|
105
|
+
}
|
|
106
|
+
console.log("No file dependencies found!");
|
|
107
|
+
process.exit(0);
|
|
108
|
+
}));
|
|
109
|
+
}
|
|
110
|
+
var check_for_file_dependencies_default = checkForFileDependencies;
|
|
111
|
+
|
|
63
112
|
// src/commands/check-lockfile-version-discrepancy.ts
|
|
64
113
|
var import_fs = require("fs");
|
|
65
|
-
var
|
|
114
|
+
var import_path2 = __toESM(require("path"), 1);
|
|
66
115
|
function checkLockfileVersionDiscrepancy(program2) {
|
|
67
116
|
program2.command("check-lockfile-version-discrepancy").description("Check that version numbers in package.json and package-lock.json match").action(() => {
|
|
68
117
|
console.log("Checking for package.json and package-lock.json discrepancies...");
|
|
69
118
|
const { version: packageVersion } = JSON.parse(
|
|
70
|
-
(0, import_fs.readFileSync)(
|
|
119
|
+
(0, import_fs.readFileSync)(import_path2.default.resolve(process.cwd(), "package.json"), "utf-8")
|
|
71
120
|
);
|
|
72
121
|
const { version: packageLockVersion } = JSON.parse(
|
|
73
|
-
(0, import_fs.readFileSync)(
|
|
122
|
+
(0, import_fs.readFileSync)(import_path2.default.resolve(process.cwd(), "package-lock.json"), "utf-8")
|
|
74
123
|
);
|
|
75
124
|
if (packageVersion !== packageLockVersion) {
|
|
76
125
|
console.error(
|
|
@@ -85,8 +134,8 @@ function checkLockfileVersionDiscrepancy(program2) {
|
|
|
85
134
|
var check_lockfile_version_discrepancy_default = checkLockfileVersionDiscrepancy;
|
|
86
135
|
|
|
87
136
|
// src/commands/edit-env.ts
|
|
88
|
-
var
|
|
89
|
-
var
|
|
137
|
+
var import_promises2 = require("fs/promises");
|
|
138
|
+
var import_path3 = __toESM(require("path"), 1);
|
|
90
139
|
var import_dotenv = __toESM(require("dotenv"), 1);
|
|
91
140
|
var import_dotenv_stringify = __toESM(require("dotenv-stringify"), 1);
|
|
92
141
|
function editEnv(program2) {
|
|
@@ -98,7 +147,7 @@ function editEnv(program2) {
|
|
|
98
147
|
let currentEnvFileContents;
|
|
99
148
|
try {
|
|
100
149
|
currentEnvFileContents = import_dotenv.default.parse(
|
|
101
|
-
yield (0,
|
|
150
|
+
yield (0, import_promises2.readFile)(import_path3.default.join(process.cwd(), file), "utf-8")
|
|
102
151
|
);
|
|
103
152
|
} catch (e) {
|
|
104
153
|
currentEnvFileContents = {};
|
|
@@ -108,9 +157,10 @@ function editEnv(program2) {
|
|
|
108
157
|
} else {
|
|
109
158
|
delete currentEnvFileContents[key];
|
|
110
159
|
}
|
|
111
|
-
yield (0,
|
|
112
|
-
|
|
113
|
-
(0, import_dotenv_stringify.default)(currentEnvFileContents)
|
|
160
|
+
yield (0, import_promises2.writeFile)(
|
|
161
|
+
import_path3.default.join(process.cwd(), file),
|
|
162
|
+
`${(0, import_dotenv_stringify.default)(currentEnvFileContents)}
|
|
163
|
+
`
|
|
114
164
|
);
|
|
115
165
|
console.log(".env file updated");
|
|
116
166
|
}));
|
|
@@ -118,9 +168,9 @@ function editEnv(program2) {
|
|
|
118
168
|
var edit_env_default = editEnv;
|
|
119
169
|
|
|
120
170
|
// src/commands/git-post-merge-cleanup.ts
|
|
121
|
-
var
|
|
171
|
+
var import_promises3 = require("fs/promises");
|
|
122
172
|
var import_os = __toESM(require("os"), 1);
|
|
123
|
-
var
|
|
173
|
+
var import_path4 = __toESM(require("path"), 1);
|
|
124
174
|
var import_execa2 = require("execa");
|
|
125
175
|
|
|
126
176
|
// src/utils/execa-helpers.ts
|
|
@@ -137,8 +187,8 @@ function gitPostMergeCleanup(program2) {
|
|
|
137
187
|
var _a, _b, _c;
|
|
138
188
|
let alexCLineConfigJSON;
|
|
139
189
|
try {
|
|
140
|
-
alexCLineConfigJSON = yield (0,
|
|
141
|
-
|
|
190
|
+
alexCLineConfigJSON = yield (0, import_promises3.readFile)(
|
|
191
|
+
import_path4.default.join((_a = process.env.HOME) != null ? _a : import_os.default.homedir(), "alex-c-line-config.json"),
|
|
142
192
|
"utf-8"
|
|
143
193
|
);
|
|
144
194
|
} catch (e) {
|
|
@@ -200,10 +250,11 @@ var say_hello_default = sayHello;
|
|
|
200
250
|
|
|
201
251
|
// src/commands/index.ts
|
|
202
252
|
function loadCommands(program2) {
|
|
203
|
-
say_hello_default(program2);
|
|
204
253
|
check_lockfile_version_discrepancy_default(program2);
|
|
205
|
-
|
|
254
|
+
check_for_file_dependencies_default(program2);
|
|
206
255
|
edit_env_default(program2);
|
|
256
|
+
git_post_merge_cleanup_default(program2);
|
|
257
|
+
say_hello_default(program2);
|
|
207
258
|
}
|
|
208
259
|
var commands_default = loadCommands;
|
|
209
260
|
|
package/dist/index.js
CHANGED
|
@@ -39,17 +39,66 @@ var __async = (__this, __arguments, generator) => {
|
|
|
39
39
|
// src/index.ts
|
|
40
40
|
import { Command } from "commander";
|
|
41
41
|
|
|
42
|
+
// src/commands/check-for-file-dependencies.ts
|
|
43
|
+
import { readFile } from "fs/promises";
|
|
44
|
+
import path from "path";
|
|
45
|
+
function findFileDependencies(dependencies) {
|
|
46
|
+
const fileDependencies = {};
|
|
47
|
+
if (!dependencies) {
|
|
48
|
+
return {};
|
|
49
|
+
}
|
|
50
|
+
for (const dependency in dependencies) {
|
|
51
|
+
if (dependencies[dependency].includes("file:")) {
|
|
52
|
+
fileDependencies[dependency] = dependencies[dependency];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return fileDependencies;
|
|
56
|
+
}
|
|
57
|
+
function checkForFileDependencies(program2) {
|
|
58
|
+
program2.command("check-for-file-dependencies").description(
|
|
59
|
+
"Check for existence of file dependencies in package.json and give exit code 1 if such dependencies are found"
|
|
60
|
+
).action(() => __async(null, null, function* () {
|
|
61
|
+
var _a, _b, _c;
|
|
62
|
+
console.log("Checking for file dependencies...");
|
|
63
|
+
const { dependencies, devDependencies, peerDependencies } = JSON.parse(
|
|
64
|
+
yield readFile(path.resolve(process.cwd(), "package.json"), "utf-8")
|
|
65
|
+
);
|
|
66
|
+
const allFileDependencies = {
|
|
67
|
+
dependencies: findFileDependencies(dependencies),
|
|
68
|
+
devDependencies: findFileDependencies(devDependencies),
|
|
69
|
+
peerDependencies: findFileDependencies(peerDependencies)
|
|
70
|
+
};
|
|
71
|
+
if (Object.keys((_a = allFileDependencies.dependencies) != null ? _a : {}).length === 0) {
|
|
72
|
+
delete allFileDependencies.dependencies;
|
|
73
|
+
}
|
|
74
|
+
if (Object.keys((_b = allFileDependencies.devDependencies) != null ? _b : {}).length === 0) {
|
|
75
|
+
delete allFileDependencies.devDependencies;
|
|
76
|
+
}
|
|
77
|
+
if (Object.keys((_c = allFileDependencies.peerDependencies) != null ? _c : {}).length === 0) {
|
|
78
|
+
delete allFileDependencies.peerDependencies;
|
|
79
|
+
}
|
|
80
|
+
if (Object.keys(allFileDependencies).length !== 0) {
|
|
81
|
+
console.error("ERROR: File dependencies found:");
|
|
82
|
+
console.error(JSON.stringify(allFileDependencies, void 0, 2));
|
|
83
|
+
process.exit(1);
|
|
84
|
+
}
|
|
85
|
+
console.log("No file dependencies found!");
|
|
86
|
+
process.exit(0);
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
var check_for_file_dependencies_default = checkForFileDependencies;
|
|
90
|
+
|
|
42
91
|
// src/commands/check-lockfile-version-discrepancy.ts
|
|
43
92
|
import { readFileSync } from "fs";
|
|
44
|
-
import
|
|
93
|
+
import path2 from "path";
|
|
45
94
|
function checkLockfileVersionDiscrepancy(program2) {
|
|
46
95
|
program2.command("check-lockfile-version-discrepancy").description("Check that version numbers in package.json and package-lock.json match").action(() => {
|
|
47
96
|
console.log("Checking for package.json and package-lock.json discrepancies...");
|
|
48
97
|
const { version: packageVersion } = JSON.parse(
|
|
49
|
-
readFileSync(
|
|
98
|
+
readFileSync(path2.resolve(process.cwd(), "package.json"), "utf-8")
|
|
50
99
|
);
|
|
51
100
|
const { version: packageLockVersion } = JSON.parse(
|
|
52
|
-
readFileSync(
|
|
101
|
+
readFileSync(path2.resolve(process.cwd(), "package-lock.json"), "utf-8")
|
|
53
102
|
);
|
|
54
103
|
if (packageVersion !== packageLockVersion) {
|
|
55
104
|
console.error(
|
|
@@ -64,8 +113,8 @@ function checkLockfileVersionDiscrepancy(program2) {
|
|
|
64
113
|
var check_lockfile_version_discrepancy_default = checkLockfileVersionDiscrepancy;
|
|
65
114
|
|
|
66
115
|
// src/commands/edit-env.ts
|
|
67
|
-
import { readFile, writeFile } from "fs/promises";
|
|
68
|
-
import
|
|
116
|
+
import { readFile as readFile2, writeFile } from "fs/promises";
|
|
117
|
+
import path3 from "path";
|
|
69
118
|
import dotenv from "dotenv";
|
|
70
119
|
import dotenvStringify from "dotenv-stringify";
|
|
71
120
|
function editEnv(program2) {
|
|
@@ -77,7 +126,7 @@ function editEnv(program2) {
|
|
|
77
126
|
let currentEnvFileContents;
|
|
78
127
|
try {
|
|
79
128
|
currentEnvFileContents = dotenv.parse(
|
|
80
|
-
yield
|
|
129
|
+
yield readFile2(path3.join(process.cwd(), file), "utf-8")
|
|
81
130
|
);
|
|
82
131
|
} catch (e) {
|
|
83
132
|
currentEnvFileContents = {};
|
|
@@ -88,8 +137,9 @@ function editEnv(program2) {
|
|
|
88
137
|
delete currentEnvFileContents[key];
|
|
89
138
|
}
|
|
90
139
|
yield writeFile(
|
|
91
|
-
|
|
92
|
-
dotenvStringify(currentEnvFileContents)
|
|
140
|
+
path3.join(process.cwd(), file),
|
|
141
|
+
`${dotenvStringify(currentEnvFileContents)}
|
|
142
|
+
`
|
|
93
143
|
);
|
|
94
144
|
console.log(".env file updated");
|
|
95
145
|
}));
|
|
@@ -97,9 +147,9 @@ function editEnv(program2) {
|
|
|
97
147
|
var edit_env_default = editEnv;
|
|
98
148
|
|
|
99
149
|
// src/commands/git-post-merge-cleanup.ts
|
|
100
|
-
import { readFile as
|
|
150
|
+
import { readFile as readFile3 } from "fs/promises";
|
|
101
151
|
import os from "os";
|
|
102
|
-
import
|
|
152
|
+
import path4 from "path";
|
|
103
153
|
import { execa as execa2, ExecaError } from "execa";
|
|
104
154
|
|
|
105
155
|
// src/utils/execa-helpers.ts
|
|
@@ -116,8 +166,8 @@ function gitPostMergeCleanup(program2) {
|
|
|
116
166
|
var _a, _b, _c;
|
|
117
167
|
let alexCLineConfigJSON;
|
|
118
168
|
try {
|
|
119
|
-
alexCLineConfigJSON = yield
|
|
120
|
-
|
|
169
|
+
alexCLineConfigJSON = yield readFile3(
|
|
170
|
+
path4.join((_a = process.env.HOME) != null ? _a : os.homedir(), "alex-c-line-config.json"),
|
|
121
171
|
"utf-8"
|
|
122
172
|
);
|
|
123
173
|
} catch (e) {
|
|
@@ -179,10 +229,11 @@ var say_hello_default = sayHello;
|
|
|
179
229
|
|
|
180
230
|
// src/commands/index.ts
|
|
181
231
|
function loadCommands(program2) {
|
|
182
|
-
say_hello_default(program2);
|
|
183
232
|
check_lockfile_version_discrepancy_default(program2);
|
|
184
|
-
|
|
233
|
+
check_for_file_dependencies_default(program2);
|
|
185
234
|
edit_env_default(program2);
|
|
235
|
+
git_post_merge_cleanup_default(program2);
|
|
236
|
+
say_hello_default(program2);
|
|
186
237
|
}
|
|
187
238
|
var commands_default = loadCommands;
|
|
188
239
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "alex-c-line",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
"scripts": {
|
|
14
14
|
"test": "vitest run",
|
|
15
15
|
"test-watch": "vitest",
|
|
16
|
-
"format": "prettier --write --parser typescript
|
|
17
|
-
"lint": "
|
|
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
18
|
"build": "tsup",
|
|
19
19
|
"command": "npm run build && echo && echo \"Command output:\" && npx alex-c-line",
|
|
20
20
|
"prepare": "husky",
|
|
21
|
-
"update-dependencies": "npx npm-check-updates -u && npm install",
|
|
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
24
|
"change-patch": "npm version patch -m \"Change version number to v%s\""
|
|
@@ -28,16 +28,16 @@
|
|
|
28
28
|
"license": "ISC",
|
|
29
29
|
"type": "module",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"commander": "^14.0.
|
|
32
|
-
"dotenv": "^17.2.
|
|
31
|
+
"commander": "^14.0.1",
|
|
32
|
+
"dotenv": "^17.2.2",
|
|
33
33
|
"dotenv-stringify": "^3.0.1",
|
|
34
34
|
"execa": "^9.6.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@alextheman/eslint-plugin": "^1.
|
|
37
|
+
"@alextheman/eslint-plugin": "^1.14.1",
|
|
38
38
|
"@types/eslint": "^9.6.1",
|
|
39
|
-
"@types/node": "^24.3.
|
|
40
|
-
"eslint": "^9.
|
|
39
|
+
"@types/node": "^24.3.2",
|
|
40
|
+
"eslint": "^9.35.0",
|
|
41
41
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
42
42
|
"husky": "^9.1.7",
|
|
43
43
|
"prettier": "^3.6.2",
|