Fix/v1.0.2 issues - #3
Merged
Merged
Conversation
- .gitattributes (* text=auto eol=lf) + full renormalize: forces LF for every
tracked text file regardless of the committing machine's core.autocrlf.
Root cause of the P0 where mixed CRLF/LF within a single generated file
corrupted PHP_CodeSniffer's tokenizer and produced up to 184 cascading
false errors on `composer lint` in the all-modules scaffold. Verified:
0 errors across all 4 scaffold variants after this fix (was 11/184/4/7).
- index.js: symlink-safe main-guard (P0). npm/npx install the CLI behind a
symlink on macOS/Linux; process.argv[1] was the symlink path while
__filename was already realpath-resolved, so the guard's raw-path
comparison never matched and main() silently never ran. Now resolves
process.argv[1] via fs.realpathSync before comparing.
- index.js: validatePrefix / suggestPrefix minimum raised 2 to 4 chars (P1).
WPCS's PrefixAllGlobals.ShortPrefixPassed sniff flags prefixes under 4
characters as a collision risk (empirically verified: 3-char prefix still
triggers it, 4-char does not -- corrects an earlier assumption of 3).
templates/phpcs.xml: removed the severity-0 override that was suppressing
that exact diagnostic, so short prefixes fail loudly instead of silently
producing bogus PrefixAllGlobals.NonPrefixed*Found errors. suggestPrefix's
auto-derived initials (e.g. "My Plugin" -> "mp") are now padded out to
stay >= 4 chars so the interactive default keeps working.
- index.js: validateModules rejects unknown --modules values instead of
silently dropping them (P2). Module list hoisted to a shared
MODULE_DEFINITIONS/VALID_MODULES constant reused by the interactive
choices and the new validator, so they can't drift apart.
- index.js: validateEmail now checks a practical email shape instead of
just requiring an "@" character -- "@@@@" no longer passes (P2).
- templates/composer.json: package "name" derives from the slugified
author name (falls back to literal "vendor") instead of a hardcoded
"vendor/{{SLUG}}" that looked like a forgotten placeholder (P3).
tests/generator.test.js: updated assertions for the new 4-char prefix floor
and added regression coverage for validateModules, validateEmail, and the
composer.json vendor-name derivation (both the author-derived and
empty-author-fallback cases). Full suite: 24/24 passing.
Verified against all 4 scaffold variants (minimal / all-modules+react /
react-only / partial-modules): composer install/validate --strict/lint/test
all clean, php -l clean, npm test clean. Version left at 1.0.1 -- bump and
publish is a separate step.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.