Skip to content

Fix/v1.0.2 issues - #3

Merged
akshat009 merged 2 commits into
mainfrom
fix/v1.0.2-issues
Aug 19, 2026
Merged

Fix/v1.0.2 issues#3
akshat009 merged 2 commits into
mainfrom
fix/v1.0.2-issues

Conversation

@akshat009

Copy link
Copy Markdown
Owner

No description provided.

- .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.
@akshat009
akshat009 merged commit 3348b72 into mainAug 19, 2026
2 checks passed
akshat009 added a commit that referenced this pull request Aug 29, 2026
The 8.0 floor from audit #3 was heavier than needed: the only 8.0-only
construct in the whole template set is the `: mixed` return type on
Container::get(). Everything else the templates use (arrow functions,
typed properties, null-coalescing assignment) is PHP 7.4.
- validateMinPhp: floor at 7.4 (was 8.0); reject < 7.4.
- requiredPhpFor(modules): new helper, mirrors requiredWpVersion — returns
the highest of 7.4 and any per-module floor (MODULE_PHP_FLOOR, empty
today). Non-interactive uses it as the default and rejects an explicit
--min-php below it; interactive reconciles after module selection since
the PHP prompt runs first.
- templateFlags.php_8_0 (minPhp >= 8.0) gates `: mixed` in Container.php
via an inline {{#if}} — 8.0+ targets keep the hint, 7.4 drops it.
- Generated PHPUnit matrix + phpcs testVersion + composer "php" + plugin
header all already follow {{MIN_PHP}}; CI matrix list gains a 7.4 leg.
Verified: 68/68 unit tests; all-modules 7.4 scaffold — php -l clean, JSON
valid, no `: mixed` / stray tags, CI matrix ['7.4'..'8.3'].
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@akshat009