Skip to content

Commit

Permalink
enhance(project): Refactor project to be thinner, leaner, meaner... (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
Log1x authored Feb 12, 2021
2 parents 892a0b1 + dc6f0a4 commit 558e394
Show file tree
Hide file tree
Showing 27 changed files with 3,856 additions and 3,804 deletions.
29 changes: 0 additions & 29 deletions .circleci/config.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
Expand Down
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
/.gitattributes export-ignore
/.github export-ignore
/.circleci export-ignore
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
custom: https://www.paypal.me/log1x
github: log1x
43 changes: 43 additions & 0 deletions .github/workflows/compatibility.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: compatibility

on:
push:
branches: [master]

jobs:
compatibility:
name: PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }}
runs-on: ${{ matrix.operating-system }}
if: "!contains(github.event.head_commit.message, '[ci skip]')"
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ['7.3', '7.4', '8.0']

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: xdebug
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.php-versions }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-${{ matrix.php-versions }}-composer-

- name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader --no-suggest

- name: PHP lint
run: composer run-script lint
35 changes: 35 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: main

on: [pull_request]

jobs:
main:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.3'
coverage: xdebug
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-7.3.x-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-7.3.x-composer-

- name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader --no-suggest

- name: PHP lint
run: composer run-script lint
52 changes: 52 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Publish release

on:
push:
tags:
- '*'

jobs:
release:
name: Publish release
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: '7.3'
coverage: xdebug
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader --no-suggest --no-dev

- name: Cleanup unnecessary files
run: rm -rf .git .github .editorconfig .prettierrc .gitattributes .gitignore resources composer.json composer.lock package.json yarn.lock webpack.mix.js tailwind.config.js

- name: Get the version
id: get_version
run: echo ::set-output name=version::${GITHUB_REF/refs\/tags\//}
shell: bash

- name: Create subfolder
run: mkdir plugin && mv ./* plugin/ 2>/dev/null
continue-on-error: true

- name: Create distributable zip file
uses: montudor/action-zip@v0.1.0
with:
args: zip -qq -r9 plugin.zip plugin

- name: Upload zip as release asset
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: plugin.zip
asset_name: plugin-${{ steps.get_version.outputs.version }}.zip
tag: ${{ github.ref }}
overwrite: true
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
dist
vendor
node_modules
yarn-error.log
/node_modules
/vendor
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"semi": true,
"singleQuote": true,
"trailingComma": "es5"
}
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Brandon Nifong
Copyright (c) Brandon Nifong

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
44 changes: 21 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,50 @@
# ACF Field Boilerplate

[![Packagist](https://img.shields.io/packagist/v/log1x/acf-field-boilerplate.svg?style=flat-square)](https://packagist.org/packages/log1x/acf-field-boilerplate)
![CircleCI](https://img.shields.io/circleci/build/gh/Log1x/acf-field-boilerplate.svg?style=flat-square)
[![Packagist Downloads](https://img.shields.io/packagist/dt/log1x/acf-field-boilerplate.svg?style=flat-square)](https://packagist.org/packages/log1x/acf-field-boilerplate)
![Latest Stable Version](https://img.shields.io/packagist/v/log1x/acf-field-boilerplate?style=flat-square)
![Total Downloads](https://img.shields.io/packagist/dt/log1x/acf-field-boilerplate?style=flat-square)
![Build Status](https://img.shields.io/github/workflow/status/log1x/acf-field-boilerplate/compatibility)

This is an ACF Field Type boilerplate to quickly make clean, well structured custom field types.

This is entirely based off of the original [acf-field-type-template](https://github.com/elliotcondon/acf-field-type-template) provided by the creator of ACF.

## Features

* [Laravel Mix](https://laravelmix.com) for handling assets.
* PSR-12 code style & linting
* Namespacing
* Cleaner DocBlocks
* Cleaner directory structure
* Field autoloader
* Ready to use alongside other Composer packages
* Attempt at a more DRY approach
- [Laravel Mix](https://laravelmix.com) for handling assets.
- Support for Admin Columns Pro
- PSR-12 code style & linting
- Cleaner DocBlocks
- Cleaner directory structure
- Ready to use alongside other Composer packages
- Attempt at a more DRY approach

## Requirements

Make sure all dependencies have been installed before moving on:

* [ACF](https://www.advancedcustomfields.com/pro/) >= 5.0
* [PHP](http://php.net/manual/en/install.php) >= 7.1.3
* [Composer](https://getcomposer.org/download/)
* [Node.js](http://nodejs.org/) >= 6.9.x
* [Yarn](https://yarnpkg.com/en/docs/install)
- [ACF](https://www.advancedcustomfields.com/pro/) >= 5.0
- [PHP](http://php.net/manual/en/install.php) >= 7.2
- [Composer](https://getcomposer.org/download/)
- [Yarn](https://yarnpkg.com/en/docs/install)

## Getting Started

Create a project using Composer:

```bash
```sh
$ composer create-project log1x/acf-field-boilerplate:dev-master my-field
```

## Field development

* Run `yarn install` from the field directory to install dependencies.
* Replace all instances of `Log1x/ExampleField` with your namespace.
* Use `Fields/ExampleField.php` to get started.
- Run `yarn install` from the field directory to install dependencies.
- Replace all instances of `Log1x/AcfFieldBoilerplate` with your namespace.
- Use `src/ExampleField.php` to get started.

### Build commands

* `yarn run build` — Compile and optimize the files in your assets directory
* `yarn run build:production` — Compile assets for production
- `yarn run build` — Compile and optimize the files in your assets directory
- `yarn run build:production` — Compile assets for production

## Bug Reports

Expand All @@ -58,4 +56,4 @@ Contributing whether it be through PRs, reporting an issue, or suggesting an ide

## License

ACF Field Boilerplate is provided under the [MIT License](https://github.com/log1x/acf-field-boilerplate/blob/master/LICENSE.md).
ACF Field Boilerplate is provided under the [MIT License](LICENSE.md).
3 changes: 0 additions & 3 deletions assets/css/field.scss

This file was deleted.

21 changes: 0 additions & 21 deletions assets/js/events/ready.js

This file was deleted.

25 changes: 0 additions & 25 deletions assets/js/field.js

This file was deleted.

18 changes: 9 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"name": "log1x/acf-field-boilerplate",
"type": "wordpress-plugin",
"description": "A better way to create ACF Fields.",
"description": "A clean starting point for custom Advanced Custom Fields field types.",
"keywords": [
"acf",
"acf-field",
"wordpress",
"acf"
"wordpress-plugin"
],
"require": {
"php": ">=7.1.3",
"composer/installers": "~1.0",
"roots/support": "dev-master"
"php": ">=7.2"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.4"
"squizlabs/php_codesniffer": "^3.5"
},
"autoload": {
"files": [
"src/FieldLoader.php"
]
"psr-4": {
"Log1x\\AcfExampleField\\": "src/"
}
},
"scripts": {
"lint": [
Expand Down
Loading

0 comments on commit 558e394

Please sign in to comment.