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

My Jetpack: Add initial skeleton #21464

Merged
merged 32 commits into from
Nov 17, 2021
Merged

My Jetpack: Add initial skeleton #21464

merged 32 commits into from
Nov 17, 2021

Conversation

leogermani
Copy link
Contributor

@leogermani leogermani commented Oct 20, 2021

This PR bootstraps the My Jetpack package, including a React app that will hold the whole My Jetpack page on admin.

For now, it's a very simple skeleton. Header and Footer are there as placeholders as we still need to work on these generic components and shared CSS styles.

Changes proposed in this Pull Request:

  • Adds the skeleton of the My Jetpack package and JS app

Jetpack product discussion

p9dueE-3Ae-p2

Does this pull request change what data or activity we track or use?

No

Testing instructions:

  • Make sure Jetpack and my-jetpack package are built
  • Add define( 'JETPACK_ENABLE_MY_JETPACK', true ); to your wp-config.php
  • Make sure there's a My Jetpack submenu under the Jetpack top-level menu
  • Look at the code organization and give feedback - it was mostly copied from the connection-ui package

@github-actions github-actions bot added [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Package] My Jetpack labels Oct 20, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Oct 20, 2021

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ⚠️ All commits were linted before commit.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available.


Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped.
Then, add the "[Status] Needs Team review" label and ask someone from your team review the code.
Once you’ve done so, switch to the "[Status] Needs Review" label; someone from Jetpack Crew will then review this PR and merge it to be included in the next Jetpack release.


Jetpack plugin:

  • Next scheduled release: December 7, 2021.
  • Scheduled code freeze: November 30, 2021.

