Skip to content

Commit 2927b47

Browse files
committed
Add spec files.
1 parent 37f1f15 commit 2927b47

17 files changed

+654
-157
lines changed

.browserslistrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# https://github.com/browserslist/browserslist#readme
2+
3+
>= 1%
4+
last 2 major version
5+
not dead

.distignore

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
.browserslistrc
2+
.editorconfig
3+
.eslintrc
4+
.distignore
5+
.git
6+
.github
7+
.gitignore
8+
.node-version
9+
.stylelintrc.json
10+
.wordpress-org
11+
.wp-env.json
12+
node_modules
13+
composer.lock
14+
gulpfile.js
15+
package-lock.json
16+
phpcs.ruleset.xml
17+
phpunit.xml.dist
18+
README.md
19+
webpack.config.js
20+
wordpress
21+
vendor
22+
bin
23+
tests
24+
taro-custom-style.php.bak
25+
readme.txt.bak

.editorconfig

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# This file is for unifying the coding style for different editors and IDEs
2+
# editorconfig.org
3+
4+
# WordPress Coding Standards
5+
# https://make.wordpress.org/core/handbook/coding-standards/
6+
7+
root = true
8+
9+
[*]
10+
charset = utf-8
11+
end_of_line = lf
12+
insert_final_newline = true
13+
trim_trailing_whitespace = true
14+
indent_style = tab
15+
tab_width = 4
16+
17+
[*.yml]
18+
indent_style = space
19+
indent_size = 2
20+
21+
[*.md]
22+
trim_trailing_whitespace = false
23+
24+
[{*.txt,wp-config-sample.php}]
25+
end_of_line = crlf

.eslintrc

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"parser": "babel-eslint",
3+
"env": {
4+
"browser": true,
5+
"jquery": true
6+
},
7+
"globals": {
8+
"wp": false,
9+
"jQuery": false,
10+
"angular": false,
11+
"Hametuha": true,
12+
"wpApiSettings": false,
13+
"ga": false,
14+
"Hashboard": true,
15+
"Vue": false
16+
},
17+
"extends": [
18+
"plugin:@wordpress/eslint-plugin/recommended"
19+
],
20+
"rules": {
21+
"no-alert": "off",
22+
"prettier/prettier": "off",
23+
"object-shorthand": "off",
24+
"jsdoc/require-jsdoc": "off",
25+
"jsdoc/no-undefined-types": "off",
26+
"react/react-in-jsx-scope": "off",
27+
"react/jsx-sort-props": "off",
28+
"jsdoc/check-tag-names": "off",
29+
"import/order": "off",
30+
"no-prototype-builtins": "off",
31+
"object-curly-newline": "off",
32+
"object-property-newline": "off",
33+
"yoda": "off",
34+
"strict": "off",
35+
"@wordpress/valid-sprintf": "off"
36+
},
37+
"settings": {
38+
"react": {
39+
"version": "16.9.0"
40+
}
41+
}
42+
}

