Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:vektor-inc/vk-blocks-pro into fi…
Browse files Browse the repository at this point in the history
…x/delete/css-optimize
  • Loading branch information
drill-lancer committed Oct 25, 2023
2 parents 6dbc685 + 394e1af commit 2779b33
Show file tree
Hide file tree
Showing 514 changed files with 59,735 additions and 31,769 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
module.exports = {
root: true,
extends: ['plugin:@wordpress/eslint-plugin/recommended'],
rules: {
'import/no-unresolved': 'off',
'import/no-extraneous-dependencies': 'off',
camelcase: 'off',
'@wordpress/no-unsafe-wp-apis': 'off',
'@wordpress/i18n-translator-comments': 'off',
'react-hooks/exhaustive-deps': 'off',
},
};
24 changes: 24 additions & 0 deletions .freeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.git/
.github/
/bin/
build/*.css
build/*.js
build/block-build.css
build/_pro/
editor-css/*.css
editor-css/*.css.map
inc/vk-blocks-pro/
inc/vk-blocks-pro-config.php
node_modules/
src/blocks/_pro/
src/blocks/bundle-pro.js
temp/
test/phpunit/pro
/vendor/
vk-blocks-copy-target/
.freeignore
.gitignore
.phpcs.xml
.phpunit.xml
vk-blocks-pro.code-workspace
webpack.config.js
2 changes: 1 addition & 1 deletion .github/workflows/deploy-free.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:

- run: npm install -g npm
# 無料版を(Pro版の中に)クローン
- run: git clone https://${GIT_USER}:${GIT_TOKEN}@github.com/${GIT_REPOSITORY}
- run: git clone https://${GIT_USER}:${GIT_TOKEN}@github.com/${GIT_REPOSITORY} ./temp/plugins/vk-blocks
# VK Blocks の Githubにアクセスできるユーザーの設定
- run: git config --global user.email "info@vektor-inc.co.jp"
- run: git config --global user.name "github-workflows-vk-blocks-pro"
Expand Down
55 changes: 37 additions & 18 deletions .github/workflows/develop-test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: PHP Unit Test & Deploy develop

on:
push:
branches:
Expand All @@ -14,7 +13,7 @@ jobs:
strategy:
matrix:
php-versions: ['7.3', '7.4', '8.0', '8.1']
wp-versions: ['6.1','6.0.3','5.9.3']
wp-versions: ['6.3','6.2','6.1']
name: PHP Unit test ${{ matrix.php-versions }} / WP ${{ matrix.wp-versions }} Test on ${{ matrix.operating-system }}
services:
mysql:
Expand Down Expand Up @@ -62,22 +61,42 @@ jobs:
run: WP_ENV_PHP_VERSION=${{ matrix.php-versions }} WP_ENV_CORE=WordPress/WordPress#${{ matrix.wp-versions }} npm run wp-env start --update
- name: Check WordPress Version
run: npm run wp-env run cli wp core version
# dist の中で build は実行している
- name: Build and Dist
run: npm run dist

# Build
- name: Build
run: npm run build
# PHPUnit
- name: PHP Unit Test
run: npm run phpunit

# Deploy test server
- name: Deploy to test server [ Deprecated ]
uses: burnett01/rsync-deployments@4.1
with:
switches: -avzr
path: /dist/vk-blocks-pro/
remote_path: /home/vs4/www/vk-block-test/wp-content/plugins/vk-blocks-pro/
remote_host: ${{ secrets.DEPLOY_HOST_VS4 }}
remote_port: ${{ secrets.DEPLOY_PORT_VS4 }}
remote_user: ${{ secrets.DEPLOY_USER_VS4 }}
remote_key: ${{ secrets.DEPLOY_KEY_VS4 }}
deployment:
runs-on: ubuntu-latest
needs: [php_unit]
steps:
- name: checkout
uses: actions/checkout@v2
- name: Read .node-version
run: echo "##[set-output name=NODEVERSION;]$(cat .node-version)"
id: nodenv
- name: Setup Node.js (.node-version)
uses: actions/setup-node@v1
with:
node-version: "${{ steps.nodenv.outputs.NODEVERSION }}"
- name: install npm scripts
run: npm install
- name: Install WP-CLI
run: |
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
mv wp-cli.phar /usr/local/bin/wp
- name: Build and Dist
run: npm run dist
# Deploy test server
- name: Deploy to test server [ Deprecated ]
uses: burnett01/rsync-deployments@4.1
with:
switches: -avzr
path: /dist/vk-blocks-pro/
remote_path: /home/vs4/www/vk-block-test/wp-content/plugins/vk-blocks-pro/
remote_host: ${{ secrets.DEPLOY_HOST_VS4 }}
remote_port: ${{ secrets.DEPLOY_PORT_VS4 }}
remote_user: ${{ secrets.DEPLOY_USER_VS4 }}
remote_key: ${{ secrets.DEPLOY_KEY_VS4 }}
12 changes: 9 additions & 3 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- name: Setup Node 14.x
uses: actions/setup-node@v1
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 14.x
- name: install npm scripts
Expand All @@ -51,8 +51,14 @@ jobs:
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps

# タクソノミーのテストはワークフロー上だと環境の都合でうまく動作させられないので login.spec.ts だけテスト
# ローカルで以下のコマンドで test/e2e/ 内のテストをすべて実行する
# npx playwright test --trace on --project=chromium
- name: Run Playwright
run: npx playwright test --trace on --project=chromium
run: |
npx playwright test --trace on --project=chromium test/e2e/login.spec.ts
npx playwright test --trace on --project=chromium test/e2e/common-margin.spec.ts
- uses: actions/upload-artifact@v3
if: always()
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ artifacts/
/test-results/
/playwright-report/
/playwright/.cache/
temp/
11 changes: 8 additions & 3 deletions .husky/_/husky.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/sh
#!/usr/bin/env sh
if [ -z "$husky_skip_init" ]; then
debug () {
if [ "$HUSKY_DEBUG" = "1" ]; then
echo "husky (debug) - $1"
fi
}

readonly hook_name="$(basename "$0")"
readonly hook_name="$(basename -- "$0")"
debug "starting $hook_name..."

if [ "$HUSKY" = "0" ]; then
Expand All @@ -19,13 +19,18 @@ if [ -z "$husky_skip_init" ]; then
. ~/.huskyrc
fi

export readonly husky_skip_init=1
readonly husky_skip_init=1
export husky_skip_init
sh -e "$0" "$@"
exitCode="$?"

if [ $exitCode != 0 ]; then
echo "husky - $hook_name hook exited with code $exitCode (error)"
fi

if [ $exitCode = 127 ]; then
echo "husky - command not found in PATH=$PATH"
fi

exit $exitCode
fi
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.20.1
18.18.0
3 changes: 2 additions & 1 deletion .phpcs.xml.dist → .phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<exclude-pattern type="relative">^test/phpunit/*</exclude-pattern>
<exclude-pattern type="relative">^.git/*</exclude-pattern>
<exclude-pattern type="relative">^build/*</exclude-pattern>
<exclude-pattern type="relative">^temp/*</exclude-pattern>

<!-- How to scan -->
<!-- Usage instructions: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage -->
Expand Down Expand Up @@ -80,7 +81,7 @@
<rule ref="WordPress.WP.I18n">
<properties>
<!-- Value: replace the text domain used. -->
<property name="text_domain" type="array" value="vk-blocks"/>
<property name="text_domain" type="array" value="vk-blocks-pro"/>
</properties>
</rule>
<rule ref="WordPress.WhiteSpace.ControlStructureSpacing">
Expand Down
1 change: 1 addition & 0 deletions phpunit.xml.dist → .phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<directory prefix="test-" suffix=".php">./vendor/vektor-inc/vk-wp-unit-test-tools/src/tests/</directory>
<directory prefix="test-" suffix=".php">./test/phpunit/</directory>
<exclude>./test/phpunit/test-sample.php</exclude>
<exclude>temp/</exclude>
</testsuite>
</testsuites>
</phpunit>
7 changes: 6 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ module.exports = ( api ) => {
api.cache( true );

return {
presets: [ '@wordpress/babel-preset-default' ],
presets: [
['@babel/preset-env', {
"modules": "commonjs"
}],
'@wordpress/babel-preset-default'
],
plugins: [
'@emotion/babel-plugin',
'babel-plugin-inline-json-import'
Expand Down
30 changes: 16 additions & 14 deletions bin/deploy-free.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,27 @@ fi
# tagのバージョンを変数に代入(後で git で tag 付けしてプッシュする時に使用)
version=$1

# deploy-free.ymlで clone した VK Blocks Pro 内の vk blocks ディレクトリ名が同じままだとややこしいので vk-blocks-copy-target に変更
mv vk-blocks/ vk-blocks-copy-target/
# Pro版のブロックslugを配列に追加(後で使用する)
pro_block_array=($(ls src/blocks/_pro/))

# Cloneした無料版のディレクトリに移動
cd ./vk-blocks-copy-target/
cd ./temp/plugins/vk-blocks
# コピー先の トップディレクトリ を一旦削除
rm -rf editor-css/* inc/* lib/* options-css/* src/* test/*

# プロ版のディレクトリに移動
cd ../
cd ../../../
# 指定したファイルを除外して、Pro版を無料版(vk-blocks-copy-target)へコピー&上書き
# -a : archive -rlptgoDとイコール
# -r : 指定ディレクトリ配下をすべて対象
# -v : コピーファイルの転送情報を出力
# -c : チェックサムで差分を確認
rsync -arvc --exclude 'vk-blocks-copy-target/' --exclude './vendor/' --exclude 'bin/' --exclude 'build/_pro/' --exclude 'src/blocks/_pro/' --exclude 'inc/vk-blocks-pro/' --exclude '.git/' --exclude '.github/' --exclude 'build/block-build.css' --exclude 'inc/vk-blocks-pro-config.php' --exclude 'src/blocks/bundle-pro.js' --exclude '.gitignore' --exclude 'build/*.css' --exclude 'build/*.js' --exclude 'editor-css/*.css' --exclude 'editor-css/*.css.map' --exclude 'vk-blocks-pro.code-workspace' --exclude 'phpunit.xml.dist' ./* ./vk-blocks-copy-target/
rsync -arvc --exclude-from='.freeignore' . ./temp/plugins/vk-blocks

# 無料版のディレクトリに移動
cd ./vk-blocks-copy-target/
cd ./temp/plugins/vk-blocks
# プラグイン名を通常版へリネーム(vk-blocks.php の 3行目の /Pro/ を // に変更 )
sed -i 3s/Pro// vk-blocks.php
# Pro版にもどり
cd ../
# Pro版のブロックslugを配列に追加(後で使用する)
pro_block_array=($(ls src/blocks/_pro/))
# 無料版のディレクトリに移動
cd ./vk-blocks-copy-target/
sed -i 3s/' Pro'// vk-blocks.php
# Pro版の配列をループしてPro版のブロックをphpから削除
for pro_block in ${pro_block_array[@]}; do
# ★ 本当はPro版のブロックを配列から削除しないといけない。昔は改行なかったが、今は改行はいってるので、この処理が正常に動いてないので要修正。だがし、しかし動作上問題はない。
Expand All @@ -55,10 +50,17 @@ done
# import vkblocksPro from './bundle-pro'; -> const vkblocksPro = []; に置換
sed -i "s/import vkblocksPro from '\.\/bundle-pro'/const vkblocksPro = \[\]/g" src/blocks/bundle.js
# 各種 composer ライブラリインストール
composer install --optimize-autoloader --prefer-dist --no-dev

# ブロックをビルド
npm install
composer install
npx gulp text-domain-free
npm run lint
composer format
composer lint
npm run build:free
npx wp-env start
npm run phpunit:free

# 無料版のmasterブランチにpush
git add .
Expand Down
12 changes: 7 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
}
],
"require": {
"vektor-inc/font-awesome-versions": "^0.4.1",
"vektor-inc/font-awesome-versions": "^0.5.0",
"vektor-inc/vk-swiper": "^0.3.3",
"tgmpa/tgm-plugin-activation": "dev-develop",
"yahnis-elsts/plugin-update-checker": "^5.0",
"vektor-inc/vk-admin": "^0.4.1",
"vektor-inc/vk-color-palette-manager": "^0.4.0",
"vektor-inc/vk-breadcrumb": "^0.2.5",
"vektor-inc/vk-term-color": "^0.4.0"
"vektor-inc/vk-term-color": "^0.6.6",
},
"require-dev": {
"doctrine/instantiator": "1.5.0",
Expand All @@ -32,9 +34,9 @@
"vektor-inc/vk-wp-unit-test-tools": "^0.10.0"
},
"scripts": {
"format": "phpcbf --standard=./.phpcs.xml.dist --report-summary --report-source",
"lint": "phpcs --standard=./.phpcs.xml.dist",
"phpcs": "phpcs --standard=./.phpcs.xml.dist"
"format": "phpcbf --standard=./.phpcs.xml --report-summary --report-source",
"lint": "phpcs --standard=./.phpcs.xml",
"phpcs": "phpcs --standard=./.phpcs.xml"
},
"config": {
"allow-plugins": {
Expand Down
Loading

0 comments on commit 2779b33

Please sign in to comment.