community-themes
community-themes copied to clipboard
Escape patterns script not working correctly
While working on https://github.com/WordPress/community-themes/pull/152 I tried to use the escape patterns script and it was failing:
> [email protected] patterns:escape
> node ./theme-utils.mjs escape-patterns
╔══════════════════════════════════════════╗
║ THEME: poetry ║
║ ║
║ Following patterns may get updated with ║
║ escaped strings and/or image paths ║
╟──────────────────────────────────────────╢
║ poetry/patterns/posts.php ║
╟──────────────────────────────────────────╢
║ poetry/patterns/index.php ║
╚══════════════════════════════════════════╝
? Verify the theme slug poetry
node:events:491
throw er; // Unhandled 'error' event
^
Error: ENOENT: no such file or directory, open 'poetry/patterns/index.php'
Emitted 'error' event on ReadStream instance at:
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: 'poetry/patterns/index.php'
}
This error seems to happen when you delete or rename a file from the patterns folder without commiting to git. If you change the file contents and run the command, the script seems to work fine.
Steps to reproduce error:
- Delete or rename a pattern file (for example poetry/index.php)
- Run npm run patterns:escape
@joanrodas I can avoid the error if I don't rename the file but it still doesn't escape the strings, so the script still needs some debugging apparently. Thanks for your help!