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

Masterbar: Copy module code to package #37342

Merged
merged 57 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
ece311c
Masterbar: Copy module code to package
fgiannar May 10, 2024
214897c
changelog
fgiannar May 10, 2024
3cd3862
Remove minified css file
fgiannar May 10, 2024
7d2fecf
Masterbar package: Build assets and use production files
fgiannar May 13, 2024
2668d60
Maserbar: Update text-domain to match package
fgiannar May 13, 2024
2000512
Masterbar: Make linter happy
fgiannar May 13, 2024
23c831d
Masterbar: Update path for enqueueing inline-help.css style
fgiannar May 13, 2024
75268b5
Masterbar: PHP codesniffer hotfix for unit test class
fgiannar May 13, 2024
5e4fdcf
Masterbar: Add eslint exception for strict more usage
fgiannar May 13, 2024
cae099f
Add eslint-disable rules related to JSDoc requires
fgiannar May 14, 2024
513f7a5
Add more eslint-disable rules related to JSDoc requires
fgiannar May 14, 2024
e75fb21
Fun with phan: From 270 to 27 issues
fgiannar May 17, 2024
214e812
Merge branch 'trunk' into update/copy-masterbar-code-to-pkg
fgiannar May 17, 2024
efe07f6
Update pnpm lock
fgiannar May 17, 2024
3b5dac2
More fun with phan
fgiannar May 17, 2024
4b63fb7
Update phan config with Jetpack-the-plugin dependencies
fgiannar May 17, 2024
fa17861
More phan fixes, less fun
fgiannar May 17, 2024
69977ad
Merge branch 'trunk' into update/copy-masterbar-code-to-pkg
fgiannar May 20, 2024
bce1261
Remove redundant phan-var declarations
fgiannar May 20, 2024
fe0be3b
Masterbar: Fix phan undeclared class \Automattic\Jetpack\Scan\Admin_B…
fgiannar May 20, 2024
6bd7432
Masterbar: Add compat package dependency
fgiannar May 20, 2024
5319d47
Ensure all package unit tests pass
fgiannar May 20, 2024
42ba4eb
Add phan suppress line rule for JETPACK__GLOTPRESS_LOCALES_PATH
fgiannar May 20, 2024
30e2dd2
Masterbar: Add phan baseline file
fgiannar May 20, 2024
e763f45
Msaterbar: Rename build folder to dist
fgiannar May 20, 2024
375e0eb
Merge branch 'trunk' into update/copy-masterbar-code-to-pkg
fgiannar May 21, 2024
c948551
Update projects/packages/masterbar/src/admin-menu/class-base-admin-me…
fgiannar May 21, 2024
9cc3290
Update projects/packages/masterbar/src/admin-menu/class-base-admin-me…
fgiannar May 21, 2024
922c783
Update projects/packages/masterbar/src/inline-help/class-inline-help.php
fgiannar May 21, 2024
85e7563
Merge branch 'update/copy-masterbar-code-to-pkg' of github.com:Automa…
fgiannar May 21, 2024
0fc9c9e
Masterbar: Update webpack config and load assets via assets package
fgiannar May 23, 2024
6c7b583
Masterbar: Use patchwork-redefine-exit package
fgiannar May 23, 2024
05692db
Phpunit: Add missing PHPUnitPolyfills for PHP7 compatibility
fgiannar May 24, 2024
e299455
Masterbar: Add unit tests for loading assets
fgiannar May 24, 2024
86779c0
PHP Unit: Keep using outdated setMethods while PHP7.0 and 7.1 is supp…
fgiannar May 27, 2024
e5c0bc0
Update .gitattributes with production-include
fgiannar May 27, 2024
0ecda4f
Masterbar: More unit tests
fgiannar May 27, 2024
0f34f63
Masterbar: Add phan suppression in unit test
fgiannar May 27, 2024
c5930b2
Masterbar: Ensure needed files get built before the tests are run
fgiannar May 27, 2024
c6bb434
Masterbar: Add 'glob' in package's devDependecies
fgiannar May 27, 2024
639a282
Update pnpm-lock file
fgiannar May 27, 2024
d117431
Masterbar: Fix all package annotations
fgiannar May 28, 2024
e79ce88
Masterbar: Fix more package annotations
fgiannar May 28, 2024
a278452
Masterbar: Add missing namespace for WPCOM_Email_Subscription_Checker
fgiannar May 28, 2024
de2ac65
Masterbar: Fix Fatals in Main related to invalid file paths
fgiannar May 29, 2024
a2b5a0f
Masterbar: Updates based on latest Masterbar module changes
fgiannar May 29, 2024
26ca5c6
Masterbar package: Backport Masterbar module updates
fgiannar May 30, 2024
4c07da2
Merge branch 'trunk' into update/copy-masterbar-code-to-pkg
fgiannar May 30, 2024
2319eaf
Masterbar: Backport phan related Masterbar module updates
fgiannar May 30, 2024
2279a8f
Update projects/packages/masterbar/tools/webpack.config.js
fgiannar May 31, 2024
f93b3aa
Update projects/packages/masterbar/tools/webpack.config.js
fgiannar May 31, 2024
666011a
Update projects/packages/masterbar/tools/webpack.config.js
fgiannar May 31, 2024
8265d6c
Masterbar: Update .gitattributes
fgiannar May 31, 2024
dce6fde
Masterbar: Update README
fgiannar May 31, 2024
958132a
Merge branch 'trunk' into update/copy-masterbar-code-to-pkg
fgiannar May 31, 2024
9020d8d
Merge branch 'trunk' into update/copy-masterbar-code-to-pkg
fgiannar May 31, 2024
61029c4
Merge remote-tracking branch 'origin/trunk' into update/copy-masterba…
anomiex May 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
58 changes: 57 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions projects/packages/masterbar/.gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ package.json export-ignore

