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 main Aug 19, 2026
2 checks passed
Sign up for free to 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