helm-env-delta 1.15.2 → 1.15.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/consoleFormatter.js +12 -12
- package/dist/index.js +40 -40
- package/dist/reporters/browserLauncher.js +1 -34
- package/dist/reporters/consoleDiffReporter.js +26 -26
- package/dist/utils/versionChecker.js +3 -3
- package/package.json +10 -9
package/dist/consoleFormatter.js
CHANGED
|
@@ -4,18 +4,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.formatProgressMessage = exports.colorizeFileOperation = exports.formatStopRuleViolation = exports.formatBox = void 0;
|
|
7
|
-
const
|
|
7
|
+
const ansi_colors_1 = __importDefault(require("ansi-colors"));
|
|
8
8
|
const formatBox = (title, content, style = 'info', width = 60) => {
|
|
9
9
|
const getColorFunction = (boxStyle) => {
|
|
10
10
|
switch (boxStyle) {
|
|
11
11
|
case 'success':
|
|
12
|
-
return
|
|
12
|
+
return ansi_colors_1.default.green;
|
|
13
13
|
case 'warning':
|
|
14
|
-
return
|
|
14
|
+
return ansi_colors_1.default.yellow;
|
|
15
15
|
case 'error':
|
|
16
|
-
return
|
|
16
|
+
return ansi_colors_1.default.red;
|
|
17
17
|
default:
|
|
18
|
-
return
|
|
18
|
+
return ansi_colors_1.default.cyan;
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
const colorFunction = getColorFunction(style);
|
|
@@ -44,7 +44,7 @@ const formatStopRuleViolation = (violation, mode) => {
|
|
|
44
44
|
return violationMode === 'error' ? 'error' : 'warning';
|
|
45
45
|
};
|
|
46
46
|
const labelWidth = 10;
|
|
47
|
-
const formatLabel = (label) =>
|
|
47
|
+
const formatLabel = (label) => ansi_colors_1.default.dim(label.padEnd(labelWidth));
|
|
48
48
|
const content = [
|
|
49
49
|
`${formatLabel('File:')} ${violation.file}`,
|
|
50
50
|
`${formatLabel('Path:')} ${violation.path}`,
|
|
@@ -61,13 +61,13 @@ const colorizeFileOperation = (operation, filePath, isDryRun, alreadyDeleted = f
|
|
|
61
61
|
const getOperationDisplay = (op) => {
|
|
62
62
|
switch (op) {
|
|
63
63
|
case 'add':
|
|
64
|
-
return { symbol: '+', verb: 'add', colorFn:
|
|
64
|
+
return { symbol: '+', verb: 'add', colorFn: ansi_colors_1.default.green };
|
|
65
65
|
case 'update':
|
|
66
|
-
return { symbol: '~', verb: 'update', colorFn:
|
|
66
|
+
return { symbol: '~', verb: 'update', colorFn: ansi_colors_1.default.yellow };
|
|
67
67
|
case 'delete':
|
|
68
|
-
return { symbol: '-', verb: 'delete', colorFn:
|
|
68
|
+
return { symbol: '-', verb: 'delete', colorFn: ansi_colors_1.default.red };
|
|
69
69
|
case 'format':
|
|
70
|
-
return { symbol: '≈', verb: 'format', colorFn:
|
|
70
|
+
return { symbol: '≈', verb: 'format', colorFn: ansi_colors_1.default.cyan };
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
73
|
const { symbol, verb, colorFn } = getOperationDisplay(operation);
|
|
@@ -91,9 +91,9 @@ const formatProgressMessage = (message, style) => {
|
|
|
91
91
|
const getColorFunction = (progressStyle) => {
|
|
92
92
|
switch (progressStyle) {
|
|
93
93
|
case 'success':
|
|
94
|
-
return
|
|
94
|
+
return ansi_colors_1.default.green;
|
|
95
95
|
default:
|
|
96
|
-
return
|
|
96
|
+
return ansi_colors_1.default.cyan;
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
99
|
const icon = getIcon(style);
|
package/dist/index.js
CHANGED
|
@@ -40,7 +40,7 @@ const node_fs_1 = require("node:fs");
|
|
|
40
40
|
const promises_1 = require("node:fs/promises");
|
|
41
41
|
const node_os_1 = require("node:os");
|
|
42
42
|
const node_path_1 = __importDefault(require("node:path"));
|
|
43
|
-
const
|
|
43
|
+
const ansi_colors_1 = __importDefault(require("ansi-colors"));
|
|
44
44
|
const YAML = __importStar(require("yaml"));
|
|
45
45
|
const package_json_1 = __importDefault(require("../package.json"));
|
|
46
46
|
const commandLine_1 = require("./commandLine");
|
|
@@ -60,7 +60,7 @@ const versionChecker_1 = require("./utils/versionChecker");
|
|
|
60
60
|
const main = async () => {
|
|
61
61
|
const command = (0, commandLine_1.parseCommandLine)();
|
|
62
62
|
if (command.noColor)
|
|
63
|
-
|
|
63
|
+
ansi_colors_1.default.enabled = false;
|
|
64
64
|
const verbosityLevel = command.verbose ? 'verbose' : command.quiet ? 'quiet' : 'normal';
|
|
65
65
|
const logger = new logger_1.Logger({ level: verbosityLevel, isDiffJson: command.diffJson });
|
|
66
66
|
logger.log(`Now you run ${package_json_1.default.name} v${package_json_1.default.version}...`);
|
|
@@ -68,12 +68,12 @@ const main = async () => {
|
|
|
68
68
|
const firstRunMarker = node_path_1.default.join(configDirectory, 'first-run');
|
|
69
69
|
const isFirstRun = !(0, node_fs_1.existsSync)(firstRunMarker);
|
|
70
70
|
if (isFirstRun && !command.quiet) {
|
|
71
|
-
console.log(
|
|
72
|
-
console.log(
|
|
73
|
-
console.log(
|
|
74
|
-
console.log(
|
|
75
|
-
console.log(
|
|
76
|
-
console.log(
|
|
71
|
+
console.log(ansi_colors_1.default.cyan('\n👋 First time using helm-env-delta?\n'));
|
|
72
|
+
console.log(ansi_colors_1.default.dim(' Tips:'));
|
|
73
|
+
console.log(ansi_colors_1.default.dim(' • Always use --dry-run first to preview changes'));
|
|
74
|
+
console.log(ansi_colors_1.default.dim(' • Use --diff-html to review diffs in your browser'));
|
|
75
|
+
console.log(ansi_colors_1.default.dim(' • See examples: https://github.com/balazscsaba2006/helm-env-delta/tree/main/example'));
|
|
76
|
+
console.log(ansi_colors_1.default.dim(' • Run with --help to see all options\n'));
|
|
77
77
|
(0, node_fs_1.mkdirSync)(configDirectory, { recursive: true });
|
|
78
78
|
(0, node_fs_1.writeFileSync)(firstRunMarker, new Date().toISOString());
|
|
79
79
|
}
|
|
@@ -81,7 +81,7 @@ const main = async () => {
|
|
|
81
81
|
if (config.requiredVersion)
|
|
82
82
|
configHasRequiredVersion = true;
|
|
83
83
|
if (command.showConfig) {
|
|
84
|
-
console.log(
|
|
84
|
+
console.log(ansi_colors_1.default.cyan('\n⚙️ Resolved Configuration:\n'));
|
|
85
85
|
console.log(YAML.stringify(config, { indent: 2 }));
|
|
86
86
|
return;
|
|
87
87
|
}
|
|
@@ -95,9 +95,9 @@ const main = async () => {
|
|
|
95
95
|
const warningResult = (0, config_1.validateConfigWarnings)(validationConfig);
|
|
96
96
|
let hasAnyWarnings = warningResult.hasWarnings;
|
|
97
97
|
if (warningResult.hasWarnings) {
|
|
98
|
-
console.warn(
|
|
98
|
+
console.warn(ansi_colors_1.default.yellow('\n⚠️ Configuration Warnings (non-fatal):\n'));
|
|
99
99
|
for (const warning of warningResult.warnings)
|
|
100
|
-
console.warn(
|
|
100
|
+
console.warn(ansi_colors_1.default.yellow(` • ${warning}`));
|
|
101
101
|
}
|
|
102
102
|
logger.log('\n' + (0, consoleFormatter_1.formatProgressMessage)('Loading files for validation...', 'loading'));
|
|
103
103
|
const sourceResult = await (0, pipeline_1.loadFiles)({
|
|
@@ -135,12 +135,12 @@ const main = async () => {
|
|
|
135
135
|
const usageResult = (0, pipeline_1.validatePatternUsage)(validationConfig, sourceFiles, destinationFiles);
|
|
136
136
|
hasAnyWarnings = hasAnyWarnings || usageResult.hasWarnings;
|
|
137
137
|
if (usageResult.hasWarnings) {
|
|
138
|
-
console.warn(
|
|
138
|
+
console.warn(ansi_colors_1.default.yellow('\n⚠️ Pattern Usage Warnings (non-fatal):\n'));
|
|
139
139
|
for (const warning of usageResult.warnings) {
|
|
140
|
-
const contextString = warning.context ?
|
|
141
|
-
console.warn(
|
|
140
|
+
const contextString = warning.context ? ansi_colors_1.default.dim(` (${warning.context})`) : '';
|
|
141
|
+
console.warn(ansi_colors_1.default.yellow(` • ${warning.message}${contextString}`));
|
|
142
142
|
if (warning.hint)
|
|
143
|
-
console.warn(
|
|
143
|
+
console.warn(ansi_colors_1.default.dim(` Hint: ${warning.hint}`));
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
if (hasAnyWarnings)
|
|
@@ -161,7 +161,7 @@ const main = async () => {
|
|
|
161
161
|
}
|
|
162
162
|
if (command.formatOnly) {
|
|
163
163
|
if (!config.outputFormat) {
|
|
164
|
-
logger.log(
|
|
164
|
+
logger.log(ansi_colors_1.default.yellow('\n⚠️ No outputFormat configured. Nothing to format.'));
|
|
165
165
|
return;
|
|
166
166
|
}
|
|
167
167
|
logger.log('\n' + (0, consoleFormatter_1.formatProgressMessage)('Loading destination files...', 'loading'));
|
|
@@ -176,10 +176,10 @@ const main = async () => {
|
|
|
176
176
|
logger.progress(`Loaded ${destinationFiles.size} destination file(s)`, 'success');
|
|
177
177
|
if (command.listFiles) {
|
|
178
178
|
const filesList = [...destinationFiles.keys()].toSorted();
|
|
179
|
-
console.log(
|
|
180
|
-
console.log(
|
|
179
|
+
console.log(ansi_colors_1.default.cyan('\n📋 Files to be formatted:\n'));
|
|
180
|
+
console.log(ansi_colors_1.default.yellow(`Destination files: ${filesList.length}`));
|
|
181
181
|
for (const file of filesList)
|
|
182
|
-
console.log(` ${
|
|
182
|
+
console.log(` ${ansi_colors_1.default.dim(file)}`);
|
|
183
183
|
return;
|
|
184
184
|
}
|
|
185
185
|
logger.log('\n' + (0, consoleFormatter_1.formatProgressMessage)('Formatting files...', 'info'));
|
|
@@ -265,13 +265,13 @@ const main = async () => {
|
|
|
265
265
|
if (command.listFiles) {
|
|
266
266
|
const sourceFilesList = [...sourceFiles.keys()].toSorted();
|
|
267
267
|
const destinationFilesList = [...destinationFiles.keys()].toSorted();
|
|
268
|
-
console.log(
|
|
269
|
-
console.log(
|
|
268
|
+
console.log(ansi_colors_1.default.cyan('\n📋 Files to be synced:\n'));
|
|
269
|
+
console.log(ansi_colors_1.default.green(`Source files: ${sourceFilesList.length}`));
|
|
270
270
|
for (const file of sourceFilesList)
|
|
271
|
-
console.log(` ${
|
|
272
|
-
console.log(
|
|
271
|
+
console.log(` ${ansi_colors_1.default.dim(file)}`);
|
|
272
|
+
console.log(ansi_colors_1.default.yellow(`\nDestination files: ${destinationFilesList.length}`));
|
|
273
273
|
for (const file of destinationFilesList)
|
|
274
|
-
console.log(` ${
|
|
274
|
+
console.log(` ${ansi_colors_1.default.dim(file)}`);
|
|
275
275
|
return;
|
|
276
276
|
}
|
|
277
277
|
logger.log('\n' + (0, consoleFormatter_1.formatProgressMessage)('Computing differences...', 'info'));
|
|
@@ -292,13 +292,13 @@ const main = async () => {
|
|
|
292
292
|
try {
|
|
293
293
|
const suggestions = (0, suggestionEngine_1.analyzeDifferencesForSuggestions)(diffResult, syncConfig, command.suggestThreshold);
|
|
294
294
|
const yaml = (0, suggestionEngine_1.formatSuggestionsAsYaml)(suggestions);
|
|
295
|
-
console.log(
|
|
295
|
+
console.log(ansi_colors_1.default.cyan('\n💡 Suggested Configuration:\n'));
|
|
296
296
|
console.log(yaml);
|
|
297
297
|
if (suggestions.metadata.changedFiles === 0)
|
|
298
|
-
console.log(
|
|
298
|
+
console.log(ansi_colors_1.default.yellow('\nℹ️ No changes detected. Files are already in sync.'));
|
|
299
299
|
else {
|
|
300
|
-
console.log(
|
|
301
|
-
console.log(
|
|
300
|
+
console.log(ansi_colors_1.default.dim('\n---'));
|
|
301
|
+
console.log(ansi_colors_1.default.dim('💡 Tip: Copy relevant sections to your config.yaml and test with --dry-run'));
|
|
302
302
|
}
|
|
303
303
|
return;
|
|
304
304
|
}
|
|
@@ -326,29 +326,29 @@ const main = async () => {
|
|
|
326
326
|
process.exit(1);
|
|
327
327
|
}
|
|
328
328
|
if (!command.dryRun && !command.quiet) {
|
|
329
|
-
console.log(
|
|
330
|
-
console.log(
|
|
331
|
-
console.log(` ${
|
|
332
|
-
console.log(` ${
|
|
333
|
-
console.log(` ${
|
|
334
|
-
console.log(` ${
|
|
335
|
-
console.log(
|
|
329
|
+
console.log(ansi_colors_1.default.cyan('\n📊 Sync Summary:'));
|
|
330
|
+
console.log(ansi_colors_1.default.dim('─'.repeat(60)));
|
|
331
|
+
console.log(` ${ansi_colors_1.default.green('Added:')} ${diffResult.addedFiles.length} files`);
|
|
332
|
+
console.log(` ${ansi_colors_1.default.yellow('Changed:')} ${diffResult.changedFiles.length} files`);
|
|
333
|
+
console.log(` ${ansi_colors_1.default.red('Deleted:')} ${diffResult.deletedFiles.length} files (${syncConfig.prune ? 'prune enabled' : 'prune disabled'})`);
|
|
334
|
+
console.log(` ${ansi_colors_1.default.blue('Unchanged:')} ${diffResult.unchangedFiles.length} files`);
|
|
335
|
+
console.log(ansi_colors_1.default.dim('─'.repeat(60)));
|
|
336
336
|
if (diffResult.deletedFiles.length > 0 && syncConfig.prune) {
|
|
337
|
-
console.warn(
|
|
337
|
+
console.warn(ansi_colors_1.default.red('⚠️ Warning: Prune is enabled. The following files will be permanently deleted:'));
|
|
338
338
|
for (const f of diffResult.deletedFiles)
|
|
339
|
-
console.warn(
|
|
339
|
+
console.warn(ansi_colors_1.default.red(` - ${f}`));
|
|
340
340
|
}
|
|
341
341
|
if (syncConfig.confirmationDelay > 0) {
|
|
342
342
|
const totalSeconds = Math.ceil(syncConfig.confirmationDelay / 1000);
|
|
343
|
-
console.log(
|
|
343
|
+
console.log(ansi_colors_1.default.dim('\nPress Ctrl+C to cancel.\n'));
|
|
344
344
|
for (let remaining = totalSeconds; remaining > 0; remaining--) {
|
|
345
|
-
process.stdout.write(
|
|
345
|
+
process.stdout.write(ansi_colors_1.default.dim(` Proceeding in ${remaining}s...\r`));
|
|
346
346
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
347
347
|
}
|
|
348
348
|
process.stdout.write(' '.repeat(40) + '\r');
|
|
349
349
|
}
|
|
350
350
|
else
|
|
351
|
-
console.log(
|
|
351
|
+
console.log(ansi_colors_1.default.dim('\nPress Ctrl+C to cancel, or use --dry-run to preview changes first.\n'));
|
|
352
352
|
}
|
|
353
353
|
const formattedFiles = await (0, pipeline_1.updateFiles)(diffResult, sourceFiles, destinationFiles, syncConfig, command.dryRun, command.skipFormat, logger);
|
|
354
354
|
if (command.diffHtml && !command.quiet)
|
|
@@ -1,37 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
4
|
};
|
|
@@ -46,7 +13,7 @@ exports.BrowserLauncherError = BrowserLauncherError;
|
|
|
46
13
|
exports.isBrowserLauncherError = (0, errors_1.createErrorTypeGuard)(BrowserLauncherError);
|
|
47
14
|
const openInBrowser = async (filePath) => {
|
|
48
15
|
try {
|
|
49
|
-
const openModule = await
|
|
16
|
+
const openModule = await import('open');
|
|
50
17
|
const open = openModule.default;
|
|
51
18
|
const absolutePath = node_path_1.default.resolve(filePath);
|
|
52
19
|
await open(absolutePath);
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.showConsoleDiff = void 0;
|
|
7
|
-
const
|
|
7
|
+
const ansi_colors_1 = __importDefault(require("ansi-colors"));
|
|
8
8
|
const pipeline_1 = require("../pipeline");
|
|
9
9
|
const diffGenerator_1 = require("../utils/diffGenerator");
|
|
10
10
|
const fileType_1 = require("../utils/fileType");
|
|
@@ -14,36 +14,36 @@ const colorizeUnifiedDiff = (diff) => {
|
|
|
14
14
|
.split('\n')
|
|
15
15
|
.map((line) => {
|
|
16
16
|
if (line.startsWith('+') && !line.startsWith('+++'))
|
|
17
|
-
return
|
|
17
|
+
return ansi_colors_1.default.green(line);
|
|
18
18
|
if (line.startsWith('-') && !line.startsWith('---'))
|
|
19
|
-
return
|
|
19
|
+
return ansi_colors_1.default.red(line);
|
|
20
20
|
if (line.startsWith('@@'))
|
|
21
|
-
return
|
|
22
|
-
return
|
|
21
|
+
return ansi_colors_1.default.cyan(line);
|
|
22
|
+
return ansi_colors_1.default.gray(line);
|
|
23
23
|
})
|
|
24
24
|
.join('\n');
|
|
25
25
|
};
|
|
26
26
|
const formatAddedFiles = (files) => {
|
|
27
27
|
if (files.length === 0)
|
|
28
28
|
return '';
|
|
29
|
-
const header =
|
|
30
|
-
const fileList = files.map((file) =>
|
|
29
|
+
const header = ansi_colors_1.default.green.bold(`\nAdded Files (${files.length}):`);
|
|
30
|
+
const fileList = files.map((file) => ansi_colors_1.default.green(` + ${file.path}`)).join('\n');
|
|
31
31
|
return `${header}\n${fileList}\n`;
|
|
32
32
|
};
|
|
33
33
|
const formatDeletedFiles = (files) => {
|
|
34
34
|
if (files.length === 0)
|
|
35
35
|
return '';
|
|
36
|
-
const header =
|
|
37
|
-
const fileList = files.map((file) =>
|
|
36
|
+
const header = ansi_colors_1.default.red.bold(`\nDeleted Files (${files.length}):`);
|
|
37
|
+
const fileList = files.map((file) => ansi_colors_1.default.red(` - ${file}`)).join('\n');
|
|
38
38
|
return `${header}\n${fileList}\n`;
|
|
39
39
|
};
|
|
40
40
|
const formatChangedFile = (file, config) => {
|
|
41
41
|
const isYaml = (0, fileType_1.isYamlFile)(file.path);
|
|
42
|
-
const separator =
|
|
42
|
+
const separator = ansi_colors_1.default.yellow('━'.repeat(60));
|
|
43
43
|
const skipPaths = (0, pipeline_1.getSkipPathsForFile)(file.path, config.skipPath);
|
|
44
44
|
const skipPathInfo = skipPaths.length > 0
|
|
45
|
-
?
|
|
46
|
-
:
|
|
45
|
+
? ansi_colors_1.default.dim(`SkipPath patterns applied: ${skipPaths.join(', ')}`)
|
|
46
|
+
: ansi_colors_1.default.dim('No skipPath patterns applied');
|
|
47
47
|
const destinationContent = isYaml
|
|
48
48
|
? (0, serialization_1.serializeForDiff)(file.processedDestContent, true)
|
|
49
49
|
: String(file.processedDestContent);
|
|
@@ -54,7 +54,7 @@ const formatChangedFile = (file, config) => {
|
|
|
54
54
|
const colorizedDiff = colorizeUnifiedDiff(unifiedDiff);
|
|
55
55
|
return `
|
|
56
56
|
${separator}
|
|
57
|
-
${
|
|
57
|
+
${ansi_colors_1.default.yellow.bold(`File: ${file.path}`)}
|
|
58
58
|
${skipPathInfo}
|
|
59
59
|
|
|
60
60
|
${colorizedDiff}
|
|
@@ -63,39 +63,39 @@ ${colorizedDiff}
|
|
|
63
63
|
const formatChangedFiles = (files, config) => {
|
|
64
64
|
if (files.length === 0)
|
|
65
65
|
return '';
|
|
66
|
-
const header =
|
|
66
|
+
const header = ansi_colors_1.default.yellow.bold(`\nChanged Files (${files.length}):`);
|
|
67
67
|
const fileContent = files.map((file) => formatChangedFile(file, config)).join('\n');
|
|
68
68
|
return `${header}\n${fileContent}`;
|
|
69
69
|
};
|
|
70
70
|
const formatSummaryBox = (diffResult, pruneEnabled) => {
|
|
71
71
|
const width = 60;
|
|
72
|
-
const topBorder =
|
|
73
|
-
const bottomBorder =
|
|
74
|
-
const addedLine =
|
|
75
|
-
const changedLine =
|
|
72
|
+
const topBorder = ansi_colors_1.default.cyan(`╭─ Diff Summary ${'─'.repeat(width - 14)}╮`);
|
|
73
|
+
const bottomBorder = ansi_colors_1.default.cyan(`╰${'─'.repeat(width + 1)}╯`);
|
|
74
|
+
const addedLine = ansi_colors_1.default.cyan(`│ ${ansi_colors_1.default.green('✚ Added:')} ${diffResult.addedFiles.length.toString().padEnd(width - 15)} │`);
|
|
75
|
+
const changedLine = ansi_colors_1.default.cyan(`│ ${ansi_colors_1.default.yellow('✎ Changed:')} ${diffResult.changedFiles.length.toString().padEnd(width - 15)} │`);
|
|
76
76
|
const deletedText = pruneEnabled
|
|
77
77
|
? `${diffResult.deletedFiles.length} (prune enabled)`
|
|
78
78
|
: `${diffResult.deletedFiles.length} (prune disabled)`;
|
|
79
|
-
const deletedLine =
|
|
80
|
-
const unchangedLine =
|
|
79
|
+
const deletedLine = ansi_colors_1.default.cyan(`│ ${ansi_colors_1.default.red('✖ Deleted:')} ${deletedText.padEnd(width - 15)} │`);
|
|
80
|
+
const unchangedLine = ansi_colors_1.default.cyan(`│ ${ansi_colors_1.default.gray('✓ Unchanged:')} ${diffResult.unchangedFiles.length.toString().padEnd(width - 15)} │`);
|
|
81
81
|
return `${topBorder}\n${addedLine}\n${changedLine}\n${deletedLine}\n${unchangedLine}\n${bottomBorder}\n`;
|
|
82
82
|
};
|
|
83
83
|
const showConsoleDiff = (diffResult, config) => {
|
|
84
84
|
console.log('');
|
|
85
85
|
console.log(formatSummaryBox(diffResult, config.prune));
|
|
86
|
-
console.log(
|
|
87
|
-
console.log(
|
|
86
|
+
console.log(ansi_colors_1.default.bold('\nInclude patterns:'), config.include.join(', '));
|
|
87
|
+
console.log(ansi_colors_1.default.bold('Exclude patterns:'), config.exclude.length > 0 ? config.exclude.join(', ') : ansi_colors_1.default.dim('(none)'));
|
|
88
88
|
if (diffResult.addedFiles.length === 0 &&
|
|
89
89
|
diffResult.changedFiles.length === 0 &&
|
|
90
90
|
diffResult.deletedFiles.length === 0) {
|
|
91
91
|
const totalCompared = diffResult.unchangedFiles.length;
|
|
92
92
|
const hasSkipPath = config.skipPath && Object.keys(config.skipPath).length > 0;
|
|
93
|
-
const skipNote = hasSkipPath ?
|
|
93
|
+
const skipNote = hasSkipPath ? ansi_colors_1.default.dim(' (some paths may be excluded via skipPath)') : '';
|
|
94
94
|
if (totalCompared === 0)
|
|
95
|
-
console.log(
|
|
95
|
+
console.log(ansi_colors_1.default.yellow.bold('\n⚠ No files matched the include/exclude patterns\n'));
|
|
96
96
|
else
|
|
97
|
-
console.log(
|
|
98
|
-
|
|
97
|
+
console.log(ansi_colors_1.default.green.bold(`\n✓ No differences found`) +
|
|
98
|
+
ansi_colors_1.default.dim(` — ${totalCompared} file(s) compared, all identical`) +
|
|
99
99
|
skipNote +
|
|
100
100
|
'\n');
|
|
101
101
|
return;
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.checkForUpdates = exports.isNewerVersion = exports.parseVersion = exports.isVersionCheckerError = exports.VersionCheckerError = void 0;
|
|
7
7
|
const node_https_1 = __importDefault(require("node:https"));
|
|
8
|
-
const
|
|
8
|
+
const ansi_colors_1 = __importDefault(require("ansi-colors"));
|
|
9
9
|
const package_json_1 = __importDefault(require("../../package.json"));
|
|
10
10
|
const errors_1 = require("./errors");
|
|
11
11
|
const VersionCheckerErrorClass = (0, errors_1.createErrorClass)('Version Checker Error', {
|
|
@@ -102,8 +102,8 @@ const fetchLatestVersion = (packageName, timeout) => {
|
|
|
102
102
|
});
|
|
103
103
|
};
|
|
104
104
|
const displayUpdateNotification = (currentVersion, latestVersion) => {
|
|
105
|
-
console.log('\n' +
|
|
106
|
-
console.log(
|
|
105
|
+
console.log('\n' + ansi_colors_1.default.yellow(`⚠ Update available! v${currentVersion} → v${latestVersion}`));
|
|
106
|
+
console.log(ansi_colors_1.default.yellow('Run: npm install -g helm-env-delta@latest'));
|
|
107
107
|
};
|
|
108
108
|
const checkForUpdates = async (currentVersion) => {
|
|
109
109
|
if (isCiEnvironment())
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "helm-env-delta",
|
|
3
|
-
"version": "1.15.
|
|
3
|
+
"version": "1.15.3",
|
|
4
4
|
"description": "HelmEnvDelta – environment-aware YAML delta and sync for GitOps",
|
|
5
5
|
"author": "BCsabaEngine",
|
|
6
6
|
"license": "ISC",
|
|
@@ -65,27 +65,28 @@
|
|
|
65
65
|
],
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@eslint/js": "^10.0.1",
|
|
68
|
-
"@types/
|
|
69
|
-
"@types/
|
|
70
|
-
"@
|
|
68
|
+
"@types/ansi-colors": "^3.2.0",
|
|
69
|
+
"@types/node": "^25.5.2",
|
|
70
|
+
"@types/picomatch": "^4.0.3",
|
|
71
|
+
"@typescript-eslint/eslint-plugin": "^8.58.0",
|
|
71
72
|
"@vitest/coverage-v8": "^4.1.2",
|
|
72
|
-
"eslint": "^10.
|
|
73
|
+
"eslint": "^10.2.0",
|
|
73
74
|
"eslint-config-prettier": "^10.1.8",
|
|
74
|
-
"eslint-plugin-simple-import-sort": "^
|
|
75
|
+
"eslint-plugin-simple-import-sort": "^13.0.0",
|
|
75
76
|
"eslint-plugin-unicorn": "^64.0.0",
|
|
76
77
|
"prettier": "^3.8.1",
|
|
77
78
|
"tsx": "^4.21.0",
|
|
78
|
-
"typescript": "^
|
|
79
|
+
"typescript": "^6.0.2",
|
|
79
80
|
"vitest": "^4.1.2"
|
|
80
81
|
},
|
|
81
82
|
"dependencies": {
|
|
82
|
-
"
|
|
83
|
+
"ansi-colors": "^4.1.3",
|
|
83
84
|
"commander": "^14.0.3",
|
|
84
85
|
"diff": "^8.0.4",
|
|
85
86
|
"diff2html": "3.4.56",
|
|
86
87
|
"open": "^11.0.0",
|
|
87
88
|
"picomatch": "^4.0.4",
|
|
88
|
-
"simple-git": "^3.
|
|
89
|
+
"simple-git": "^3.35.2",
|
|
89
90
|
"tinyglobby": "^0.2.15",
|
|
90
91
|
"yaml": "^2.8.3",
|
|
91
92
|
"zod": "^4.3.6"
|