Commit db80824
Add comprehensive docs for newcomers (#8)
* Add comprehensive documentation for newcomers
Split monolithic README into focused docs pages covering input formats,
CLI reference, output formats, comparison modes, and programmatic API.
The README now serves as a concise overview with links to deeper docs.
Key improvements:
- Explain what config files are and where YAML/JSON configs come from
- Show clear before/after examples for plugin-aware and rule matching
- Document all supported file formats with inline code examples
- Clarify the left/right convention and how labels are derived
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Update package-lock.json from local install
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add dump command and modularize CLI architecture
Introduce `dump` subcommand to serialize live webpack/rspack configs to
YAML/JSON/inspect format. Refactor CLI into focused modules:
configLoader, configSerializer, configCleaner, fileWriter, yamlSerializer,
and buildConfigFile. Update README, CLI reference, and programmatic API
docs to reflect new capabilities. Add integration tests for dump command.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Address all PR review comments on documentation accuracy
- Fix detailed output examples in getting-started.md, output-formats.md,
README.md to match actual formatContextual output (correct header,
comparing format, field labels, values grouping, legend)
- Add normalizePaths and format to DiffEngine constructor options in
programmatic-api.md
- Remove unsupported ES module export default section from .js input
format docs and add note about hardcoded argv.mode="production"
- Add bash/text language tags to all unlabeled fenced code blocks
for markdownlint MD040 compliance
- Fix exit code 0 description to include --help case
- Fix YAML format description to document grouped changes structure
vs flat entries array
- Fix plugin-aware output example to show instance-level change
reporting instead of incorrect nested property diffs
- Move JSON file labels out of json-fenced blocks to avoid invalid
comment syntax
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Address PR review comments on source code quality and security
- Fix hardcoded mode:"production" in configLoader — dump command now
passes --environment value to function config exports
- Fix fileWriter path validation: throw instead of warn-only when
writing outside cwd/tmpdir; route diff --output through FileWriter
- Fix naive path prefix match in configCleaner (cherry-pick 7fa0898)
- Deduplicate identical array serialization branches in yamlSerializer
- Quote YAML keys containing special characters (colons, brackets, etc.)
- Error on unset env vars in build config instead of silent empty string
- Fix N+1 file reads in resolveAllBuilds
- Filter DefinePlugin definitions in --clean mode
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Address remaining PR review comments on correctness and safety
- Quote YAML-ambiguous scalar strings (true, false, null, numbers, etc.)
in both serializeString and quoteKey to preserve round-trip fidelity
- Use explicit CORE_SCHEMA for yaml.load in configLoader to block unsafe
tags while allowing standard scalar coercion
- Add RegExp instance check in configCleaner to prevent silent destruction
of regex patterns (e.g., module.rules[].test) during --clean
- Add BigInt handling to jsonReplacer to prevent JSON.stringify TypeError
- Add readOptionValue helper to CLI parsers to prevent flags from being
consumed as values for preceding options (e.g., --left --right=b)
- Validate --output and --save-dir as mutually exclusive in dump parser
- Remove no-op array filter in configCleaner to preserve array indices
- Align dump default mode to "production" to match diff and webpack CLI
- Log target directory when using default save dir for multi-config output
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix inconsistent environment default and env var expansion bug
- Make build-config dump path default to "production" matching both
webpack's own default and the single-file dump path
- Use nullish coalescing (??) instead of logical OR (||) in env var
expansion so empty string values are preserved
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Fix YAML serialization edge cases and improve safety checks
- Quote empty strings to prevent YAML null interpretation (key: "" not key: )
- Add YAML quoting for strings starting with >, ?, -, % (block indicators)
- Escape control characters (\t, \r) in quoted YAML strings
- Validate output path before creating directory in writeSingleFile
- Preserve original ts-node error when it fails for non-missing reasons
- Align EnvironmentPlugin filtering to use [FILTERED] placeholder
(consistent with DefinePlugin handling)
- Use Object.getPrototypeOf in configCleaner's getConstructorName
(matches yamlSerializer, prevents spoofing via own property)
- Preserve constructor names on empty nested objects in YAML output
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix option parsing, env defaults, and serialization edge cases
- Extract readOptionValue helper to fix option parsing when next arg
starts with a dash (e.g. --format --left would misparse)
- Change default environment from "development" to "production" for
dump commands to match typical production config inspection use case
- Use ?? instead of || for env var expansion so empty string defaults
are preserved
- Add --output/--save-dir mutual exclusivity validation
- Add informational message when auto-selecting save directory
- Handle BigInt values in JSON serializer to prevent crash
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Address review comments: cache eviction, trailing newlines, env ordering, blank lines
- Recursively clear require.cache subtree so helper modules that read
process.env at module scope get fresh values across build-matrix iterations
- Normalize trailing-newline handling: both dump paths now trimEnd() before
printing to stdout for consistent piped output
- Apply --env before resolving build matrix so placeholders in build
definitions see CLI-supplied environment variables
- Preserve blank lines in YAML array serialization by iterating all lines
(not just non-empty) when emitting block content
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Add dump module unit tests and review workflow command
* Fix lint errors and improve documentation clarity
Fix eslint errors: preserve-caught-error violations in buildConfigFile and
configLoader, no-useless-escape in test templates, unused import in
configCleaner test. Add .context/ and .claude/ to eslint and prettier
ignore lists. Improve docs formatting and readability across all
documentation files.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Address review comments: env expansion, YAML quoting, path validation, exit codes
- Fix ${BUNDLER:-default} to use CLI bundler param instead of process.env
- Use single-pass regex in expandString to prevent double-expansion
- Treat empty env vars as unset for ${VAR:-default} (bash :- semantics)
- Add | to serializeString quoting triggers for valid YAML output
- Apply makePathRelative to multiline strings in serializeObject
- Validate output directory path before creating it in writeMultipleFiles
- Apply --env variables before --list-builds returns
- Use exit code 2 for errors, reserving 1 for "differences found"
- Fix ES2020 compat: remove Error cause (requires ES2022+), add lint disables
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Fail fast on filename collisions in writeMultipleFiles
Detect duplicate basenames before writing to prevent silent data loss
when two outputs normalize to the same filename.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Address review comments: YAML control chars, dash values, filename sanitization, list-builds validation
- Escape C0 control characters (\x00-\x08, \x0b, \x0c, \x0e-\x1f, \x7f)
in YAML double-quoted strings to produce valid YAML output
- Remove dash-prefix rejection in readOptionValue to restore old behavior
where space-separated option values like --path-separator - work
- Sanitize OS-problematic characters in generateFilename components
- Reject --output/--save-dir when combined with --list-builds
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Fix prettier formatting in yamlSerializer.ts
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Address PR review comments: exit codes, option parsing, cache clearing, YAML key order, symlink safety, clean filtering, empty output guard
- Fix exit code table in docs to show code 2 for errors (was incorrectly merged into code 1)
- Fix --environment default in docs from "development" to "production" to match implementation
- Remove unused optionName parameter from readOptionValue
- Add flag-prefix check in readOptionValue to prevent flags being consumed as option values
- Skip node_modules in recursive require cache clearing to avoid evicting shared dependencies
- Preserve insertion order for YAML object keys instead of alphabetical sorting
- Resolve symlinks in validateOutputPath to prevent symlink-based path traversal
- Expand --clean secret filtering to cover ProvidePlugin
- Add empty outputs guard in runDumpFromBuildConfig to prevent TypeError
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Address unresolved PR review items for dump and serializers
* Fix prettier formatting in buildConfigFile.ts and cli.integration.test.js
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent d8ac19d commit db80824
26 files changed
Lines changed: 4598 additions & 270 deletions
File tree
- docs
- src
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
9 | 12 | | |
10 | 13 | | |
11 | | - | |
| 14 | + | |
12 | 15 | | |
13 | 16 | | |
14 | 17 | | |
| 18 | + | |
15 | 19 | | |
16 | 20 | | |
17 | 21 | | |
18 | 22 | | |
19 | 23 | | |
20 | 24 | | |
21 | 25 | | |
22 | | - | |
| 26 | + | |
23 | 27 | | |
24 | | - | |
25 | | - | |
26 | | - | |
| 28 | + | |
27 | 29 | | |
28 | | - | |
| 30 | + | |
29 | 31 | | |
30 | 32 | | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
| 33 | + | |
36 | 34 | | |
37 | 35 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
44 | 40 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
| 41 | + | |
| 42 | + | |
52 | 43 | | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
| 44 | + | |
61 | 45 | | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
68 | 86 | | |
69 | 87 | | |
| 88 | + | |
| 89 | + | |
70 | 90 | | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
| 91 | + | |
76 | 92 | | |
77 | 93 | | |
| 94 | + | |
| 95 | + | |
78 | 96 | | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
85 | 100 | | |
86 | | - | |
| 101 | + | |
| 102 | + | |
87 | 103 | | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
| 104 | + | |
| 105 | + | |
92 | 106 | | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
| 107 | + | |
| 108 | + | |
114 | 109 | | |
115 | | - | |
| 110 | + | |
| 111 | + | |
116 | 112 | | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
156 | 127 | | |
157 | 128 | | |
158 | | - | |
| 129 | + | |
159 | 130 | | |
160 | | - | |
161 | | - | |
| 131 | + | |
162 | 132 | | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
167 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
168 | 152 | | |
169 | 153 | | |
170 | 154 | | |
171 | 155 | | |
172 | 156 | | |
173 | 157 | | |
174 | 158 | | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
175 | 173 | | |
176 | 174 | | |
177 | | - | |
| 175 | + | |
178 | 176 | | |
179 | | - | |
180 | | - | |
181 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
182 | 186 | | |
183 | 187 | | |
184 | 188 | | |
185 | 189 | | |
186 | 190 | | |
187 | 191 | | |
188 | 192 | | |
189 | | - | |
190 | | - | |
191 | 193 | | |
192 | 194 | | |
193 | 195 | | |
0 commit comments