Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace CRLF with LF when generating unminified assets #33509

Conversation

scinos
Copy link
Contributor

@scinos scinos commented Jul 16, 2021

Description

Add a feature in @wordpress/readable-js-assets-webpack-plugin so it replaces CRLF with LF line endings when generating unminified assets.

How has this been tested?

I run npm run build before and after this patch, and compared both outputs with diff -qr build-base/ build-patch/. Then I verified that the only differences are that CRLF characters are gone.

Screenshots

Types of changes

Bug fix

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).

@github-actions
Copy link

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @scinos! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Jul 16, 2021
Copy link
Member

@fullofcaffeine fullofcaffeine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tests well! 👍🏻

build (fix/readable-js-assets-webpack-plugin-line-endings)$ find . -name 'index.js' -type f -exec file -- {} +
./edit-post/index.js:                          UTF-8 Unicode text, with very long lines
./date/index.js:                               UTF-8 Unicode text, with very long lines
./html-entities/index.js:                      UTF-8 Unicode text
./is-shallow-equal/index.js:                   ASCII text
./redux-routine/index.js:                      ASCII text
./rich-text/index.js:                          ASCII text
./url/index.js:                                UTF-8 Unicode text
./data/index.js:                               UTF-8 Unicode text, with very long lines
./admin-manifest/index.js:                     ASCII text
./data-controls/index.js:                      ASCII text
./deprecated/index.js:                         ASCII text
./reusable-blocks/index.js:                    ASCII text
./server-side-render/index.js:                 ASCII text
./escape-html/index.js:                        ASCII text
./customize-widgets/index.js:                  UTF-8 Unicode text, with very long lines
./dom-ready/index.js:                          ASCII text
./viewport/index.js:                           ASCII text
./block-serialization-default-parser/index.js: ASCII text
./shortcode/index.js:                          ASCII text
./annotations/index.js:                        ASCII text, with very long lines
./a11y/index.js:                               ASCII text
./block-library/index.js:                      UTF-8 Unicode text, with very long lines
./token-list/index.js:                         C++ source, UTF-8 Unicode text
./edit-navigation/index.js:                    UTF-8 Unicode text, with very long lines
./edit-widgets/index.js:                       UTF-8 Unicode text, with very long lines
./plugins/index.js:                            ASCII text
./priority-queue/index.js:                     ASCII text
./compose/index.js:                            UTF-8 Unicode text, with very long lines
./components/index.js:                         UTF-8 Unicode text, with very long lines
./hooks/index.js:                              ASCII text
./editor/index.js:                             UTF-8 Unicode text, with very long lines
./media-utils/index.js:                        ASCII text
./format-library/index.js:                     ASCII text, with very long lines
./keycodes/index.js:                           UTF-8 Unicode text
./react-i18n/index.js:                         ASCII text
./nux/index.js:                                ASCII text
./block-directory/index.js:                    UTF-8 Unicode text, with very long lines
./element/index.js:                            UTF-8 Unicode text, with very long lines
./block-editor/index.js:                       UTF-8 Unicode text, with very long lines
./api-fetch/index.js:                          ASCII text
./notices/index.js:                            ASCII text
./core-data/index.js:                          ASCII text, with very long lines
./primitives/index.js:                         ASCII text
./edit-site/index.js:                          UTF-8 Unicode text, with very long lines
./autop/index.js:                              UTF-8 Unicode text, with very long lines
./blob/index.js:                               ASCII text
./warning/index.js:                            ASCII text
./dom/index.js:                                ASCII text
./widgets/index.js:                            ASCII text, with very long lines
./blocks/index.js:                             UTF-8 Unicode text, with very long lines
./block-serialization-spec-parser/index.js:    Pascal source, ASCII text
./i18n/index.js:                               UTF-8 Unicode text
./list-reusable-blocks/index.js:               ASCII text
./keyboard-shortcuts/index.js:                 ASCII text
./wordcount/index.js:                          ASCII text, with very long lines

Notice there are no mentions of with CRLF, LF line terminators for any of the unminimize js assets.

@fullofcaffeine fullofcaffeine merged commit c852346 into WordPress:trunk Jul 20, 2021
@github-actions
Copy link

Congratulations on your first merged pull request, @scinos! We'd like to credit you for your contribution in the post announcing the next WordPress release, but we can't find a WordPress.org profile associated with your GitHub account. When you have a moment, visit the following URL and click "link your GitHub account" under "GitHub Username" to link your accounts:

https://profiles.wordpress.org/me/profile/edit/

And if you don't have a WordPress.org account, you can create one on this page:

https://login.wordpress.org/register

Kudos!

@github-actions github-actions bot added this to the Gutenberg 11.2 milestone Jul 20, 2021
@talldan talldan added the [Type] Build Tooling Issues or PRs related to build tooling label Jul 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Type] Build Tooling Issues or PRs related to build tooling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants