community-themes icon indicating copy to clipboard operation
community-themes copied to clipboard

Escape patterns script not working correctly

Open MaggieCabrera opened this issue 1 year ago • 2 comments

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'
}

MaggieCabrera avatar Mar 26 '24 09:03 MaggieCabrera

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. Captura de pantalla de 2024-04-05 19-59-01

Steps to reproduce error:

  1. Delete or rename a pattern file (for example poetry/index.php)
  2. Run npm run patterns:escape

joanrodas avatar Apr 05 '24 18:04 joanrodas

@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!

MaggieCabrera avatar Apr 06 '24 14:04 MaggieCabrera