@eslint-config-snapshot/cli 0.5.0 → 0.8.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/CHANGELOG.md +33 -0
- package/dist/index.cjs +55 -17
- package/dist/index.js +55 -17
- package/package.json +2 -2
- package/src/index.ts +65 -24
- package/test/cli.terminal.integration.test.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @eslint-config-snapshot/cli
|
|
2
2
|
|
|
3
|
+
## 0.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Release minor version with improved human-readable CLI runtime logs and consistent output spacing.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @eslint-config-snapshot/api@0.8.0
|
|
13
|
+
|
|
14
|
+
## 0.7.0
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- Release minor version after improving runtime command header messaging and UX consistency.
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
- @eslint-config-snapshot/api@0.7.0
|
|
24
|
+
|
|
25
|
+
## 0.6.0
|
|
26
|
+
|
|
27
|
+
### Minor Changes
|
|
28
|
+
|
|
29
|
+
- Release minor version with improved interactive CLI logging tone and richer runtime context reporting.
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- Updated dependencies
|
|
34
|
+
- @eslint-config-snapshot/api@0.6.0
|
|
35
|
+
|
|
3
36
|
## 0.5.0
|
|
4
37
|
|
|
5
38
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -195,7 +195,7 @@ async function executeCheck(cwd, format, defaultInvocation = false) {
|
|
|
195
195
|
if (format !== "status") {
|
|
196
196
|
writeRunContextHeader(cwd, defaultInvocation ? "check" : `check:${format}`, foundConfig?.path, storedSnapshots);
|
|
197
197
|
if (shouldShowRunLogs()) {
|
|
198
|
-
writeSubtleInfo("
|
|
198
|
+
writeSubtleInfo("\u{1F50E} Checking current ESLint configuration...\n");
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
if (!foundConfig) {
|
|
@@ -218,13 +218,13 @@ async function executeCheck(cwd, format, defaultInvocation = false) {
|
|
|
218
218
|
if (storedSnapshots.size === 0) {
|
|
219
219
|
const summary = summarizeSnapshots(currentSnapshots);
|
|
220
220
|
process.stdout.write(
|
|
221
|
-
`
|
|
221
|
+
`Rules found in this analysis: ${summary.groups} groups, ${summary.rules} rules (severity mix: ${summary.error} errors, ${summary.warn} warnings, ${summary.off} off).
|
|
222
222
|
`
|
|
223
223
|
);
|
|
224
224
|
const canPromptBaseline = defaultInvocation || format === "summary";
|
|
225
225
|
if (canPromptBaseline && process.stdin.isTTY && process.stdout.isTTY) {
|
|
226
226
|
const shouldCreateBaseline = await askYesNo(
|
|
227
|
-
"No baseline yet.
|
|
227
|
+
"No baseline yet. Do you want to save this analyzed rule state as your baseline now? [Y/n] ",
|
|
228
228
|
true
|
|
229
229
|
);
|
|
230
230
|
if (shouldCreateBaseline) {
|
|
@@ -271,7 +271,7 @@ async function executeUpdate(cwd, printSummary) {
|
|
|
271
271
|
const storedSnapshots = await loadStoredSnapshots(cwd);
|
|
272
272
|
writeRunContextHeader(cwd, "update", foundConfig?.path, storedSnapshots);
|
|
273
273
|
if (shouldShowRunLogs()) {
|
|
274
|
-
writeSubtleInfo("
|
|
274
|
+
writeSubtleInfo("\u{1F50E} Checking current ESLint configuration...\n");
|
|
275
275
|
}
|
|
276
276
|
if (!foundConfig) {
|
|
277
277
|
writeSubtleInfo(
|
|
@@ -310,7 +310,7 @@ async function executePrint(cwd, format) {
|
|
|
310
310
|
const storedSnapshots = await loadStoredSnapshots(cwd);
|
|
311
311
|
writeRunContextHeader(cwd, `print:${format}`, foundConfig?.path, storedSnapshots);
|
|
312
312
|
if (shouldShowRunLogs()) {
|
|
313
|
-
writeSubtleInfo("
|
|
313
|
+
writeSubtleInfo("\u{1F50E} Checking current ESLint configuration...\n");
|
|
314
314
|
}
|
|
315
315
|
const currentSnapshots = await computeCurrentSnapshots(cwd);
|
|
316
316
|
if (format === "short") {
|
|
@@ -329,7 +329,7 @@ async function executeConfig(cwd, format) {
|
|
|
329
329
|
const storedSnapshots = await loadStoredSnapshots(cwd);
|
|
330
330
|
writeRunContextHeader(cwd, `config:${format}`, foundConfig?.path, storedSnapshots);
|
|
331
331
|
if (shouldShowRunLogs()) {
|
|
332
|
-
writeSubtleInfo("Resolving effective runtime configuration...\n");
|
|
332
|
+
writeSubtleInfo("\u2699\uFE0F Resolving effective runtime configuration...\n");
|
|
333
333
|
}
|
|
334
334
|
const config = await (0, import_api.loadConfig)(cwd);
|
|
335
335
|
const resolved = await resolveWorkspaceAssignments(cwd, config);
|
|
@@ -780,7 +780,6 @@ function printWhatChanged(changes, currentSnapshots, eslintVersionsByGroup) {
|
|
|
780
780
|
- workspace membership changes: ${changeSummary.workspace}
|
|
781
781
|
- current baseline: ${currentSummary.groups} groups, ${currentSummary.rules} rules
|
|
782
782
|
- current severity mix: ${currentSummary.error} errors, ${currentSummary.warn} warnings, ${currentSummary.off} off
|
|
783
|
-
|
|
784
783
|
`
|
|
785
784
|
);
|
|
786
785
|
writeEslintVersionSummary(eslintVersionsByGroup);
|
|
@@ -890,11 +889,14 @@ function endRunTimer(exitCode) {
|
|
|
890
889
|
activeRunTimer.pauseStartedAtMs = void 0;
|
|
891
890
|
}
|
|
892
891
|
const elapsedMs = Math.max(0, Date.now() - activeRunTimer.startedAtMs - activeRunTimer.pausedMs);
|
|
893
|
-
const color = createColorizer();
|
|
894
|
-
const status = exitCode === 0 ? color.green("done") : color.red("failed");
|
|
895
892
|
const seconds = (elapsedMs / 1e3).toFixed(2);
|
|
896
|
-
|
|
893
|
+
if (exitCode === 0) {
|
|
894
|
+
writeSubtleInfo(`Finished in ${seconds}s
|
|
895
|
+
`);
|
|
896
|
+
} else {
|
|
897
|
+
writeSubtleInfo(`Finished with errors in ${seconds}s
|
|
897
898
|
`);
|
|
899
|
+
}
|
|
898
900
|
activeRunTimer = void 0;
|
|
899
901
|
}
|
|
900
902
|
function pauseRunTimer() {
|
|
@@ -954,17 +956,53 @@ function writeRunContextHeader(cwd, commandLabel, configPath, storedSnapshots) {
|
|
|
954
956
|
return;
|
|
955
957
|
}
|
|
956
958
|
const color = createColorizer();
|
|
957
|
-
process.stdout.write(color.bold(`eslint-config-snapshot v${readCliVersion()}
|
|
959
|
+
process.stdout.write(color.bold(`eslint-config-snapshot v${readCliVersion()} \u2022 ${formatCommandDisplayLabel(commandLabel)}
|
|
958
960
|
`));
|
|
959
|
-
process.stdout.write(
|
|
960
|
-
`);
|
|
961
|
-
process.stdout.write(`Repository: ${cwd}
|
|
961
|
+
process.stdout.write(`\u{1F4C1} Repository: ${cwd}
|
|
962
962
|
`);
|
|
963
|
-
process.stdout.write(
|
|
963
|
+
process.stdout.write(`\u{1F4C1} Baseline: ${formatStoredSnapshotSummary(storedSnapshots)}
|
|
964
964
|
`);
|
|
965
|
-
process.stdout.write(
|
|
966
|
-
|
|
965
|
+
process.stdout.write(`\u2699\uFE0F Config source: ${formatConfigSource(cwd, configPath)}
|
|
967
966
|
`);
|
|
967
|
+
process.stdout.write("\n");
|
|
968
|
+
}
|
|
969
|
+
function formatCommandDisplayLabel(commandLabel) {
|
|
970
|
+
switch (commandLabel) {
|
|
971
|
+
case "check":
|
|
972
|
+
case "check:summary": {
|
|
973
|
+
return "Check drift against baseline (summary)";
|
|
974
|
+
}
|
|
975
|
+
case "check:diff": {
|
|
976
|
+
return "Check drift against baseline (detailed diff)";
|
|
977
|
+
}
|
|
978
|
+
case "check:status": {
|
|
979
|
+
return "Check drift against baseline (status only)";
|
|
980
|
+
}
|
|
981
|
+
case "update": {
|
|
982
|
+
return "Update baseline snapshot";
|
|
983
|
+
}
|
|
984
|
+
case "print:json": {
|
|
985
|
+
return "Print aggregated rules (JSON)";
|
|
986
|
+
}
|
|
987
|
+
case "print:short": {
|
|
988
|
+
return "Print aggregated rules (short view)";
|
|
989
|
+
}
|
|
990
|
+
case "config:json": {
|
|
991
|
+
return "Show effective runtime config (JSON)";
|
|
992
|
+
}
|
|
993
|
+
case "config:short": {
|
|
994
|
+
return "Show effective runtime config (short view)";
|
|
995
|
+
}
|
|
996
|
+
case "init": {
|
|
997
|
+
return "Initialize local configuration";
|
|
998
|
+
}
|
|
999
|
+
case "help": {
|
|
1000
|
+
return "Show CLI help";
|
|
1001
|
+
}
|
|
1002
|
+
default: {
|
|
1003
|
+
return commandLabel;
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
968
1006
|
}
|
|
969
1007
|
function formatConfigSource(cwd, configPath) {
|
|
970
1008
|
if (!configPath) {
|
package/dist/index.js
CHANGED
|
@@ -176,7 +176,7 @@ async function executeCheck(cwd, format, defaultInvocation = false) {
|
|
|
176
176
|
if (format !== "status") {
|
|
177
177
|
writeRunContextHeader(cwd, defaultInvocation ? "check" : `check:${format}`, foundConfig?.path, storedSnapshots);
|
|
178
178
|
if (shouldShowRunLogs()) {
|
|
179
|
-
writeSubtleInfo("
|
|
179
|
+
writeSubtleInfo("\u{1F50E} Checking current ESLint configuration...\n");
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
if (!foundConfig) {
|
|
@@ -199,13 +199,13 @@ async function executeCheck(cwd, format, defaultInvocation = false) {
|
|
|
199
199
|
if (storedSnapshots.size === 0) {
|
|
200
200
|
const summary = summarizeSnapshots(currentSnapshots);
|
|
201
201
|
process.stdout.write(
|
|
202
|
-
`
|
|
202
|
+
`Rules found in this analysis: ${summary.groups} groups, ${summary.rules} rules (severity mix: ${summary.error} errors, ${summary.warn} warnings, ${summary.off} off).
|
|
203
203
|
`
|
|
204
204
|
);
|
|
205
205
|
const canPromptBaseline = defaultInvocation || format === "summary";
|
|
206
206
|
if (canPromptBaseline && process.stdin.isTTY && process.stdout.isTTY) {
|
|
207
207
|
const shouldCreateBaseline = await askYesNo(
|
|
208
|
-
"No baseline yet.
|
|
208
|
+
"No baseline yet. Do you want to save this analyzed rule state as your baseline now? [Y/n] ",
|
|
209
209
|
true
|
|
210
210
|
);
|
|
211
211
|
if (shouldCreateBaseline) {
|
|
@@ -252,7 +252,7 @@ async function executeUpdate(cwd, printSummary) {
|
|
|
252
252
|
const storedSnapshots = await loadStoredSnapshots(cwd);
|
|
253
253
|
writeRunContextHeader(cwd, "update", foundConfig?.path, storedSnapshots);
|
|
254
254
|
if (shouldShowRunLogs()) {
|
|
255
|
-
writeSubtleInfo("
|
|
255
|
+
writeSubtleInfo("\u{1F50E} Checking current ESLint configuration...\n");
|
|
256
256
|
}
|
|
257
257
|
if (!foundConfig) {
|
|
258
258
|
writeSubtleInfo(
|
|
@@ -291,7 +291,7 @@ async function executePrint(cwd, format) {
|
|
|
291
291
|
const storedSnapshots = await loadStoredSnapshots(cwd);
|
|
292
292
|
writeRunContextHeader(cwd, `print:${format}`, foundConfig?.path, storedSnapshots);
|
|
293
293
|
if (shouldShowRunLogs()) {
|
|
294
|
-
writeSubtleInfo("
|
|
294
|
+
writeSubtleInfo("\u{1F50E} Checking current ESLint configuration...\n");
|
|
295
295
|
}
|
|
296
296
|
const currentSnapshots = await computeCurrentSnapshots(cwd);
|
|
297
297
|
if (format === "short") {
|
|
@@ -310,7 +310,7 @@ async function executeConfig(cwd, format) {
|
|
|
310
310
|
const storedSnapshots = await loadStoredSnapshots(cwd);
|
|
311
311
|
writeRunContextHeader(cwd, `config:${format}`, foundConfig?.path, storedSnapshots);
|
|
312
312
|
if (shouldShowRunLogs()) {
|
|
313
|
-
writeSubtleInfo("Resolving effective runtime configuration...\n");
|
|
313
|
+
writeSubtleInfo("\u2699\uFE0F Resolving effective runtime configuration...\n");
|
|
314
314
|
}
|
|
315
315
|
const config = await loadConfig(cwd);
|
|
316
316
|
const resolved = await resolveWorkspaceAssignments(cwd, config);
|
|
@@ -761,7 +761,6 @@ function printWhatChanged(changes, currentSnapshots, eslintVersionsByGroup) {
|
|
|
761
761
|
- workspace membership changes: ${changeSummary.workspace}
|
|
762
762
|
- current baseline: ${currentSummary.groups} groups, ${currentSummary.rules} rules
|
|
763
763
|
- current severity mix: ${currentSummary.error} errors, ${currentSummary.warn} warnings, ${currentSummary.off} off
|
|
764
|
-
|
|
765
764
|
`
|
|
766
765
|
);
|
|
767
766
|
writeEslintVersionSummary(eslintVersionsByGroup);
|
|
@@ -871,11 +870,14 @@ function endRunTimer(exitCode) {
|
|
|
871
870
|
activeRunTimer.pauseStartedAtMs = void 0;
|
|
872
871
|
}
|
|
873
872
|
const elapsedMs = Math.max(0, Date.now() - activeRunTimer.startedAtMs - activeRunTimer.pausedMs);
|
|
874
|
-
const color = createColorizer();
|
|
875
|
-
const status = exitCode === 0 ? color.green("done") : color.red("failed");
|
|
876
873
|
const seconds = (elapsedMs / 1e3).toFixed(2);
|
|
877
|
-
|
|
874
|
+
if (exitCode === 0) {
|
|
875
|
+
writeSubtleInfo(`Finished in ${seconds}s
|
|
876
|
+
`);
|
|
877
|
+
} else {
|
|
878
|
+
writeSubtleInfo(`Finished with errors in ${seconds}s
|
|
878
879
|
`);
|
|
880
|
+
}
|
|
879
881
|
activeRunTimer = void 0;
|
|
880
882
|
}
|
|
881
883
|
function pauseRunTimer() {
|
|
@@ -935,17 +937,53 @@ function writeRunContextHeader(cwd, commandLabel, configPath, storedSnapshots) {
|
|
|
935
937
|
return;
|
|
936
938
|
}
|
|
937
939
|
const color = createColorizer();
|
|
938
|
-
process.stdout.write(color.bold(`eslint-config-snapshot v${readCliVersion()}
|
|
940
|
+
process.stdout.write(color.bold(`eslint-config-snapshot v${readCliVersion()} \u2022 ${formatCommandDisplayLabel(commandLabel)}
|
|
939
941
|
`));
|
|
940
|
-
process.stdout.write(
|
|
941
|
-
`);
|
|
942
|
-
process.stdout.write(`Repository: ${cwd}
|
|
942
|
+
process.stdout.write(`\u{1F4C1} Repository: ${cwd}
|
|
943
943
|
`);
|
|
944
|
-
process.stdout.write(
|
|
944
|
+
process.stdout.write(`\u{1F4C1} Baseline: ${formatStoredSnapshotSummary(storedSnapshots)}
|
|
945
945
|
`);
|
|
946
|
-
process.stdout.write(
|
|
947
|
-
|
|
946
|
+
process.stdout.write(`\u2699\uFE0F Config source: ${formatConfigSource(cwd, configPath)}
|
|
948
947
|
`);
|
|
948
|
+
process.stdout.write("\n");
|
|
949
|
+
}
|
|
950
|
+
function formatCommandDisplayLabel(commandLabel) {
|
|
951
|
+
switch (commandLabel) {
|
|
952
|
+
case "check":
|
|
953
|
+
case "check:summary": {
|
|
954
|
+
return "Check drift against baseline (summary)";
|
|
955
|
+
}
|
|
956
|
+
case "check:diff": {
|
|
957
|
+
return "Check drift against baseline (detailed diff)";
|
|
958
|
+
}
|
|
959
|
+
case "check:status": {
|
|
960
|
+
return "Check drift against baseline (status only)";
|
|
961
|
+
}
|
|
962
|
+
case "update": {
|
|
963
|
+
return "Update baseline snapshot";
|
|
964
|
+
}
|
|
965
|
+
case "print:json": {
|
|
966
|
+
return "Print aggregated rules (JSON)";
|
|
967
|
+
}
|
|
968
|
+
case "print:short": {
|
|
969
|
+
return "Print aggregated rules (short view)";
|
|
970
|
+
}
|
|
971
|
+
case "config:json": {
|
|
972
|
+
return "Show effective runtime config (JSON)";
|
|
973
|
+
}
|
|
974
|
+
case "config:short": {
|
|
975
|
+
return "Show effective runtime config (short view)";
|
|
976
|
+
}
|
|
977
|
+
case "init": {
|
|
978
|
+
return "Initialize local configuration";
|
|
979
|
+
}
|
|
980
|
+
case "help": {
|
|
981
|
+
return "Show CLI help";
|
|
982
|
+
}
|
|
983
|
+
default: {
|
|
984
|
+
return commandLabel;
|
|
985
|
+
}
|
|
986
|
+
}
|
|
949
987
|
}
|
|
950
988
|
function formatConfigSource(cwd, configPath) {
|
|
951
989
|
if (!configPath) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-config-snapshot/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -30,6 +30,6 @@
|
|
|
30
30
|
"@inquirer/prompts": "^8.2.0",
|
|
31
31
|
"commander": "^14.0.3",
|
|
32
32
|
"fast-glob": "^3.3.3",
|
|
33
|
-
"@eslint-config-snapshot/api": "0.
|
|
33
|
+
"@eslint-config-snapshot/api": "0.8.0"
|
|
34
34
|
}
|
|
35
35
|
}
|
package/src/index.ts
CHANGED
|
@@ -270,7 +270,7 @@ async function executeCheck(cwd: string, format: CheckFormat, defaultInvocation
|
|
|
270
270
|
if (format !== 'status') {
|
|
271
271
|
writeRunContextHeader(cwd, defaultInvocation ? 'check' : `check:${format}`, foundConfig?.path, storedSnapshots)
|
|
272
272
|
if (shouldShowRunLogs()) {
|
|
273
|
-
writeSubtleInfo('
|
|
273
|
+
writeSubtleInfo('🔎 Checking current ESLint configuration...\n')
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
|
|
@@ -293,18 +293,18 @@ async function executeCheck(cwd: string, format: CheckFormat, defaultInvocation
|
|
|
293
293
|
|
|
294
294
|
throw error
|
|
295
295
|
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
)
|
|
301
|
-
|
|
302
|
-
const canPromptBaseline = defaultInvocation || format === 'summary'
|
|
303
|
-
if (canPromptBaseline && process.stdin.isTTY && process.stdout.isTTY) {
|
|
304
|
-
const shouldCreateBaseline = await askYesNo(
|
|
305
|
-
'No baseline yet. Use current rule state as your baseline now? [Y/n] ',
|
|
306
|
-
true
|
|
296
|
+
if (storedSnapshots.size === 0) {
|
|
297
|
+
const summary = summarizeSnapshots(currentSnapshots)
|
|
298
|
+
process.stdout.write(
|
|
299
|
+
`Rules found in this analysis: ${summary.groups} groups, ${summary.rules} rules (severity mix: ${summary.error} errors, ${summary.warn} warnings, ${summary.off} off).\n`
|
|
307
300
|
)
|
|
301
|
+
|
|
302
|
+
const canPromptBaseline = defaultInvocation || format === 'summary'
|
|
303
|
+
if (canPromptBaseline && process.stdin.isTTY && process.stdout.isTTY) {
|
|
304
|
+
const shouldCreateBaseline = await askYesNo(
|
|
305
|
+
'No baseline yet. Do you want to save this analyzed rule state as your baseline now? [Y/n] ',
|
|
306
|
+
true
|
|
307
|
+
)
|
|
308
308
|
if (shouldCreateBaseline) {
|
|
309
309
|
await writeSnapshots(cwd, currentSnapshots)
|
|
310
310
|
const summary = summarizeSnapshots(currentSnapshots)
|
|
@@ -356,7 +356,7 @@ async function executeUpdate(cwd: string, printSummary: boolean): Promise<number
|
|
|
356
356
|
const storedSnapshots = await loadStoredSnapshots(cwd)
|
|
357
357
|
writeRunContextHeader(cwd, 'update', foundConfig?.path, storedSnapshots)
|
|
358
358
|
if (shouldShowRunLogs()) {
|
|
359
|
-
writeSubtleInfo('
|
|
359
|
+
writeSubtleInfo('🔎 Checking current ESLint configuration...\n')
|
|
360
360
|
}
|
|
361
361
|
|
|
362
362
|
if (!foundConfig) {
|
|
@@ -399,7 +399,7 @@ async function executePrint(cwd: string, format: PrintFormat): Promise<void> {
|
|
|
399
399
|
const storedSnapshots = await loadStoredSnapshots(cwd)
|
|
400
400
|
writeRunContextHeader(cwd, `print:${format}`, foundConfig?.path, storedSnapshots)
|
|
401
401
|
if (shouldShowRunLogs()) {
|
|
402
|
-
writeSubtleInfo('
|
|
402
|
+
writeSubtleInfo('🔎 Checking current ESLint configuration...\n')
|
|
403
403
|
}
|
|
404
404
|
const currentSnapshots = await computeCurrentSnapshots(cwd)
|
|
405
405
|
|
|
@@ -420,7 +420,7 @@ async function executeConfig(cwd: string, format: PrintFormat): Promise<void> {
|
|
|
420
420
|
const storedSnapshots = await loadStoredSnapshots(cwd)
|
|
421
421
|
writeRunContextHeader(cwd, `config:${format}`, foundConfig?.path, storedSnapshots)
|
|
422
422
|
if (shouldShowRunLogs()) {
|
|
423
|
-
writeSubtleInfo('Resolving effective runtime configuration...\n')
|
|
423
|
+
writeSubtleInfo('⚙️ Resolving effective runtime configuration...\n')
|
|
424
424
|
}
|
|
425
425
|
const config = await loadConfig(cwd)
|
|
426
426
|
const resolved = await resolveWorkspaceAssignments(cwd, config)
|
|
@@ -969,7 +969,7 @@ function printWhatChanged(
|
|
|
969
969
|
process.stdout.write(color.red('Heads up: snapshot drift detected.\n'))
|
|
970
970
|
writeSectionTitle('Summary', color)
|
|
971
971
|
process.stdout.write(
|
|
972
|
-
`- changed groups: ${changes.length}\n- introduced rules: ${changeSummary.introduced}\n- removed rules: ${changeSummary.removed}\n- severity changes: ${changeSummary.severity}\n- options changes: ${changeSummary.options}\n- workspace membership changes: ${changeSummary.workspace}\n- current baseline: ${currentSummary.groups} groups, ${currentSummary.rules} rules\n- current severity mix: ${currentSummary.error} errors, ${currentSummary.warn} warnings, ${currentSummary.off} off\n
|
|
972
|
+
`- changed groups: ${changes.length}\n- introduced rules: ${changeSummary.introduced}\n- removed rules: ${changeSummary.removed}\n- severity changes: ${changeSummary.severity}\n- options changes: ${changeSummary.options}\n- workspace membership changes: ${changeSummary.workspace}\n- current baseline: ${currentSummary.groups} groups, ${currentSummary.rules} rules\n- current severity mix: ${currentSummary.error} errors, ${currentSummary.warn} warnings, ${currentSummary.off} off\n`
|
|
973
973
|
)
|
|
974
974
|
writeEslintVersionSummary(eslintVersionsByGroup)
|
|
975
975
|
process.stdout.write('\n')
|
|
@@ -1090,10 +1090,12 @@ function endRunTimer(exitCode: number): void {
|
|
|
1090
1090
|
}
|
|
1091
1091
|
|
|
1092
1092
|
const elapsedMs = Math.max(0, Date.now() - activeRunTimer.startedAtMs - activeRunTimer.pausedMs)
|
|
1093
|
-
const color = createColorizer()
|
|
1094
|
-
const status = exitCode === 0 ? color.green('done') : color.red('failed')
|
|
1095
1093
|
const seconds = (elapsedMs / 1000).toFixed(2)
|
|
1096
|
-
|
|
1094
|
+
if (exitCode === 0) {
|
|
1095
|
+
writeSubtleInfo(`Finished in ${seconds}s\n`)
|
|
1096
|
+
} else {
|
|
1097
|
+
writeSubtleInfo(`Finished with errors in ${seconds}s\n`)
|
|
1098
|
+
}
|
|
1097
1099
|
activeRunTimer = undefined
|
|
1098
1100
|
}
|
|
1099
1101
|
|
|
@@ -1169,11 +1171,50 @@ function writeRunContextHeader(
|
|
|
1169
1171
|
}
|
|
1170
1172
|
|
|
1171
1173
|
const color = createColorizer()
|
|
1172
|
-
process.stdout.write(color.bold(`eslint-config-snapshot v${readCliVersion()}\n`))
|
|
1173
|
-
process.stdout.write(
|
|
1174
|
-
process.stdout.write(
|
|
1175
|
-
process.stdout.write(
|
|
1176
|
-
process.stdout.write(
|
|
1174
|
+
process.stdout.write(color.bold(`eslint-config-snapshot v${readCliVersion()} • ${formatCommandDisplayLabel(commandLabel)}\n`))
|
|
1175
|
+
process.stdout.write(`📁 Repository: ${cwd}\n`)
|
|
1176
|
+
process.stdout.write(`📁 Baseline: ${formatStoredSnapshotSummary(storedSnapshots)}\n`)
|
|
1177
|
+
process.stdout.write(`⚙️ Config source: ${formatConfigSource(cwd, configPath)}\n`)
|
|
1178
|
+
process.stdout.write('\n')
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
function formatCommandDisplayLabel(commandLabel: string): string {
|
|
1182
|
+
switch (commandLabel) {
|
|
1183
|
+
case 'check':
|
|
1184
|
+
case 'check:summary': {
|
|
1185
|
+
return 'Check drift against baseline (summary)'
|
|
1186
|
+
}
|
|
1187
|
+
case 'check:diff': {
|
|
1188
|
+
return 'Check drift against baseline (detailed diff)'
|
|
1189
|
+
}
|
|
1190
|
+
case 'check:status': {
|
|
1191
|
+
return 'Check drift against baseline (status only)'
|
|
1192
|
+
}
|
|
1193
|
+
case 'update': {
|
|
1194
|
+
return 'Update baseline snapshot'
|
|
1195
|
+
}
|
|
1196
|
+
case 'print:json': {
|
|
1197
|
+
return 'Print aggregated rules (JSON)'
|
|
1198
|
+
}
|
|
1199
|
+
case 'print:short': {
|
|
1200
|
+
return 'Print aggregated rules (short view)'
|
|
1201
|
+
}
|
|
1202
|
+
case 'config:json': {
|
|
1203
|
+
return 'Show effective runtime config (JSON)'
|
|
1204
|
+
}
|
|
1205
|
+
case 'config:short': {
|
|
1206
|
+
return 'Show effective runtime config (short view)'
|
|
1207
|
+
}
|
|
1208
|
+
case 'init': {
|
|
1209
|
+
return 'Initialize local configuration'
|
|
1210
|
+
}
|
|
1211
|
+
case 'help': {
|
|
1212
|
+
return 'Show CLI help'
|
|
1213
|
+
}
|
|
1214
|
+
default: {
|
|
1215
|
+
return commandLabel
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1177
1218
|
}
|
|
1178
1219
|
|
|
1179
1220
|
function formatConfigSource(cwd: string, configPath: string | undefined): string {
|
|
@@ -101,7 +101,7 @@ describe('cli terminal invocation', () => {
|
|
|
101
101
|
const result = run([])
|
|
102
102
|
expect(result.status).toBe(1)
|
|
103
103
|
expect(result.stdout).toBe(
|
|
104
|
-
'
|
|
104
|
+
'Rules found in this analysis: 1 groups, 3 rules (severity mix: 2 errors, 0 warnings, 1 off).\nYou are almost set: no baseline snapshot found yet.\nRun `eslint-config-snapshot --update` to create your first baseline.\n'
|
|
105
105
|
)
|
|
106
106
|
})
|
|
107
107
|
|