.github/workflows/wordpress.yml

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
name: Deploy Plugin
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- '*'
9+
pull_request:
10+
branches:
11+
- main
12+
13+
jobs:
14+
test:
15+
runs-on: ${{ matrix.operating-system }}
16+
strategy:
17+
matrix:
18+
operating-system: [ ubuntu-18.04 ] # OS. ubuntu-18.04 is also available.
19+
php: [ '5.6', '7.2', '7.4' ] # PHP versions to check.
20+
wp: [ 'latest', '5.4' ] # WordPress version to check.
21+
services:
22+
mysql:
23+
image: mysql:5.7
24+
options: --health-cmd "mysqladmin ping --host 127.0.0.1 --port 3306" --health-interval 20s --health-timeout 10s --health-retries 10
25+
ports:
26+
- 3306/tcp
27+
env:
28+
MYSQL_ROOT_PASSWORD: root
29+
name: WordPress ${{ matrix.wp }} in PHP ${{ matrix.php }} UnitTest
30+
steps:
31+
- uses: actions/checkout@master
32+
33+
- name: Setup PHP
34+
uses: nanasess/setup-php@master
35+
with:
36+
php-version: ${{ matrix.php }}
37+
38+
- name: Validate composer.json and composer.lock
39+
run: composer validate
40+
41+
- name: Install dependencies
42+
run: composer install --prefer-dist --no-progress --no-suggest
43+
44+
- name: Start MySQL
45+
run: sudo systemctl start mysql
46+
47+
- name: Install WordPress
48+
run: bash bin/install-wp-tests.sh wordpress root root 127.0.0.1:3306 ${{ matrix.wp }}
49+
50+
- name: Check PHP syntax
51+
run: composer test
52+
53+
assets:
54+
name: Assets Test
55+
runs-on: ubuntu-18.04
56+
steps:
57+
- uses: actions/checkout@master
58+
59+
- name: Install Node
60+
uses: actions/setup-node@v1
61+
with:
62+
node-version: '12'
63+
64+
- name: Install NPM Packages
65+
run: npm install
66+
67+
- name: Check JS & CSS syntax
68+
run: npm run lint
69+
70+
release:
71+
name: Deploy WordPress.org
72+
needs: [ test, assets ]
73+
if: contains(github.ref, 'tags/')
74+
runs-on: ubuntu-18.04
75+
steps:
76+
- name: Checkout code
77+
uses: actions/checkout@v2
78+
79+
- name: Setup PHP
80+
uses: nanasess/setup-php@master
81+
with:
82+
php-version: 5.6
83+
84+
- name: Install Node
85+
uses: actions/setup-node@v1
86+
with:
87+
node-version: '12'
88+
89+
- name: Build Plugin
90+
run: bash bin/build.sh ${{ github.ref }}
91+
92+
- name: Deploy to WordPress Directory
93+
id: deploy
94+
uses: 10up/action-wordpress-plugin-deploy@stable
95+
with:
96+
generate-zip: true
97+
env:
98+
SVN_USERNAME: ${{ secrets.WP_ORG_USERNAME_TAROSKY }}
99+
SVN_PASSWORD: ${{ secrets.WP_ORG_PASSWORD_TAROSKY }}
100+
101+
- name: Create Release
102+
id: create_release
103+
uses: actions/[email protected]
104+
env:
105+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
106+
with:
107+
tag_name: ${{ github.ref }}
108+
release_name: Release ${{ github.ref }}
109+
draft: false
110+
prerelease: false
111+
112+
- name: Upload release asset
113+
uses: actions/[email protected]
114+
env:
115+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
116+
with:
117+
upload_url: ${{ steps.create_release.outputs.upload_url }}
118+
asset_path: ${{ github.workspace }}/${{ github.event.repository.name }}.zip
119+
asset_name: ${{ github.event.repository.name }}.zip
120+
asset_content_type: application/zip

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
node_modules/
22
assets/
3+
wordpress/
4+
wp-dependencies.json

.jshintrc

-20
This file was deleted.

.stylelintrc.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"extends": [
3+
"stylelint-config-wordpress/scss"
4+
],
5+
"rules": {
6+
"value-keyword-case": [ "lower", {
7+
"ignoreProperties": [ "font-family" ]
8+
} ],
9+
"number-leading-zero": null,
10+
"rule-empty-line-before": null,
11+
"declaration-property-unit-whitelist": null,
12+
"selector-class-pattern": null,
13+
"at-rule-empty-line-before": null,
14+
"no-descending-specificity": null
15+
}
16+
}

.wp-env.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"plugins": ["."],
3+
"themes": [
4+
"https://downloads.wordpress.org/theme/twentytwenty.latest-stable.zip"
5+
]
6+
}

readme.md README.md

File renamed without changes.

bin/build.sh

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
# Set variables.
6+
PREFIX="refs/tags/"
7+
VERSION=${1#"$PREFIX"}
8+
9+
echo "Building Taro Programmable Search v${VERSION}..."
10+
11+
# Install composer.
12+
composer install --no-dev --prefer-dist
13+
14+
# Install NPM.
15+
npm install
16+
npm run package
17+
18+
# Create README.txt
19+
curl -L https://raw.githubusercontent.com/fumikito/wp-readme/master/wp-readme.php | php
20+
21+
# Change version string.
22+
sed -i.bak "s/^Version: .*/Version: ${VERSION}/g" ./taro-browser-happy.php
23+
sed -i.bak "s/^Stable Tag: .*/Stable Tag: ${VERSION}/g" ./readme.txt

bin/clean.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
# Remove unwanted files in distignore.
6+
files=(`cat ".distignore"`)
7+
8+
for item in "${files[@]}"; do
9+
if [ -e $item ]; then
10+
rm -frv $item
11+
fi
12+
done

0 commit comments

Comments
 (0)