Skip to content

Commit

Permalink
Merge pull request #1677 from xwp/release/v4.1.0
Browse files Browse the repository at this point in the history
Release `4.1.0`
  • Loading branch information
bartoszgadomski authored Jan 22, 2025
2 parents ec217b8 + 051f5f1 commit b4acdc4
Show file tree
Hide file tree
Showing 248 changed files with 23,546 additions and 22,666 deletions.
15 changes: 13 additions & 2 deletions .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
.distignore
.editorconfig
.eslintignore
.eslintrc.json
.eslintrc.js
.gitignore
.nvmrc
.phpunit.result.cache
composer.lock
docker-compose.build.yml
docker-compose.yml
Expand All @@ -14,14 +15,24 @@ package-lock.json
phpcs.xml.dist
phpunit.xml
phpunit-multisite.xml
playwright.config.js
renovate.json
.git
.github
.idea
.vscode
.wordpress-org
build
dist
local
node_modules
tests

# Playwright generated files.
/artifacts/
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/

# JS and SCSS source files.
/src/
2 changes: 0 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/ui/lib/
**/*.min.js
/vendor/
/node_modules/
/build/
Expand Down
18 changes: 18 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
extends: [
'plugin:@wordpress/eslint-plugin/recommended-with-formatting',
],
env: {
browser: true,
es6: true,
},
rules: {
'@wordpress/no-global-event-listener': 'off',
'jsdoc/check-indentation': 'error',
'@wordpress/dependency-group': 'error',
'import/order': [ 'error', { groups: [ 'builtin', [ 'external', 'unknown' ], 'internal', 'parent', 'sibling', 'index' ] } ],
'jsdoc/require-param': 'off',
'jsdoc/require-param-type': 'off',
'jsdoc/check-param-names': 'off',
},
};
13 changes: 0 additions & 13 deletions .eslintrc.json

This file was deleted.

22 changes: 11 additions & 11 deletions .github/workflows/deploy-to-stream-dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ jobs:
- name: Setup environment
run: |
set -ex
ROOT_DIR="$(git rev-parse --show-toplevel)"
WORKING_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
SRC_DIR="$ROOT_DIR/build"
SRC_DIR="$ROOT_DIR/source"
DIST_DIR="$ROOT_DIR/dist"
DIST_BRANCH="${GITHUB_REF#refs/heads/}"
DIST_TAG="${GITHUB_REF#refs/tags/}"
COMMIT_MESSAGE="$(git log -1 --oneline)"
echo "ROOT_DIR=$ROOT_DIR" >> $GITHUB_ENV
echo "WORKING_BRANCH=$WORKING_BRANCH" >> $GITHUB_ENV
echo "SRC_DIR=$SRC_DIR" >> $GITHUB_ENV
Expand All @@ -77,12 +77,12 @@ jobs:
- name: Sync files locally
run: |
set -ex
rm -rf "$SRC_DIR"
rm -rf "$DIST_DIR"
mkdir -p "$SRC_DIR"
rsync -av --exclude-from=.distignore "$ROOT_DIR/" "$SRC_DIR/"
env:
ROOT_DIR: ${{ env.ROOT_DIR }}
Expand All @@ -103,19 +103,19 @@ jobs:
- name: Deploy to xwp/stream-dist
run: |
set -ex
export GIT_DIR="$DIST_DIR/.git"
export GIT_WORK_TREE="$DIST_DIR"
git clone --progress --verbose ${{ vars.DIST_REPO }} "$DIST_DIR/.git"
git checkout -B "$DIST_BRANCH"
# Use the release bundle as the work tree.
export GIT_WORK_TREE="$SRC_DIR"
git add --all
git commit --allow-empty --message "$COMMIT_MESSAGE"
if [ "${{ github.event_name }}" = "release" ]; then
echo "Tagging a release: $DIST_TAG"
git tag --force "$DIST_TAG"
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/deploy-to-wp-org.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ on:
# In case of a pre-release, the action will not commit to WP.org (dry-run). However, it will still
# create a zip file and upload it to the release. Note that a pre-release (release candidate)
# should not be changed to a release but rather a new release should be created.
#
# The "prereleased" type will not trigger for pre-releases published from draft releases, but
# the "published" type will trigger. Since we want a workflow to run when stable and pre-releases
# publish, we subscribe to "published" instead of "released" and "prereleased".
#
# See: https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#release
release:
types:
- released
- prereleased
types: [ published ]

jobs:
lint_and_test:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lint-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ jobs:
- name: Lint
run: npm run lint

- name: Build
run: npm run build

- name: Pull custom Docker images
run: docker compose pull wordpress

- name: Test
run: npm run test

- name: Build
run: npm run build
11 changes: 6 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ debug.log
package.lock
.phpunit.result.cache

# Compiled files
ui/js/*.min.js
ui/css/*.min.css
alerts/js/*.min.js

# Generated test data
/artifacts/
tests/data/tmp/*
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
/playwright/.auth/
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20
22
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"recommendations": [
"EditorConfig.EditorConfig",
"felixfbecker.php-debug",
"ikappas.phpcs"
"ms-playwright.playwright"
]
}
68 changes: 0 additions & 68 deletions Gruntfile.js

This file was deleted.

35 changes: 11 additions & 24 deletions alerts/class-alert-type-highlight.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class Alert_Type_Highlight extends Alert_Type {

/**
* Main JS file script handle.
*
* @deprecated 4.1.0 Constant is not used anymore and will be removed.
*/
const SCRIPT_HANDLE = 'wp-stream-alert-highlight-js';

Expand Down Expand Up @@ -307,34 +309,19 @@ public function ajax_remove_highlight() {
* @param string $page WP admin page.
*/
public function enqueue_scripts( $page ) {
if ( 'toplevel_page_wp_stream' === $page ) {
$min = wp_stream_min_suffix();

wp_register_script(
self::SCRIPT_HANDLE,
$this->plugin->locations['url'] . 'alerts/js/alert-type-highlight.' . $min . 'js',
array(
'jquery',
),
$this->plugin->get_version(),
false
);
if ( 'toplevel_page_wp_stream' !== $page ) {
return;
}

$exports = array(
$this->plugin->enqueue_asset(
'alert-type-highlight',
array(),
array(
'ajaxUrl' => admin_url( 'admin-ajax.php' ),
'removeAction' => self::REMOVE_ACTION,
'security' => wp_create_nonce( self::REMOVE_ACTION_NONCE ),
);

wp_scripts()->add_data(
self::SCRIPT_HANDLE,
'data',
sprintf( 'var _streamAlertTypeHighlightExports = %s;', wp_json_encode( $exports ) )
);

wp_add_inline_script( self::SCRIPT_HANDLE, 'streamAlertTypeHighlight.init();', 'after' );
wp_enqueue_script( self::SCRIPT_HANDLE );
}
)
);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion alerts/class-alert-type-slack.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public function alert( $record_id, $recordarr, $alert ) {
$data['icon_url'] = $options['icon'];
}
}
wp_remote_post(
wp_safe_remote_post(
$options['webhook'],
array(
'body' => wp_json_encode( $data ),
Expand Down
Loading

0 comments on commit b4acdc4

Please sign in to comment.