@jannael/glinter 1.0.1 → 1.0.3
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.js +46 -20
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -5,15 +5,29 @@ var __getProtoOf = Object.getPrototypeOf;
|
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
function __accessProp(key) {
|
|
9
|
+
return this[key];
|
|
10
|
+
}
|
|
11
|
+
var __toESMCache_node;
|
|
12
|
+
var __toESMCache_esm;
|
|
8
13
|
var __toESM = (mod, isNodeMode, target) => {
|
|
14
|
+
var canCache = mod != null && typeof mod === "object";
|
|
15
|
+
if (canCache) {
|
|
16
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
17
|
+
var cached = cache.get(mod);
|
|
18
|
+
if (cached)
|
|
19
|
+
return cached;
|
|
20
|
+
}
|
|
9
21
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
10
22
|
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
11
23
|
for (let key of __getOwnPropNames(mod))
|
|
12
24
|
if (!__hasOwnProp.call(to, key))
|
|
13
25
|
__defProp(to, key, {
|
|
14
|
-
get: (
|
|
26
|
+
get: __accessProp.bind(mod, key),
|
|
15
27
|
enumerable: true
|
|
16
28
|
});
|
|
29
|
+
if (canCache)
|
|
30
|
+
cache.set(mod, to);
|
|
17
31
|
return to;
|
|
18
32
|
};
|
|
19
33
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
@@ -1155,43 +1169,55 @@ ${r ? t("cyan", E2) : ""}
|
|
|
1155
1169
|
var Ve = { light: w2("\u2500", "-"), heavy: w2("\u2501", "="), block: w2("\u2588", "#") };
|
|
1156
1170
|
var je = `${t("gray", d2)} `;
|
|
1157
1171
|
|
|
1158
|
-
// src/
|
|
1172
|
+
// src/add-command.ts
|
|
1159
1173
|
var {$: $2 } = globalThis.Bun;
|
|
1160
1174
|
async function main() {
|
|
1161
|
-
const output = await $2`git status --porcelain`.quiet().text();
|
|
1175
|
+
const output = await $2`git status --porcelain -z`.quiet().text();
|
|
1162
1176
|
if (!output.trim()) {
|
|
1163
1177
|
console.log("\x1B[32m\u2714\x1B[0m No changes detected.");
|
|
1164
1178
|
return;
|
|
1165
1179
|
}
|
|
1166
1180
|
const warnings = new Set;
|
|
1167
|
-
const
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
const
|
|
1171
|
-
|
|
1181
|
+
const entries = output.split("\x00").filter(Boolean);
|
|
1182
|
+
const changes = [];
|
|
1183
|
+
for (let i = 0;i < entries.length; i++) {
|
|
1184
|
+
const entry = entries[i];
|
|
1185
|
+
if (!entry)
|
|
1186
|
+
continue;
|
|
1187
|
+
const status = entry.slice(0, 2);
|
|
1188
|
+
const file = entry.slice(3);
|
|
1189
|
+
const isStaged = status[0] !== " " && status[0] !== "?";
|
|
1190
|
+
if (isStaged)
|
|
1191
|
+
continue;
|
|
1192
|
+
let displayPath = file;
|
|
1193
|
+
const value = file;
|
|
1194
|
+
if (status.startsWith("R") || status.startsWith("C")) {
|
|
1195
|
+
const source = entries[++i];
|
|
1196
|
+
displayPath = `${source} -> ${file}`;
|
|
1197
|
+
}
|
|
1172
1198
|
let label = "";
|
|
1173
1199
|
if (status.includes("M")) {
|
|
1174
|
-
label = `\x1B[33mmodified:\x1B[0m ${
|
|
1200
|
+
label = `\x1B[33mmodified:\x1B[0m ${displayPath}`;
|
|
1175
1201
|
} else if (status.includes("A") || status.includes("?")) {
|
|
1176
|
-
label = `\x1B[32mnew file:\x1B[0m ${
|
|
1202
|
+
label = `\x1B[32mnew file:\x1B[0m ${displayPath}`;
|
|
1177
1203
|
} else if (status.includes("D")) {
|
|
1178
|
-
label = `\x1B[31mdeleted:\x1B[0m ${
|
|
1204
|
+
label = `\x1B[31mdeleted:\x1B[0m ${displayPath}`;
|
|
1179
1205
|
} else if (status.includes("R")) {
|
|
1180
|
-
label = `\x1B[35mrenamed:\x1B[0m ${
|
|
1206
|
+
label = `\x1B[35mrenamed:\x1B[0m ${displayPath}`;
|
|
1181
1207
|
} else {
|
|
1182
|
-
label = `${status}: ${
|
|
1208
|
+
label = `${status}: ${displayPath}`;
|
|
1183
1209
|
}
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
const isSensitive = change.value.includes(".env") || change.value.includes("node_modules");
|
|
1187
|
-
if (change.value.includes(".env")) {
|
|
1210
|
+
const isSensitive = value.includes(".env") || value.includes("node_modules");
|
|
1211
|
+
if (value.includes(".env")) {
|
|
1188
1212
|
warnings.add("\x1B[33m .env file hidden\x1B[0m (Add to .gitignore to avoid leaks)");
|
|
1189
1213
|
}
|
|
1190
|
-
if (
|
|
1214
|
+
if (value.includes("node_modules")) {
|
|
1191
1215
|
warnings.add("\x1B[33m node_modules hidden\x1B[0m (Add to .gitignore to save space)");
|
|
1192
1216
|
}
|
|
1193
|
-
|
|
1194
|
-
|
|
1217
|
+
if (!isSensitive) {
|
|
1218
|
+
changes.push({ value, label });
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1195
1221
|
if (changes.length === 0) {
|
|
1196
1222
|
console.log("\x1B[32m\u2714\x1B[0m All changes are either staged or sensitive (like .env).");
|
|
1197
1223
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jannael/glinter",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "A high-performance, transparent Git wrapper with interactive staging",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"@types/bun": "latest"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"
|
|
53
|
-
"
|
|
52
|
+
"bun": ">=1.0.0",
|
|
53
|
+
"typescript": "5"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@clack/prompts": "1.2.0"
|