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

Dependencies: Fix broken prod dependencies #13343

Merged
merged 2 commits into from
Sep 16, 2019
Merged

Conversation

sirreal
Copy link
Member

@sirreal sirreal commented Aug 27, 2019

Changes proposed in this Pull Request:

This was working because @wordpress/url is installed as a transitive dependency, @wordpress/e2e-test-utils (a devDependency) causes it to be installed. If @wordpress/e2e-test-utils (like with yarn install --production) - @wordpress/url is not installed.

I believe, this is only a problem with extensions that have "SSR" from the implementation in #13070, at the moment only Simple Payments. At runtime in the browser, @wordpress/* dependencies are externals, meaning they are pulled from the runtime environment. That makes the presence or absence of a @wordpress/* package irrelevant. However, with #13070 SSR, some of these dependencies will be required at build time.

See p1566905517230900-slack-luna / d871cf9

Testing instructions:

@sirreal sirreal added [Type] Bug When a feature is broken and / or not performing as intended [Status] In Progress Simple Payments Build labels Aug 27, 2019
@sirreal sirreal self-assigned this Aug 27, 2019
@matticbot
Copy link
Contributor

Caution: This PR has changes that must be merged to WordPress.com
Hello sirreal! These changes need to be synced to WordPress.com - If you 're an a11n, please commandeer, review, and approve D32074-code before merging this PR. Thank you!

@jeherve jeherve added this to the 7.7 milestone Aug 27, 2019
@jetpackbot
Copy link
Collaborator

Warnings
⚠️

pre-commit hook was skipped for one or more commits

⚠️ "Proposed changelog entry" is missing for this PR. Please include any meaningful changes

This is an automated check which relies on PULL_REQUEST_TEMPLATE. We encourage you to follow that template as it helps Jetpack maintainers do their job. If you think 'Testing instructions' or 'Proposed changelog entry' are not needed for your PR - please explain why you think so. Thanks for cooperation 🤖

Generated by 🚫 dangerJS against 55702a8

@sirreal sirreal requested review from a team August 27, 2019 14:29
@sirreal sirreal added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels Aug 27, 2019
@sirreal sirreal marked this pull request as ready for review August 27, 2019 14:32
@ockham
Copy link
Contributor

ockham commented Aug 28, 2019

I believe, this is only a problem with extensions that have "SSR" from the implementation in #13070, at the moment only Simple Payments. At runtime in the browser, @wordpress/* dependencies are externals, meaning they are pulled from the runtime environment. That makes the presence or absence of a @wordpress/* package irrelevant. However, with #13070 SSR, some of these dependencies will be required at build time.

Yes, that's the exact reason why I was adding those as devDeps.

@ockham
Copy link
Contributor

ockham commented Aug 28, 2019

Not entirely sure I'm following the rationale here. Should it not be enough to keep them as devDeps (and proably add @wordpress/url there) if we're dropping production-only dependency installation anyway? (My main point would be to use deps vs devDeps to visibly distinguish between deps that actually need to be installed, vs external ones.)

@sirreal
Copy link
Member Author

sirreal commented Aug 28, 2019

Not entirely sure I'm following the rationale here. Should it not be enough to keep them as devDeps (and proably add @wordpress/url there) if we're dropping production-only dependency installation anyway? (My main point would be to use deps vs devDeps to visibly distinguish between deps that actually need to be installed, vs external ones.)

Yes, if we drop the production-only installation it doesn't matter where dependencies are declared. I'd remove devDependencies entirely and consider a lint rule to prohibit its use. That's my preference for simplicity and would obviate the rest of this response.

For an application like Jetpack which isn't a published package, there's no clear distinction about what dependencies and devDependencies are. It's one set of dependencies and a superset of those, we can make an arbitrary decision between dependencies and devDependencies.

At runtime, we don't need any dependencies. @zinigor mentioned that some devDependencies are large, take a lot of time and space to install, and cause problems with the beta builder. That would mean that one place we can make the dep/devDep separation is "necessary for building the application" or not. That aligns with Jetpack, the (unpublished) Jetpack npm app is really only serves the purpose of building assets for the Jetpack plugin. calypso-build is a dependency, it's required for running the core functionality of the app - building assets. devDependencies can become the extras that aren't essential for building the assets - things like e2e testing packages.

@ockham
Copy link
Contributor

ockham commented Aug 28, 2019

Okay, sounds like a good approach! 👍

@jeherve jeherve modified the milestones: 7.7, 7.8 Sep 2, 2019
Copy link
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

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

It works well as is. Merging.

@jeherve jeherve added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review This PR is ready for review. labels Sep 16, 2019
@jeherve jeherve merged commit a9f7c33 into master Sep 16, 2019
@jeherve jeherve deleted the fix/broken-prod-dependencies branch September 16, 2019 18:36
@matticbot matticbot removed the [Status] Ready to Merge Go ahead, you can push that green button! label Sep 16, 2019
@jeherve jeherve added the [Block] Pay With Paypal aka Simple Payments label Feb 12, 2021
@jeherve jeherve added the [Feature] Pay with PayPal aka Simple Payments label Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Pay With Paypal aka Simple Payments Build [Feature] Pay with PayPal aka Simple Payments [Pri] BLOCKER [Type] Bug When a feature is broken and / or not performing as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants