Skip to content

Commit

Permalink
Merge pull request #81 from alleyinteractive/feature/misc-changes
Browse files Browse the repository at this point in the history
Misc changes
  • Loading branch information
renatonascalves authored Oct 24, 2023
2 parents 4e13895 + 0b38920 commit 98b8fce
Show file tree
Hide file tree
Showing 28 changed files with 160 additions and 467 deletions.
5 changes: 0 additions & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ indent_size = 4
indent_style = space
indent_size = 2

# Composer File
[composer.{json,lock}]
indent_style = space
indent_size = 4

# Dotfiles
[.*]
indent_style = space
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Code Quality

on:
push:
branches:
- develop
pull_request:

jobs:
code-quality:
uses: alleyinteractive/.github/.github/workflows/php-composer-command.yml@main
with:
php: 8.1
command: |
phpcs
phpstan
18 changes: 0 additions & 18 deletions .github/workflows/coding-quality.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflows/coding-standards.yml

This file was deleted.

4 changes: 1 addition & 3 deletions .github/workflows/node-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ on:
branches:
- develop
pull_request:
# Uncomment and edit the following to run on a schedule.
# schedule:
# - cron: '15 5 * * 0' # Run once per week at 5:15am UTC on Sundays.

jobs:
node-tests:
uses: alleyinteractive/.github/.github/workflows/node-tests.yml@main
with:
run-audit: true
ci: true
node: 18
7 changes: 2 additions & 5 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@ on:
branches:
- develop
pull_request:
# Uncomment and edit the following to run on a schedule.
# schedule:
# - cron: '30 5 * * 0' # Run once per week at 5:30am UTC on Sundays.

jobs:
php-tests:
unit-tests:
strategy:
matrix:
php: [8.1]
php: [8.1, 8.2]
wordpress: ["latest"]
uses: alleyinteractive/.github/.github/workflows/php-tests.yml@main
with:
Expand Down
9 changes: 6 additions & 3 deletions .phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,16 @@
<!-- Set severity to 1 to see everything that isn't effectively turned off. -->
<arg name="severity" value="1" />

<!-- The version set here matches the minimum version tested in CI. -->
<config name="minimum_supported_wp_version" value="6.3" />

<!-- Check for cross-version support for PHP 8.1 and higher. -->
<config name="testVersion" value="8.1-"/>

<!-- Exclude a few directories and autogenerated files. -->
<exclude-pattern>build/</exclude-pattern>
<exclude-pattern>vendor/</exclude-pattern>

<!-- The version set here matches the minimum version tested in buddy.yml. -->
<config name="minimum_supported_wp_version" value="5.9" />

<!-- Define the prefixes that can be used by the plugin -->
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
<properties>
Expand Down
88 changes: 6 additions & 82 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,88 +1,15 @@
# WP Curate

Contributors: alleyinteractive

Tags: alleyinteractive, wp-curate

Stable tag: 0.1.0

Requires at least: 5.9

Tested up to: 6.1

Requires PHP: 8.1

License: GPL v2 or later

[![Coding Standards](https://github.com/alleyinteractive/wp-curate/actions/workflows/coding-standards.yml/badge.svg)](https://github.com/alleyinteractive/wp-curate/actions/workflows/coding-standards.yml)
[![Testing Suite](https://github.com/alleyinteractive/wp-curate/actions/workflows/unit-test.yml/badge.svg)](https://github.com/alleyinteractive/wp-curate/actions/workflows/unit-test.yml)
[![PHPCS](https://github.com/alleyinteractive/wp-curate/actions/workflows/code-quality.yml/badge.svg)](https://github.com/alleyinteractive/wp-curate/actions/workflows/code-quality.yml)
[![Node Tests](https://github.com/alleyinteractive/wp-curate/actions/workflows/node-tests.yml/badge.svg)](https://github.com/alleyinteractive/wp-curate/actions/workflows/node-tests.yml)

Plugin to curate homepages and other landing pages.

## Installation

You can install the package via composer:

```bash
composer require alleyinteractive/wp-curate
```

## Usage

Activate the plugin in WordPress and use it like so:

```php
$plugin = Alley\WP\WP_Curate\WP_Curate\WP_Curate();
$plugin->perform_magic();
```

## Testing

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.

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.
## Requirements

### 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.

#### 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`
```
WP Curate requires PHP 8.1+. It is developed for use on WordPress 6.3+,
though it may also work on earlier versions.

## Changelog

Expand All @@ -94,9 +21,6 @@ This project is actively maintained by [Alley
Interactive](https://github.com/alleyinteractive). Like what you see? [Come work
with us](https://alley.co/careers/).

- [Alley Interactive](https://github.com/Alley Interactive)
- [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.
6 changes: 2 additions & 4 deletions blocks/query/edit.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable camelcase */
import { PostPicker, TermSelector, Checkboxes } from '@alleyinteractive/block-editor-tools';
import classnames from 'classnames';
import { useDebounce } from '@uidotdev/usehooks';
Expand All @@ -16,6 +17,7 @@ import { __, sprintf } from '@wordpress/i18n';
import { addQueryArgs } from '@wordpress/url';

import type { WP_REST_API_Post, WP_REST_API_Posts } from 'wp-types';
import { Template } from '@wordpress/blocks';

import {
mainDedupe,
Expand Down Expand Up @@ -191,7 +193,6 @@ export default function Edit({
);
path += termQueryArgs;

// setLoading(true);
ApiFetch({
path,
}).then((response) => {
Expand Down Expand Up @@ -261,7 +262,6 @@ export default function Edit({
}
manualPosts = manualPosts.slice(0, numberOfPosts); // eslint-disable-line no-param-reassign

// @ts-ignore
const TEMPLATE: Template[] = [
[
'core/post-template',
Expand Down Expand Up @@ -329,7 +329,6 @@ export default function Edit({
/>
</PanelBody>

{ /* @ts-ignore */ }
<PanelBody
title={__('Select Posts', 'wp-curate')}
initialOpen={false}
Expand All @@ -354,7 +353,6 @@ export default function Edit({
))}
</PanelBody>

{ /* @ts-ignore */ }
<PanelBody
title={__('Query Parameters', 'wp-curate')}
initialOpen={false}
Expand Down
2 changes: 0 additions & 2 deletions blocks/query/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
* @package wp-curate
*/

use Byline_Manager\Models\Profile;

/**
* Registers the block using the metadata loaded from the `block.json` file.
* Behind the scenes, it registers also all assets so they can be enqueued
Expand Down
Loading

0 comments on commit 98b8fce

Please sign in to comment.