Skip to content

Commit

Permalink
Merge pull request #24 from newfold-labs/solutions
Browse files Browse the repository at this point in the history
Solutions
  • Loading branch information
arunshenoy99 authored Oct 9, 2024
2 parents b418c3a + 15bd2f8 commit ac8d961
Show file tree
Hide file tree
Showing 32 changed files with 19,914 additions and 37 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/lint-check-spa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: "JS Lint Checker: Installer Module"
on:
workflow_dispatch:
push:
paths:
- "src/**/*.js"
- "src/**/*.scss"
pull_request:
types: [opened, edited, reopened, ready_for_review]
paths:
- "src/**/*.js"
- "src/**/*.scss"

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

jobs:
lint-check-spa:
name: Run Lint Checks
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3

# Install Node and npm
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: 'npm'

# Checks if node_modules exists in the cache.
- name: Cache node_modules directory
id: cache
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-

- name: Setup Registry
run: printf "@newfold-labs:registry=https://npm.pkg.github.com/\n//npm.pkg.github.com/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
if: steps.cache.outputs.cache-hit != 'true'

# Installs @wordpress/scripts for lint checks if it does not exist in the cache.
- name: Install dependencies
run: npm i @wordpress/[email protected] --legacy-peer-deps
if: steps.cache.outputs.cache-hit != 'true'

# Gets the files changed wrt to trunk and filters out the js files.
- uses: technote-space/get-diff-action@v6
with:
PATTERNS: |
+(src)/**/*.js
# Runs wp-scripts for checking JS coding issues.
- name: Run JS Lint
id: js-lint
run: npx wp-scripts lint-js ${{ env.GIT_DIFF }}
if: "!! env.GIT_DIFF"

# Gets the files changed wrt to trunk and filters out the SASS files.
- uses: technote-space/get-diff-action@v6
with:
PATTERNS: |
+(src)/**/*.scss
if: ${{ success() || steps.js-lint.conclusion == 'failure' }}

# Runs wp-scripts for checking SASS coding issues.
- name: Run SASS Lint
id: sass-lint
run: npx wp-scripts lint-style ${{ env.GIT_DIFF }}
if: ${{ (!! env.GIT_DIFF) && (success() || steps.js-lint.conclusion == 'failure') }}
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
php-version: '8.2'
coverage: none
tools: composer, cs2pr

Expand Down
13 changes: 5 additions & 8 deletions bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

use NewfoldLabs\WP\Module\Installer\Installer;
use NewfoldLabs\WP\ModuleLoader\Container;
use NewfoldLabs\WP\Module\Installer\Installer;
use NewfoldLabs\WP\Module\Installer\Data\Constants;

use function NewfoldLabs\WP\ModuleLoader\register;

if ( function_exists( 'add_action' ) ) {
Expand All @@ -13,20 +15,15 @@ function () {
register(
array(
'name' => 'installer',
'label' => __( 'Installer', 'newfold-installer-module' ),
'label' => __( 'Installer', 'wp-module-installer' ),
'callback' => function ( Container $container ) {

if ( ! defined( 'NFD_INSTALLER_VERSION' ) ) {
define( 'NFD_INSTALLER_VERSION', '1.1.5' );
}

new Constants( $container );
new Installer( $container );
},
'isActive' => true,
'isHidden' => true,
)
);

}
);

Expand Down
1 change: 1 addition & 0 deletions build/1.2.0-beta/dataAttrListener.asset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php return array('dependencies' => array('wp-api-fetch', 'wp-dom-ready'), 'version' => 'e882fc6f7a957b49c6b4');
1 change: 1 addition & 0 deletions build/1.2.0-beta/dataAttrListener.js

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

4 changes: 4 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@
]
}
},
"require": {
"newfold-labs/wp-module-pls": "^0.1.0"
},
"require-dev": {
"wp-cli/wp-cli": "^2.11",
"newfold-labs/wp-php-standards": "^1.2"
},
"config": {
Expand Down
Loading

0 comments on commit ac8d961

Please sign in to comment.