Skip to content

Commit

Permalink
Merge pull request #18 from studiopress/update/extension-points
Browse files Browse the repository at this point in the history
Make the free plugin work better with the Pro one
  • Loading branch information
kienstra committed Aug 24, 2020
2 parents 8a9b378 + e5b22c2 commit 9c846f0
Show file tree
Hide file tree
Showing 56 changed files with 6,666 additions and 5,357 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ commands:
set-up-packages:
description: "Installing packages and building"
steps:
- run: composer install && npm install && npm run build
- run: composer remove --dev phpunit/phpunit && composer install && npm ci && npm run build

install-composer:
description: "Installing Composer"
Expand Down Expand Up @@ -75,7 +75,7 @@ jobs:
name: Running PHPUnit
working_directory: *PLUGIN_PATH
command: |
composer install && npm install && npm run build
composer remove --dev phpunit/phpunit && composer install && npm ci && npm run build
composer require --dev phpunit/phpunit 5.7.9
WP_TESTS_DIR=~/project/wordpress-develop/tests/phpunit ./vendor/bin/phpunit
Expand Down
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
js/editor.blocks.js
js/scripts.js
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"root": true,
"extends": [
"plugin:@wordpress/eslint-plugin/recommended",
"plugin:@wordpress/eslint-plugin/recommended-with-formatting",
"plugin:import/recommended",
"plugin:eslint-comments/recommended",
"plugin:jsx-a11y/recommended",
Expand Down
6 changes: 5 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ about: Report a problem
## Expected behavior

## Actual behavior
<!-- Please include screenshots of the behavior and the JS console, if there was an error or warning there -->
<!-- Please include screenshots of the behavior -->

## JS Console
<!-- Please copy the JS console here -->

## Additional information

Expand All @@ -30,6 +33,7 @@ about: Report a problem
- WordPress version:
- Genesis Custom Blocks version: <!-- Please ensure the latest version of Genesis Custom Blocks is running: https://github.com/studiopress/genesis-custom-blocks -->
- Gutenberg plugin version (if active):
- Other block-related plugins (if active):
- OS:
- Browser:
- Device: <!-- like MacBook -->
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,12 @@ vendor
# Tests
tests/data/
tests/includes/
coverage/html/
coverage/

# Builds
js/editor.blocks.js
js/scripts.js
css/blocks.editor.css
package/
built/
*.asset.php
16 changes: 16 additions & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "stylelint-config-wordpress",
"rules": {
"at-rule-empty-line-before": null,
"at-rule-no-unknown": null,
"comment-empty-line-before": null,
"declaration-property-unit-whitelist": null,
"font-weight-notation": null,
"max-line-length": null,
"no-descending-specificity": null,
"no-duplicate-selectors": null,
"rule-empty-line-before": null,
"selector-class-pattern": null,
"value-keyword-case": null
}
}
107 changes: 28 additions & 79 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,104 +2,53 @@

:+1::tada: First off, thanks for taking the time to contribute! :tada::+1:

The following is a set of guidelines for contributing to Genesis Custom Blocks. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.

#### Table Of Contents

