Skip to content

Commit

Permalink
README
Browse files Browse the repository at this point in the history
  • Loading branch information
srtfisher committed Jul 11, 2024
1 parent e033197 commit 7e0efd7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 77 deletions.
87 changes: 12 additions & 75 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,11 @@ Requires PHP: 8.1

License: GPL v2 or later

[![Coding Standards](https://github.com/alleyinteractive/wp-command-palette/actions/workflows/coding-standards.yml/badge.svg)](https://github.com/alleyinteractive/wp-command-palette/actions/workflows/coding-standards.yml)
[![Testing Suite](https://github.com/alleyinteractive/wp-command-palette/actions/workflows/unit-test.yml/badge.svg)](https://github.com/alleyinteractive/wp-command-palette/actions/workflows/unit-test.yml)

Admin-wide command palette for easy access to setting pages..
Admin-wide command palette for easy access to setting pages in and outside of the block editor.

## Installation

You can install the package via composer:
You can install the package via Composer:

```bash
composer require alleyinteractive/wp-command-palette
Expand All @@ -31,79 +28,19 @@ composer require alleyinteractive/wp-command-palette

Activate the plugin in WordPress and use it like so:

```php
$plugin = Alley\WP\Command_Palette\WP_Command_Palette\WP_Command_Palette();
$plugin->perform_magic();
```
![Screenshot of plugin](./assets/screenshot.png)

## Testing
When activated, the plugin will read all the available WordPress admin menu/bar
items and allow you to easily search for them in the
[WordPress Command Palette](https://make.wordpress.org/core/2023/07/17/introducing-the-wordpress-command-palette-api/). You can open the command palette
by pressing `cmd + k` or `ctrl + k` on Windows.

Run `npm run test` to run Jest tests against JavaScript files. Run
`npm run test:watch` to keep the test runner open and watching for changes.
## Testing

Run `npm run lint` to run ESLint against all JavaScript files. Linting will also
happen when running development or production builds.

Run `composer test` to run tests against PHPUnit and the PHP code in the plugin.

### The `entries` directory and entry points

All directories created in the `entries` directory can serve as entry points and will be compiled with [@wordpress/scripts](https://github.com/WordPress/gutenberg/blob/trunk/packages/scripts/README.md#scripts) into the `build` directory with an accompanied `index.asset.php` asset map.

#### Scaffolding an entry point

To generate a new entry point, run the following command:

```sh
npm run create-entry
```

To generate a new slotfill, run the following command:

```sh
npm run create-slotfill
```

The command will prompt the user through several options for creating an entry or slotfill. The entries are scaffolded with the `@alleyinteractive/create-entry` script. Run the help command to see all the options:

```sh
npx @alleyinteractive/create-entry --help
```
[Visit the package README](https://www.npmjs.com/package/@alleyinteractive/create-entry) for more information.

#### Enqueuing Entry Points

You can also include an `index.php` file in the entry point directory for enqueueing or registering a script. This file will then be moved to the build directory and will be auto-loaded with the `load_scripts()` function in the `functions.php` file. Alternatively, if a script is to be enqueued elsewhere there are helper functions in the `src/assets.php` file for getting the assets.

### Scaffold a dynamic block with `create-block`

Use the `create-block` command to create custom blocks with [@alleyinteractive/create-block](https://github.com/alleyinteractive/alley-scripts/tree/main/packages/create-block) script and follow the prompts to generate all the block assets in the `blocks/` directory.
Block registration, script creation, etc will be scaffolded from the `create-block` script. Run `npm run build` to compile and build the custom block. Blocks are enqueued using the `load_scripts()` function in `src/assets.php`.

### Updating WP Dependencies

Update the [WordPress dependency packages](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-scripts/#packages-update) used in the project to their latest version.

To update `@wordpress` dependencies to their latest version use the packages-update command:

```sh
npx wp-scripts packages-update
```

This script provides the following custom options:

- `--dist-tag` – allows specifying a custom dist-tag when updating npm packages. Defaults to `latest`. This is especially useful when using [`@wordpress/dependency-extraction-webpack-plugin`](https://www.npmjs.com/package/@wordpress/dependency-extraction-webpack-plugin). It lets installing the npm dependencies at versions used by the given WordPress major version for local testing, etc. Example:

```sh
npx wp-scripts packages-update --dist-tag=wp-WPVERSION`
```

Where `WPVERSION` is the version of WordPress you are targeting. The version
must include both the major and minor version (e.g., `6.1`). For example:

```sh
npx wp-scripts packages-update --dist-tag=wp-6.1`
```
Run `composer test` to run tests against the PHP code in the plugin.

## Releasing the Plugin

Expand All @@ -125,11 +62,11 @@ Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed re

This project is actively maintained by [Alley
Interactive](https://github.com/alleyinteractive). Like what you see? [Come work
with us](https://alley.co/careers/).
with us](https://alley.com/careers/).

- [Sean Fisher](https://github.com/Sean Fisher)
- [Sean Fisher](https://github.com/srtfisher)
- [All Contributors](../../contributors)

## License

The GNU General Public License (GPL) license. Please see [License File](LICENSE) for more information.
The GNU General Public License (GPL) license. Please see [License File](LICENSE) for more information.
Binary file added assets/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@
"start:hot": "alley-build start --hot",
"stylelint:fix": "stylelint --fix \"**/*.scss\"",
"stylelint": "stylelint \"**/*.scss\" --allow-empty-input",
"test:watch": "jest --watch",
"test": "jest --passWithNoTests"
"test": "npm run lint"
},
"dependencies": {
"@wordpress/block-editor": "^12.10.14",
Expand Down

0 comments on commit 7e0efd7

Please sign in to comment.