# Files to include in the mirror repo, but excluded via gitignore
# Remember to end all directories with `/**` to properly tag every file.
# /src/js/example.min.js production-include
dist/** production-include

# Files to exclude from the mirror repo, but included in the monorepo.
# Remember to end all directories with `/**` to properly tag every file.
Copy link
Contributor

Choose a reason for hiding this comment

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

Some additional stuff you might production-exclude here:

  • tools/**
  • Probably also src/**/*.scss and src/**/*.css and src/**/*.js, since they're all compiled into JS in dist/ now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done via 8265d6c

.gitignore production-exclude
.phpcs.dir.xml production-exclude
.phpcsignore production-exclude
changelog/** production-exclude
phpunit.xml.dist production-exclude
.phpcs.dir.xml production-exclude
src/**/*.css production-exclude
src/**/*.js production-exclude
src/**/*.scss production-exclude
tests/** production-exclude
.phpcsignore production-exclude
tools/** production-exclude
3 changes: 3 additions & 0 deletions projects/packages/masterbar/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
vendor/
node_modules/
wordpress/

dist/
.cache/
28 changes: 28 additions & 0 deletions projects/packages/masterbar/.phan/baseline.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
/**
* This is an automatically generated baseline for Phan issues.
* When Phan is invoked with --load-baseline=path/to/baseline.php,
* The pre-existing issues listed in this file won't be emitted.
*
* This file can be updated by invoking Phan with --save-baseline=path/to/baseline.php
* (can be combined with --load-baseline)
*/
return [
// # Issue statistics:
// PhanNoopNew : 5 occurrences
// PhanPluginUnreachableCode : 1 occurrence
// PhanTypeInstantiateAbstract : 1 occurrence
// PhanTypeMismatchArgument : 1 occurrence
// PhanTypeSuspiciousEcho : 1 occurrence
// PhanUndeclaredClassReference : 1 occurrence

// Currently, file_suppressions and directory_suppressions are the only supported suppressions
'file_suppressions' => [
'src/admin-menu/class-wpcom-admin-menu.php' => ['PhanTypeMismatchArgument'],
'src/class-main.php' => ['PhanNoopNew'],
'src/profile-edit/bootstrap.php' => ['PhanNoopNew'],
'tests/php/test-class-admin-color-schemes.php' => ['PhanNoopNew'],
],
// 'directory_suppressions' => ['src/directory_name' => ['PhanIssueName1', 'PhanIssueName2']] can be manually added if needed.
// (directory_suppressions will currently be ignored by subsequent calls to --save-baseline, but may be preserved in future Phan releases)
];
24 changes: 23 additions & 1 deletion projects/packages/masterbar/.phan/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,26 @@
// Require base config.
require __DIR__ . '/../../../../.phan/config.base.php';

return make_phan_config( dirname( __DIR__ ) );
// We need to load the wpcom and amp stubs too.
return make_phan_config(
dirname( __DIR__ ),
array(
'+stubs' => array( 'wpcom', 'amp' ),
'parse_file_list' => array(

/*
Reference files to handle code checking for stuff from Jetpack-the-plugin or other in-monorepo plugins.
* Wherever feasible we should really clean up this sort of thing instead of adding stuff here.
*
* DO NOT add references to files in other packages like this! Generally packages should be listed in composer.json 'require'.
* If there are truly optional dependencies or circular dependencies that can't be cleaned up, one package may list the
* other in 'require-dev' and `extra.dependencies.test-only' instead. See packages/config for an example.
*/
__DIR__ . '/../../../plugins/jetpack/3rd-party/class.jetpack-amp-support.php',
__DIR__ . '/../../../plugins/jetpack/modules/custom-css/custom-css.php',
__DIR__ . '/../../../plugins/jetpack/modules/notes.php',
__DIR__ . '/../../../plugins/jetpack/modules/scan/class-admin-bar-notice.php',
__DIR__ . '/../../../plugins/jetpack/modules/stats.php',
),
)
);
29 changes: 22 additions & 7 deletions projects/packages/masterbar/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# masterbar
# Masterbar

The WordPress.com Toolbar feature replaces the default admin bar and offers quick links to the Reader, all your sites, your WordPress.com profile, and notifications.

