Skip to content

Commit

Permalink
Merge pull request #2 from newfold-labs/develop
Browse files Browse the repository at this point in the history
Algolia and Module AI stub for searching
  • Loading branch information
amartya-dev authored May 26, 2023
2 parents 54a96d3 + 89af917 commit f23e1e0
Show file tree
Hide file tree
Showing 34 changed files with 6,731 additions and 309 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Lint
on:
push:
branches:
- '**'
paths:
- '**.php'
pull_request:
types: [opened, edited, reopened, ready_for_review]
paths:
- '**.php'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
phpcs:
name: Run PHP Code Sniffer
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v3

# User PHP 7.4 here for compatibility with the WordPress codesniffer rules.
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none
tools: composer, cs2pr

- uses: technote-space/get-diff-action@v6
with:
SUFFIX_FILTER: .php

- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
if: "!! env.GIT_DIFF"

- name: Cache Composer vendor directory
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
if: "!! env.GIT_DIFF"

- name: Validate composer.json and composer.lock
run: composer validate
if: "!! env.GIT_DIFF"

- name: Install dependencies
run: composer install --no-progress --optimize-autoloader --prefer-dist
if: "!! env.GIT_DIFF"

- name: Detecting PHP Code Standards Violations
run: vendor/bin/phpcs --standard=phpcs.xml -s ${{ env.GIT_DIFF }}
if: "!! env.GIT_DIFF"
33 changes: 18 additions & 15 deletions bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,25 @@
add_action(
'plugins_loaded',
function () {
if ( ! defined( 'USER_INTERACTION_SERVICE_BASE' ) ) {
define( 'USER_INTERACTION_SERVICE_BASE', 'https://hiive.cloud/workers/ai-proxy/' );
}

register(
[
'name' => 'help-center',
'label' => __( 'Help Center', 'newfold-help-center-module' ),
'callback' => function ( Container $container ) {
define( 'NFD_HELPCENTER_BUILD_DIR', __DIR__ . '/build/' );
define( 'NFD_HELPCENTER_PLUGIN_URL', $container->plugin()->url );
new HelpCenter( $container );
},
'isActive' => true,
'isHidden' => true,
]
);
register(
[
'name' => 'help-center',
'label' => __( 'Help Center', 'newfold-help-center-module' ),
'callback' => function ( Container $container ) {
define( 'NFD_HELPCENTER_BUILD_DIR', __DIR__ . '/build/' );
define( 'NFD_HELPCENTER_PLUGIN_URL', $container->plugin()->url );
new HelpCenter( $container );
},
'isActive' => true,
'isHidden' => true,
]
);

}
);
}
);

}
2 changes: 1 addition & 1 deletion build/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wp-element'), 'version' => 'a3b5dba2d1201f830657');
<?php return array('dependencies' => array('lodash', 'react', 'wp-api-fetch', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-plugins'), 'version' => '1876b438a02bb7ce3409');
1 change: 1 addition & 0 deletions build/index.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/index.js

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,33 @@
"email": "[email protected]"
}
],
"repositories": [
{
"type": "composer",
"url": "https://newfold-labs.github.io/satis/",
"only": [
"newfold-labs/*"
]
}
],
"require-dev": {
"newfold-labs/wp-php-standards": "@stable"
},
"require": {
"newfold-labs/wp-module-data": "^2.3.4",
"newfold-labs/wp-module-ai": "^1.0.0"
},
"autoload": {
"psr-4": {
"NewfoldLabs\\WP\\Module\\HelpCenter\\": "includes"
},
"files": [
"bootstrap.php"
]
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
Loading

0 comments on commit f23e1e0

Please sign in to comment.