https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39353 Victor Grousset/tuxayo <victor@tuxayo.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #179386|0 |1 is obsolete| | --- Comment #5 from Victor Grousset/tuxayo <victor@tuxayo.net> --- Created attachment 179387 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=179387&action=edit Bug 39353: Prevent tidy.pl to empty template files In ktd context: if host's node_modules ktd has been generated prior to bug 38644, the template-toolkit's prettier plugin is not there and prettier will empty the file. It seems to be a prettier bug, and the following behaviour is confusing:
From the host: % yarn run prettier --write koha-tmpl/intranet-tmpl/prog/en/modules/test.tt yarn run v1.22.22 $ prettier koha-tmpl/intranet-tmpl/prog/en/modules/test.tt [error] Cannot find module '@koha-community/prettier-plugin-template-toolkit' [error] Require stack: [error] - /home/jonathan/workspace/koha/node_modules/prettier/index.js [error] - /home/jonathan/workspace/koha/node_modules/prettier/cli.js [error] - /home/jonathan/workspace/koha/node_modules/prettier/bin-prettier.js error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
=> The file is not modified Within ktd: $ yarn run prettier --write koha-tmpl/intranet-tmpl/prog/en/modules/test.tt yarn run v1.22.22 $ prettier --write koha-tmpl/intranet-tmpl/prog/en/modules/test.tt koha-tmpl/intranet-tmpl/prog/en/modules/test.tt 6ms Done in 0.39s. => No error, and the file is emptied! It seems that the plugin is found by prettier but not used (?) Test plan: 1. Follow this from step 1 to 14 https://gitlab.com/koha-community/koha-testing-docker/-/issues/483 2. Apply patch 3. misc/devel/tidy.pl --no-write koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt It should print the new error message 4. Make a change to a .tt file, commit 5. There will be a message about and issue with prettier. But it will still commit. It's expect. 6. Inspect and see that the commit has the changes Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> -- You are receiving this mail because: You are watching all bug changes.