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

Prevent re-bundling WordPress packages #1781

Merged
merged 6 commits into from Jan 3, 2019

Conversation

Projects
None yet
3 participants
@westonruter
Copy link
Member

commented Dec 27, 2018

  • Eliminate re-bundling of @wordpress/dom-ready and @wordpress/i18n to instead rely on existing bundles if available. Ensure both are marked as devDependencies.
  • Include new standalone bundles of @wordpress/dom-ready and @wordpress/i18n if not available (e.g. in WordPress 4.9 without Gutenberg).
  • Eliminate use of JSHint to avoid having to maintain duplicate duplicate linter as ESLint.

The @wordpress/dom-ready package is bundled with both WordPress 5.0 and Gutenberg as wp-dom-ready, so we should use it.

Also, @wordpress/i18n is not even used in the project anymore, so we don't need it at all.

Problem: If on 4.9 and Gutenberg is not installed, then we need to polyfill wp-dom-ready with jQuery.ready(). Nevertheless, we are currently depending on wp-i18n even though it may not be available either. So we might need to make the plugin require WordPress 5.0 or WordPress 4.9 with Gutenberg as the minimum version. Or perhaps in that case we should still bundle those dependencies as separate scripts that we register? If we want to support 4.9 without Gutenberg, then I suppose this is what we'd have to do. @felixarntz thoughts?

Closes #1763.

@googlebot googlebot added the cla: yes label Dec 27, 2018

@felixarntz

This comment has been minimized.

Copy link
Collaborator

commented Dec 28, 2018

@westonruter Couldn't we bundle the wp-i18n and wp-dom-ready scripts in compiled versions and register them if they aren't yet available (by core)? I think that's the least error-prone solution, doesn't require too many changes. Whenever we decide to drop 4.x support, we can remove them without further change.

@westonruter westonruter changed the title [WIP] Remove redundant WordPress NPM packages Remove redundant WordPress NPM packages Dec 31, 2018

@westonruter westonruter changed the title Remove redundant WordPress NPM packages Prevent re-bundling WordPress packages Dec 31, 2018

@westonruter westonruter requested a review from felixarntz Dec 31, 2018

@westonruter

This comment has been minimized.

Copy link
Member Author

commented Dec 31, 2018

@felixarntz this is ready to go!

@westonruter westonruter added this to the v 1.0.2 milestone Dec 31, 2018

westonruter added some commits Dec 27, 2018

Remove .jshintrc with its incompatible ES version
We should rely on ESLint alone for JS linting now.
This is a follow-up to f955432

@westonruter westonruter force-pushed the remove/redundant-dependencies-1.0 branch from 70f4400 to d5dbf32 Dec 31, 2018

@felixarntz
Copy link
Collaborator

left a comment

Two minor questions, otherwise good to go.

sourcesPointer();
} );
// Run at DOM ready.
jQuery( sourcesPointer );

This comment has been minimized.

Copy link
@felixarntz

felixarntz Jan 2, 2019

Collaborator

I might miss something, but shouldn't this use wp.domReady somehow?

This comment has been minimized.

Copy link
@westonruter

westonruter Jan 2, 2019

Author Member

We could use wp.domReady but this script is already depending on jQuery so we can use jQuery ready instead which does the same thing.

Show resolved Hide resolved includes/amp-helper-functions.php Outdated

@westonruter westonruter force-pushed the remove/redundant-dependencies-1.0 branch from 8b6c0be to 8e2090e Jan 2, 2019

@westonruter

This comment has been minimized.

Copy link
Member Author

commented Jan 2, 2019

Ok, issues have been addressed.

@westonruter westonruter merged commit c96e3cd into 1.0 Jan 3, 2019

3 checks passed

cla/google All necessary CLAs are signed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@westonruter westonruter deleted the remove/redundant-dependencies-1.0 branch Jan 3, 2019

@westonruter westonruter referenced this pull request Jan 17, 2019

Merged

Fix building assets #1828

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.