## How to install masterbar
## Get Started

### Installation From Git Repo
Package is published in [Packagist](https://packagist.org/packages/automattic/jetpack-masterbar). We recommend using the latest version there, or you can also test with the latest development versions like below:

## Contribute

## Get Help
```
"require": {
"automattic/jetpack-autoloader": "dev-trunk",
"automattic/jetpack-masterbar": "dev-trunk"
}
```

## Using this package in your WordPress plugin

Expand All @@ -18,7 +21,19 @@ If you plan on using this package in your WordPress plugin, we would recommend t

Need to report a security vulnerability? Go to [https://automattic.com/security/](https://automattic.com/security/) or directly to our security bug bounty site [https://hackerone.com/automattic](https://hackerone.com/automattic).

## Build System

_Note: `cd` to `projects/packages/masterbar` before running these commands_

- `npm run build`<br>
Compiles the plugins for development - the files are not minified and we produce a source map.

- `npm run build-production`<br>
Compiles the plugins for production - we produce minified files without source maps.

- `npm run clean`<br>
Removes all build files.

## License

masterbar is licensed under [GNU General Public License v2 (or later)](./LICENSE.txt)

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: changed

Masterbar: Copy module code to package
24 changes: 20 additions & 4 deletions projects/packages/masterbar/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,22 @@
"type": "jetpack-library",
"license": "GPL-2.0-or-later",
"require": {
"php": ">=7.0"
"php": ">=7.0",
"automattic/jetpack-assets": "@dev",
"automattic/jetpack-blaze": "@dev",
"automattic/jetpack-compat": "@dev",
"automattic/jetpack-device-detection": "@dev",
"automattic/jetpack-connection": "@dev",
"automattic/jetpack-jitm": "@dev",
"automattic/jetpack-logo": "@dev",
"automattic/jetpack-plans": "@dev",
"automattic/jetpack-status": "@dev"
},
"require-dev": {
"brain/monkey": "2.6.1",
"yoast/phpunit-polyfills": "1.1.0",
"automattic/jetpack-changelogger": "@dev",
"automattic/patchwork-redefine-exit": "@dev",
"automattic/wordbless": "dev-master"
},
"autoload": {
Expand All @@ -17,14 +28,19 @@
]
},
"scripts": {
"build-development": "echo 'Add your build step to composer.json, please!'",
"build-production": "echo 'Add your build step to composer.json, please!'",
"build-production": [
"pnpm run build-production"
],
"build-development": [
"pnpm run build"
],
"phpunit": [
"./vendor/phpunit/phpunit/phpunit --colors=always"
],
"post-install-cmd": "WorDBless\\Composer\\InstallDropin::copy",
"post-update-cmd": "WorDBless\\Composer\\InstallDropin::copy",
"test-php": [
"pnpm run build-production",
"@composer phpunit"
]
},
Expand Down Expand Up @@ -55,7 +71,7 @@
"mirror-repo": "Automattic/jetpack-masterbar",
"textdomain": "jetpack-masterbar",
"version-constants": {
"::PACKAGE_VERSION": "src/class-masterbar.php"
"::PACKAGE_VERSION": "src/class-main.php"
}
},
"suggest": {
Expand Down
35 changes: 29 additions & 6 deletions projects/packages/masterbar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,34 @@
"license": "GPL-2.0-or-later",
"author": "Automattic",
"scripts": {
"build": "echo 'Not implemented.'",
"build-js": "echo 'Not implemented.'",
"build-production": "echo 'Not implemented.'",
"build-production-js": "echo 'Not implemented.'",
"clean": "true"
"build": "pnpm run clean && pnpm run build-js",
"build-js": "webpack --config tools/webpack.config.js",
"build-production": "pnpm run clean && pnpm run build-production-js && pnpm run validate",
"build-production-js": "NODE_ENV=production BABEL_ENV=production pnpm run build-js",
"clean": "rm -rf dist/ .cache/",
"validate": "pnpm exec validate-es --no-error-on-unmatched-pattern dist/",
"watch": "pnpm run build && pnpm webpack watch"
},
"devDependencies": {}
"dependencies": {
"@automattic/calypso-color-schemes": "3.1.3",
"@automattic/color-studio": "2.6.0",
"postcss-custom-properties": "12.1.7"
},
"devDependencies": {
"@automattic/jetpack-webpack-config": "workspace:*",
"@automattic/remove-asset-webpack-plugin": "workspace:*",
"autoprefixer": "10.4.14",
"@csstools/postcss-global-data": "2.1.1",
"@babel/core": "7.24.0",
"@wordpress/browserslist-config": "5.39.0",
"@wordpress/dependency-extraction-webpack-plugin": "5.7.0",
"core-js": "3.23.5",
"glob": "10.3.15",
"postcss": "8.4.31",
"postcss-loader": "6.2.0",
"sass": "1.64.1",
"sass-loader": "12.4.0",
"webpack": "5.76.0",
"webpack-cli": "4.9.1"
}
}