[Code of Conduct](#code-of-conduct)

[How Can I Contribute?](#how-can-i-contribute)
* [Reporting Bugs](#reporting-bugs)
* [Suggesting Enhancements](#suggesting-enhancements)
* [Your First Code Contribution](#your-first-code-contribution)
* [Pull Requests](#pull-requests)
* [Local Setup](#local-setup)

[Styleguides](#styleguides)
* [Git Commit Messages](#git-commit-messages)

[Additional Notes](#additional-notes)
* [Issue and Pull Request Labels](#issue-and-pull-request-labels)

## Code of Conduct

This project and everyone participating in it is governed by the [Genesis Custom Blocks Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to [info@getblocklab.com](mailto:info@getblocklab.com).

## How Can I Contribute?

### Reporting Bugs

Bugs are tracked as [GitHub issues](https://guides.github.com/features/issues/).

Explain the problem and include additional details to help maintainers reproduce the problem.

### Suggesting Enhancements

Enhancement suggestions are also tracked as [GitHub issues](https://guides.github.com/features/issues/).

Please describe in detail the enhancement and your use case for it.

### Your First Code Contribution

### Pull Requests

Please follow these steps to have your contribution considered by the maintainers:

1. Follow all instructions in [the template](.github/PULL_REQUEST_TEMPLATE.md)
2. Follow the [styleguides](#styleguides)
3. After you submit your pull request, verify that all [status checks](https://help.github.com/articles/about-status-checks/) are passing <details><summary>What if the status checks are failing?</summary>If a status check is failing, and you believe that the failure is unrelated to your change, please leave a comment on the pull request explaining why you believe the failure is unrelated. A maintainer will re-run the status check for you. If we conclude that the failure was a false positive, then we will open an issue to track that problem with our status check suite.</details>

While the prerequisites above must be satisfied prior to having your pull request reviewed, the reviewer(s) may ask you to complete additional design work, tests, or other changes before your pull request can be ultimately accepted.

## Styleguides

### Git Commit Messages

* Use the present tense ("Add feature" not "Added feature")
* Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
* Limit the first line to 72 characters or less
* Reference issues and pull requests liberally after the first line
* Consider starting the commit message with an applicable emoji:
* :art: `:art:` when improving the format/structure of the code
* :racehorse: `:racehorse:` when improving performance
* :non-potable_water: `:non-potable_water:` when plugging memory leaks
* :memo: `:memo:` when writing docs
* :penguin: `:penguin:` when fixing something on Linux
* :apple: `:apple:` when fixing something on macOS
* :checkered_flag: `:checkered_flag:` when fixing something on Windows
* :bug: `:bug:` when fixing a bug
* :fire: `:fire:` when removing code or files
* :white_check_mark: `:white_check_mark:` when adding tests
* :lock: `:lock:` when dealing with security

### Local Setup

Genesis Custom Blocks development requires Node.js and follows the WordPress coding standards for PHP and JavaScript. In order to get your development environment setup quickly, simply run the following commands after cloning the plugin from Github:
Genesis Custom Blocks generally follows WordPress coding standards for PHP and JavaScript.

#### Node
There's a pre-commit hook and linting scripts like `npm run lint`.

**Install Packages**
**Install Dependencies**

```
npm install
composer install && npm install
```

This command installs required Node packages locally and is required before running build setup.

**Watch Changes**

```
npm run dev
```

While developing, it is a best practice to watch for changes. This command will build assets as modifications are made.
#### PHPUnit

#### Composer
```
WP_TESTS_DIR=/path/to/wordpress-develop/tests/phpunit composer test
```

If you've already installed the DB for the [WordPress Core unit tests](https://github.com/WordPress/wordpress-develop/tree/0228dd6a5d17aa42735fdff9b106afccb960311e/tests/phpunit), simply pass the path to [wordpress-develop/tests/phpunit/](https://github.com/WordPress/wordpress-develop/tree/0228dd6a5d17aa42735fdff9b106afccb960311e/tests/phpunit) as `WP_TESTS_DIR`, as shown above.

Otherwise, clone [wordpress-develop](https://github.com/WordPress/wordpress-develop). Then, `cd` back to this plugin and do:

```
composer install
WP_TESTS_DIR=/path/to/wordpress-develop/tests/phpunit ./bin/install-wp-tests.sh <db name> <db user> <db password>
```

Use whatever DB name you'd like, and substitute a DB user and password that works in your environment.

### Release Procedure

1. `checkout` locally whatever branch you want to release. It could be `develop`, or a release branch like `1.0`.
1. Do `gulp`, and you'll see a `genesis-custom-blocks.zip` file in the `package/` directory.
1. Smoke test that `.zip` file.
1. [Create a release](https://github.com/studiopress/genesis-custom-blocks/releases/new), targeting whatever branch you chose in step 1.
1. Upload the `.zip` file you created to the release page.
1. The 'Tag version' should be the plugin version preceded with `v`, like `v1.0.0`.
1. There will be a `package/trunk/` directory from running `gulp` earlier. Use this to commit the new plugin version to the wp.org SVN repo.
1. Do `./bin/tag-built.sh`
1. This will create a built tag of the plugin and push it. Then, other plugins or entire sites can require the plugin as a Composer dependency.
1. To resume normal local development, do `composer install`, as running `gulp` will remove the Composer dev dependencies.

Thanks! :heart: :heart: :heart:

Genesis Custom Blocks Team
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Contributors: lukecarbis, ryankienstra, Stino11, rheinardkorf
Tags: gutenberg, blocks, block editor, fields, template
Requires at least: 5.0
Tested up to: 5.4
Tested up to: 5.5
Requires PHP: 5.6
Stable tag: trunk
License: GPLv2 or later
Expand Down Expand Up @@ -43,11 +43,9 @@ Simple to use functions, ready to render and work with the values stored through
* Activate Genesis Custom Blocks from your Plugins page.

### Manually ###
* Clone Genesis Custom Blocks into a working directory with `https://github.com/studiopress/genesis-custom-blocks.git`
* `cd` into the `genesis-custom-blocks` directory, and run `npm install && composer install`
* Next, build the scripts and styles with `npm build`
* Move the `genesis-custom-blocks` folder to your `/wp-content/plugins/` directory
* Activate the Genesis Custom Blocks plugin through the Plugins menu in WordPress
* Clone [Genesis Custom Blocks](https://github.com/studiopress/genesis-custom-blocks.git) into `/wp-content/plugins/`
* Follow the [local setup instructions](https://github.com/studiopress/genesis-custom-blocks/blob/develop/CONTRIBUTING.md#local-setup)
* Activate this plugin via WP-CLI or `/wp-admin` > Plugins

## Frequently Asked Questions ###
**Q: Do I need to write code to use this plugin?**
Expand Down
6 changes: 2 additions & 4 deletions assets/images/admin-menu-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions bin/install-wp-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ WP_TESTS_DIR=${WP_TESTS_DIR-$TMPDIR/wordpress-tests-lib}
WP_CORE_DIR=${WP_CORE_DIR-$TMPDIR/wordpress/}

download() {
if [ `which curl` ]; then
curl -s "$1" > "$2";
elif [ `which wget` ]; then
wget -nv -O "$2" "$1"
fi
if [ `which curl` ]; then
curl -s "$1" > "$2";
elif [ `which wget` ]; then
wget -nv -O "$2" "$1"
fi
}

if [[ $WP_VERSION =~ ^[0-9]+\.[0-9]+\-(beta|RC)[0-9]+$ ]]; then
Expand Down
9 changes: 9 additions & 0 deletions bin/pre-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,14 @@ if [ ! -z "$js_files" ]; then
fi
fi

# Lint staged .scss files
scss_files=$( git diff --diff-filter=d --staged --name-only | grep -E '/*\.scss$' )
if [ -n "$scss_files" ]; then
npm run lint:css:files $scss_files
if [ $? != 0 ]; then
exit 1
fi
fi

# Lint package.json
npm run lint:pkg-json
Loading

0 comments on commit 9c846f0

Please sign in to comment.