@github-actions github-actions bot added the [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! label Oct 20, 2021
@matticbot
Copy link
Contributor

Caution: This PR has changes that must be merged to WordPress.com
Hello leogermani! These changes need to be synced to WordPress.com - If you 're an a11n, please commandeer and confirm D68780-code works as expected before merging this PR. Once this PR is merged, please commit the changes to WP.com. Thank you!
This revision will be updated with each commit to this PR

@leogermani leogermani marked this pull request as ready for review October 20, 2021 19:50
@leogermani leogermani added [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. and removed [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! labels Oct 20, 2021
@leogermani leogermani requested a review from sergeymitr October 25, 2021 16:39
projects/packages/my-jetpack/gulpfile.babel.js Outdated Show resolved Hide resolved
projects/packages/my-jetpack/phpunit.xml.dist Outdated Show resolved Hide resolved
projects/packages/my-jetpack/phpunit.xml.dist Outdated Show resolved Hide resolved
Comment on lines 30 to 31
"build-production": "echo 'Add your build step to composer.json, please!'",
"build-development": "echo 'Add your build step to composer.json, please!'"
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like you still need to add the build rules.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@anomiex anomiex added [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! and removed [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels Oct 27, 2021
@leogermani leogermani added [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. and removed [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! labels Nov 8, 2021
Comment on lines 67 to 68
$build_assets = require_once __DIR__ . '/../build/index.asset.php';
wp_enqueue_script( 'my_jetpack_main_app', plugin_dir_url( __DIR__ ) . 'build/index.js', $build_assets['dependencies'], $build_assets['version'], true );
Copy link
Contributor

Choose a reason for hiding this comment

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

We should use Assets::register_script() here. That should automatically handle adding the CSS too once it gets created.

@sergeymitr sergeymitr added [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! and removed [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels Nov 16, 2021
*
* @var boolean
*/
private static $initialized = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we could use an action to only init once? It's something I try to keep in mind that was mentioned to me here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've seen both patterns and I usually prefer the static property, just because it's much more performant. I can see some advantages that @zinigor points out, but at the end of the day it's all theoretical, not sure we ever used these actions for anything else... Let me think this over... If anyone has strong opinions on that let me know. Not a big deal to me

Copy link
Contributor

Choose a reason for hiding this comment

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

not sure we ever used these actions for anything else

It just came to mind since we will be requiring all Jetpack plugins to add this. Exactly what/why someone might hook into that for? 🤷 but it sounds good in theory 😃

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, changed to the hooks approach, I could argue on the cons of this approach, or why it's not effective (we should add two hooks, one before and one after initialization, and offer a way for people to short circuit the initialization if we wanted this to be really useful).

But I like how explicit it is about what's going on, and easier to test

Copy link
Contributor

@sergeymitr sergeymitr left a comment

Choose a reason for hiding this comment

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

Great job! 🚢

@sergeymitr sergeymitr added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! labels Nov 17, 2021
@leogermani leogermani merged commit b90e57f into master Nov 17, 2021
@leogermani leogermani deleted the add/my-jetpack-skeleton branch November 17, 2021 17:02
@github-actions github-actions bot added this to the jetpack/10.4 milestone Nov 17, 2021
@github-actions
Copy link
Contributor

Great news! One last step: head over to your WordPress.com diff, D68780-code, and commit it.
Once you've done so, come back to this PR and add a comment with your changeset ID.

Thank you!

@github-actions github-actions bot removed the [Status] Ready to Merge Go ahead, you can push that green button! label Nov 17, 2021
@kraftbj
Copy link
Contributor

kraftbj commented Nov 18, 2021

Just wanted to note b/c of our naming structure, this becomes the automattic/jetpack-my-jetpack package.

kraftbj added a commit that referenced this pull request Nov 18, 2021
davidlonjon added a commit that referenced this pull request Nov 18, 2021
* master: (28 commits)
  Prepare for 10.4-a.7 (#21797)
  Check if maxwidth exists before trying to call .length (#21785)
  Podcast Player: Increase podcast shown (#21661)
  licensing: jetpack-js-test-runner is a dev dependency (#21794)
  Update dependency @mdn/browser-compat-data to v4.0.11 (#21792)
  Tests: Fix unit tests for wpcom (#21649)
  SSO: Fix Button Text Alignment on Mobile   (#18770)
  Add/my jetpack skeleton (#21464)
  Identity Crisis: add unit tests for has_identity_crisis and get_mismatched_urls (#21754)
  Remove special cases for calling changelogger on packages/changelogger (#21783)
  eslint-config-target-es: Release 1.0.0! (#21766)
  Revert "WPCOM no longer forces home_urls to be http" (#21769)
  WPCOM no longer forces home_urls to be http (#21747)
  Revert and fix "Revert "Assets: do not use the new method yet (#21760)"" (#21763)
  eslint-config-target-es: Fix README.md (#21743)
  codesniffer: Disable CI on PHP 8.1 (#21742)
  RNA Pricing card component: Fix case where prices before and after match (#21757)
  Janitorial: update Jetpack version for 10.4-a.6 cycle (#21762)
  Releases: prepare changelog for 10.4-a.5 release (#21758)
  Assets: do not use the new method yet (#21760)
  ...
@anomiex
Copy link
Contributor

anomiex commented Nov 18, 2021

Just wanted to note b/c of our naming structure, this becomes the automattic/jetpack-my-jetpack package.

It doesn't have to if we don't want it to, that's just the default. We could change the name in composer.json (and maybe a few other places) if we want it to be something different.

@anomiex
Copy link
Contributor

anomiex commented Nov 18, 2021

r235273-wpcom

davidlonjon added a commit that referenced this pull request Nov 19, 2021
* master: (28 commits)
  Prepare for 10.4-a.7 (#21797)
  Check if maxwidth exists before trying to call .length (#21785)
  Podcast Player: Increase podcast shown (#21661)
  licensing: jetpack-js-test-runner is a dev dependency (#21794)
  Update dependency @mdn/browser-compat-data to v4.0.11 (#21792)
  Tests: Fix unit tests for wpcom (#21649)
  SSO: Fix Button Text Alignment on Mobile   (#18770)
  Add/my jetpack skeleton (#21464)
  Identity Crisis: add unit tests for has_identity_crisis and get_mismatched_urls (#21754)
  Remove special cases for calling changelogger on packages/changelogger (#21783)
  eslint-config-target-es: Release 1.0.0! (#21766)
  Revert "WPCOM no longer forces home_urls to be http" (#21769)
  WPCOM no longer forces home_urls to be http (#21747)
  Revert and fix "Revert "Assets: do not use the new method yet (#21760)"" (#21763)
  eslint-config-target-es: Fix README.md (#21743)
  codesniffer: Disable CI on PHP 8.1 (#21742)
  RNA Pricing card component: Fix case where prices before and after match (#21757)
  Janitorial: update Jetpack version for 10.4-a.6 cycle (#21762)
  Releases: prepare changelog for 10.4-a.5 release (#21758)
  Assets: do not use the new method yet (#21760)
  ...
@oskosk oskosk changed the title Add/my jetpack skeleton My Jetpack: Add initial skeleton Jan 10, 2022
@oskosk oskosk mentioned this pull request Jan 10, 2022
47 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] My Jetpack [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ Touches WP.com Files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants