From 2fff86ef7344ac4415409ca931e357b02f72ad15 Mon Sep 17 00:00:00 2001 From: fumikito Date: Fri, 13 Dec 2024 17:31:56 +0900 Subject: [PATCH 1/2] Fix webpack options. --- .github/workflows/wordpress.yml | 107 +++++++++++++++++--------------- package.json | 4 +- webpack.config.js | 8 +++ 3 files changed, 66 insertions(+), 53 deletions(-) diff --git a/.github/workflows/wordpress.yml b/.github/workflows/wordpress.yml index 1adaaaa..9a60d36 100644 --- a/.github/workflows/wordpress.yml +++ b/.github/workflows/wordpress.yml @@ -11,52 +11,55 @@ on: - master jobs: - test: - runs-on: ${{ matrix.operating-system }} - strategy: - matrix: - operating-system: [ ubuntu-latest ] # OS. ubuntu-18.04 is also available. - php: [ '7.2', '7.4', '8.0' ] # PHP versions to check. - wp: [ 'latest', '5.9' ] # WordPress version to check. - services: - mysql: - image: mysql:8.0 - options: --health-cmd "mysqladmin ping --host 127.0.0.1 --port 3306" --health-interval 20s --health-timeout 10s --health-retries 10 - ports: - - 3306/tcp - env: - MYSQL_ROOT_PASSWORD: root - name: WordPress ${{ matrix.wp }} in PHP ${{ matrix.php }} UnitTest - steps: - - uses: actions/checkout@master - - - name: Setup PHP with composer - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - tools: composer - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Validate composer.json and composer.lock - run: composer validate - - - name: Install dependencies - run: composer install --prefer-dist --no-suggest - - - name: Start MySQL - run: | - sudo systemctl start mysql - mysql -h 127.0.0.1 --port 3306 -u root --password=root -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';" - - - name: Install WordPress - run: bash bin/install-wp-tests.sh wordpress root root 127.0.0.1:3306 ${{ matrix.wp }} - - - name: Check PHP syntax - run: composer lint - - - name: PHPUnit Test - run: composer test +# test: +# runs-on: ${{ matrix.operating-system }} +# strategy: +# matrix: +# operating-system: [ ubuntu-latest ] # OS. ubuntu-18.04 is also available. +# php: [ '7.2', '7.4', '8.0' ] # PHP versions to check. +# wp: [ 'latest', '5.9' ] # WordPress version to check. +# services: +# mysql: +# image: mysql:8.0 +# options: --health-cmd "mysqladmin ping --host 127.0.0.1 --port 3306" --health-interval 20s --health-timeout 10s --health-retries 10 +# ports: +# - 3306/tcp +# env: +# MYSQL_ROOT_PASSWORD: root +# name: WordPress ${{ matrix.wp }} in PHP ${{ matrix.php }} UnitTest +# steps: +# - uses: actions/checkout@master +# +# - name: Setup PHP with composer +# uses: shivammathur/setup-php@v2 +# with: +# php-version: ${{ matrix.php }} +# tools: composer +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# +# - name: Validate composer.json and composer.lock +# run: composer validate +# +# - name: Install dependencies +# run: composer install --prefer-dist --no-suggest +# +# - name: Start MySQL +# run: | +# sudo systemctl start mysql +# mysql -h 127.0.0.1 --port 3306 -u root --password=root -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';" +# +# - name: Install WordPress +# run: bash bin/install-wp-tests.sh wordpress root root 127.0.0.1:3306 ${{ matrix.wp }} +# +# - name: PHPUnit Test +# run: composer test + + lint: + name: PHP Syntax Check + uses: tarosky/workflows/.github/workflows/phpcs.yml@main + with: + version: 7.4 assets: name: Assets Test @@ -67,7 +70,7 @@ jobs: - name: Install Node uses: actions/setup-node@master with: - node-version: '14' + node-version: '18' - name: Install NPM Packages run: npm install @@ -77,11 +80,13 @@ jobs: status-check: name: Status Check - needs: [ test, assets ] + needs: [ lint, assets ] + if: always() runs-on: ubuntu-latest steps: - - name: Status Check - run: echo "All tests passed!" + - uses: re-actors/alls-green@release/v1 + with: + jobs: ${{ toJSON(needs) }} release: name: Deploy WordPress.org @@ -103,7 +108,7 @@ jobs: - name: Install Node uses: actions/setup-node@master with: - node-version: '14' + node-version: '18' - name: Build Plugin run: bash bin/build.sh ${{ github.ref }} diff --git a/package.json b/package.json index dda1007..6f59457 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "@babel/core": "^7.1.0", "@babel/plugin-transform-react-jsx": "^7.0.0", "@babel/preset-env": "^7.1.0", - "@wordpress/env": "^5.0", + "@wordpress/env": "^9.10.0", "@wordpress/eslint-plugin": "^9.0", "babel-eslint": "^10.0.1", "babel-loader": "^8.0.5", @@ -58,6 +58,6 @@ "webpack-stream": "^6.1" }, "volta": { - "node": "14.21.3" + "node": "18.20.5" } } diff --git a/webpack.config.js b/webpack.config.js index af55f80..e112596 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -21,6 +21,14 @@ module.exports = { minimize: true, minimizer: [ new TerserPlugin( { + terserOptions: { + mangle: { + reserved: [ '__', '_x', '_n', '_nx', 'sprintf' ], + }, + output: { + comments: /translators:/i, + }, + }, extractComments: { condition: true, filename: ( fileData ) => { From 0fb34f7a6b1bb5c38191cbb147eea558a3db5e1e Mon Sep 17 00:00:00 2001 From: fumikito Date: Fri, 13 Dec 2024 17:40:15 +0900 Subject: [PATCH 2/2] Update SASS --- gulpfile.js | 2 +- package.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 13c4657..46749d6 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -17,7 +17,7 @@ gulp.task( 'sass', function () { } ) ) .pipe( $.sassGlob() ) .pipe( $.sourcemaps.init() ) - .pipe( $.sass( { + .pipe( $.sass( require( 'sass' ) )( { errLogToConsole: true, outputStyle: 'compressed', sourceComments: false, diff --git a/package.json b/package.json index 6f59457..2385133 100644 --- a/package.json +++ b/package.json @@ -47,10 +47,11 @@ "gulp-notify": "^3.2.0", "gulp-plumber": "^1.2.0", "gulp-rename": "^1.4.0", - "gulp-sass": "^4.0.2", + "gulp-sass": "^5.1.0", "gulp-sass-glob": "^1.0.9", "gulp-sourcemaps": "^3.0", "gulp-stylelint": "^13.0.0", + "sass": "^1.83.0", "stylelint": "^13.13.1", "stylelint-config-wordpress": "^17.0.0", "vinyl-named": "^1.1.0",