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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃彈馃殌 Significantly speed up gulp prettify #25140

Merged
merged 1 commit into from Oct 18, 2019
Merged

馃彈馃殌 Significantly speed up gulp prettify #25140

merged 1 commit into from Oct 18, 2019

Conversation

rsimha
Copy link
Contributor

@rsimha rsimha commented Oct 18, 2019

PR Highlights:

  • No longer invokes node_modules/.bin/prettier once per file
  • Uses the gulp-prettier package to stream all files
  • Continues to print all formatting errors after execution

Time to check / fix ~300 files:

Copy link
Collaborator

@estherkim estherkim left a comment

Choose a reason for hiding this comment

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

Was curious so I checked gulp-prettier. Looks like we will have version mismatches if we use this.
https://github.com/bhargavrpatel/gulp-prettier/blob/master/package.json#L31

Do we need to use this gulp plugin? Can we use prettier directly?

Copy link
Contributor Author

@rsimha rsimha left a comment

Choose a reason for hiding this comment

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

Worthwhile question to ask, but this isn't a problem. With node's semantic versioning, the plugin will continue to use our version until the major version of prettier changes. At that point, the renovate upgrade PR for prettier will catch any resulting errors.

amphtml: 1.18.2
gulp-prettier: ^1.5.3

This means the plugin will use the latest available version that doesn't change the major version 1.

Sanity check 1: yarn.lock confirms that only version 1.18 is installed to node_modules.

Sanity check 2: The quoteProps option (that we rely on) was only added in version 1.17. If gulp-prettier were using version 1.5, it wouldn't be able to parse .prettierrc.

Copy link
Collaborator

@estherkim estherkim left a comment

Choose a reason for hiding this comment

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

TIL. Thanks for the detailed explanation!

@rsimha rsimha merged commit 4a1b576 into ampproject:master Oct 18, 2019
@rsimha rsimha deleted the 2019-10-17-GulpPrettier branch October 18, 2019 21:24
jeffjose pushed a commit to jeffjose/amphtml that referenced this pull request Oct 19, 2019
joshuarrrr pushed a commit to Parsely/amphtml that referenced this pull request Oct 22, 2019
micajuine-ho pushed a commit to micajuine-ho/amphtml that referenced this pull request Dec 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants