Skip to content
This repository has been archived by the owner on Mar 31, 2022. It is now read-only.

Modify the defaults to more closely align to the theme-boilerplate #4

Merged
merged 17 commits into from
Oct 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Contributing to this project

Hi! Thank you for your interest in contributing to this plugin, we really appreciate it.

There are many ways to contribute – reporting bugs, feature suggestions, fixing bugs, submitting pull requests for enhancements.

## Reporting Bugs, Asking Questions, Sending Suggestions

Just [file a GitHub issue](./issues/new), that’s all! If you want to prefix the title with a “Question:”, “Bug:”, or the general area of the issue, that would be helpful, but by no means mandatory. If you have write access, add the appropriate labels.

If you’re filing a bug, specific steps to reproduce are helpful. Please include the URL of the page that has the bug, along with what you expected to see and what happened instead.

## Helping with the documentation

Every plugin is just as good as the documentation. In this repository we offer [collaboration with a wiki](./wiki) to create a documentation for this theme.

## Setting up the dev environment

If you want to contribute code to the theme you have to set up the environment locally. Make sure that you have `node`, `docker` and `grunt` installed.

The working directory is the `build` directory. If you change something in another location of the repository the pull request will be ignored.

The development server and all dependencies are handled by docker, node and composer. Make sure you have [docker-compose installed](https://docs.docker.com/compose/install/) and run `npm run setup` in the directory. Your spawned WordPress instance will be available under `http://localhost` with the account `wordpress:wordpress`.

Please be aware, that you should usually not write code directly on the master branch.

Start the grunt watcher with the terminal command `grunt watch`. Grunt will make sure that the code will be compiled and copied to the trunk folder.

Before committing execute the command `grunt lint` to test if your code follows the general coding standards.

*IMPORTANT*: Edits outside the `build` directory will be overwritten by the grunt tasks. Make sure you don't work within the `trunk` folder or your work will be lost.

## I'm stuck, what do I do?

Not knowing what to do is perfectly normal for any developer or programmer. One of the main skills of a good programmer is the ability to quickly adapt patterns and find solutions. In short: Being able type the right question into Google. If you are stuck somewhere in theme development we suggest the following:

1. Check out the [WordPress Codex](https://codex.wordpress.org) and read the documentation of what you're trying to build.
2. Look at how others do it. Places to look for best practices are the [TwentyNinteen theme](https://github.com/WordPress/twentynineteen), the [Underscores theme](https://github.com/automattic/_s) or the [TwentySeventeen theme](https://github.com/WordPress/twentyseventeen).
3. Ask a senior programmer nearby

## Development Workflow

To keep the work in this repository structured and maintainable, we follow a certain way to add changes and code. A good workflow is structured like this:

1. Write or take an issue about the problem you want to solve
2. Add your own branch to the repository and add code to this branch
3. As soon as you have a presentable solution, add a pull request to the master branch
4. Get reviews for your solution and make sure the automated tests pass
5. Before merging the PR to the master branch, update your branch from master to resolve conflicts
6. Merge the PR into the master branch, test the solution and delete your branch

### Naming branches

Ideally name your branches with prefixes and descriptions, like this: [type]/[change]. A good prefix would be:

* add/ = add a new feature
* try/ = experimental feature, "tentatively add"
* update/ = update an existing feature
* fix/ = fix a bug or unwanted behavior

For example, add/gallery-block means you're working on adding a new gallery block.

## Releasing Updates

The release workflow is more or less automated. A npm workflow takes the code, runs the tests and builds it into a release-ready zip. This zip is then attached to a GitHub release, from where it is then pushed to our own update server.

While theoretically everyone with write access to the repository has the ability to push a release, the release should only be done by one person, either the *build master* or the *project manager*.

*Important*: The GitHub release is added as a draft and has to be published manually.

To create a release just run `npm run release`. The perquisites for this are write access to the repository and a GitHub token in the `.env` file.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,26 @@ new repository. So let's get started:

### Plugin Slug & Names

- [ ] Rename the `build/_lhpbp-plugin.php` file
- [ ] Rename the `build/_lhpbp.php` file
- [ ] Search & Replace (case sensitive) `_lhpbp` with your new WordPress plugin slug
- [ ] Search & Replace (case sensitive) `bblhpbp` with your new WordPress plugin slug
- [ ] Search & Replace (case sensitive) `jslhpbp` with your new WordPress plugin slug in camelcase
- [ ] Search & Replace (case sensitive) `_LHPBP` with your new WordPress plugin slug in uppercase
- [ ] Check success in `package.json`, `docker-compose.json` & `bin/install-wordpress.sh`

### Running the enviroment
### Running the environment

- [ ] Type `npm run setup` into the terminal to spin up the docker enviroment
- [ ] Open `http://localhost/wp-admin` and log in with `wordpress:wordpress`
- [ ] Make sure the plugin unit demo content is installed and the plugin is active

### Test Release

- [ ] Save the `.env.sample` as `.env` and add your GitHub token
- [ ] Add a 0.0.2 release by running `npm run release` in your terminal
- [ ] Check if the release has been created and uploaded in the GitHub release section

### Finishing touches

- [ ] Edit the `README.md` with the appropriate text about your plugin
- [ ] 🎉 Celebrate!
- [ ] Edit the `plugin-README.md` with the appropriate text about your plugin
- [ ] Remove the `README.md` and rename `plugin-README.md` to be the new `README.md`
- [ ] 🎉 Celebrate!
2 changes: 1 addition & 1 deletion bin/install-wordpress.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ if ! $(${WP_CLI} core is-installed); then
${WP_CLI} core update

# Activate Plugin
${WP_CLI} plugin activate _lhpbp-plugin
${WP_CLI} plugin activate _lhpbp

# Import and activate needed plugins
${WP_CLI} plugin install gutenberg wordpress-importer query-monitor debug-bar --activate
Expand Down
93 changes: 0 additions & 93 deletions bin/rename-slug.js

This file was deleted.

20 changes: 10 additions & 10 deletions build/_lhpbp-plugin.php → build/_lhpbp.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@
die;
}

if ( ! defined( '_LHPBP_PLUGIN_SLUG' ) ) {
define( '_LHPBP_PLUGIN_SLUG', '<%= pkg.slug %>' );
if ( ! defined( '_LHPBP_SLUG' ) ) {
define( '_LHPBP_SLUG', '<%= pkg.slug %>' );
}

if ( ! defined( '_LHPBP_PLUGIN_VERSION' ) ) {
define( '_LHPBP_PLUGIN_VERSION', '<%= pkg.version %>' );
if ( ! defined( '_LHPBP_VERSION' ) ) {
define( '_LHPBP_VERSION', '<%= pkg.version %>' );
}

if ( ! defined( '_LHPBP_PLUGIN_URL' ) ) {
define( '_LHPBP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
if ( ! defined( '_LHPBP_URL' ) ) {
define( '_LHPBP_URL', plugin_dir_url( __FILE__ ) );
}

if ( ! defined( '_LHPBP_PLUGIN_PATH' ) ) {
define( '_LHPBP_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
if ( ! defined( '_LHPBP_PATH' ) ) {
define( '_LHPBP_PATH', plugin_dir_path( __FILE__ ) );
}

/**
Expand All @@ -55,7 +55,7 @@ function _lhpbp_autoload( $class_name ) {
}

$parts = explode( '\\', substr( $class_name, strlen( $namespace . '\\' ) ) );
$path = _LHPBP_PLUGIN_PATH . 'inc';
$path = _LHPBP_PATH . 'inc';

foreach ( $parts as $part ) {
$path .= '/' . $part;
Expand All @@ -75,7 +75,7 @@ function _lhpbp_autoload( $class_name ) {
spl_autoload_register( '_lhpbp_autoload' );

// Load the `wp__lhpbp()` entry point function.
require _LHPBP_PLUGIN_PATH . 'inc/functions.php';
require _LHPBP_PATH . 'inc/functions.php';

// Initialize the plugin.
call_user_func( '_lhpbp\wp__lhpbp' );
6 changes: 3 additions & 3 deletions build/blocks-helper/custom-category.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import icons from './icons';
setCategories( [
// Add a _lhpbp block category
{
slug: 'bblhpbp',
title: 'bblhpbp',
slug: 'jslhpbp',
title: 'jslhpbp',
icon: icons._lhpbp,
},
...getCategories().filter( ( { slug } ) => slug !== 'bblhpbp' ),
...getCategories().filter( ( { slug } ) => slug !== 'jslhpbp' ),
] );
Loading