-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce Posts & Post Types Selects
- Loading branch information
Showing
41 changed files
with
4,949 additions
and
3,406 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: JS Quality Assurance | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
paths: | ||
- '**/workflows/*js*' | ||
- '**.js' | ||
- '**.jsx' | ||
- '**.ts' | ||
- '**.tsx' | ||
- '**.json' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
if: "!github.event.pull_request.draft" | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v2 | ||
with: | ||
cache: 'yarn' | ||
node-version: '16' | ||
|
||
- name: Install | ||
run: yarn install | ||
|
||
- name: Coding Style | ||
run: yarn cs | ||
|
||
- name: Linting JavaScript | ||
run: yarn lint:js | ||
|
||
- name: Unit Tests | ||
run: yarn test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: PHP Quality Assurance | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
paths: | ||
- '**.php' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
if: "!contains(github.event.head_commit.message, '--skip ci') && !github.event.pull_request.draft" | ||
strategy: | ||
matrix: | ||
php-versions: [ '8.0' ] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
|
||
- name: Check syntax error in sources | ||
run: find ./src/ ./tests/ -type f -name '*.php' -print0 | xargs -0 -L 1 -P 4 -- php -l | ||
|
||
- name: Install dependencies | ||
uses: "ramsey/composer-install@v1" | ||
|
||
- name: Check code styles | ||
run: composer cs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,7 @@ | ||
*.json | ||
*.scss | ||
*.css | ||
|
||
.psalm | ||
.github | ||
|
||
./coverage | ||
./vendor | ||
./node_modules | ||
./public | ||
./build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,16 @@ | ||
const prettierConfig = require('@wordpress/scripts/config/.prettierrc.js') | ||
const prettierConfig = require('@wordpress/scripts/config/.prettierrc.js'); | ||
|
||
module.exports = prettierConfig | ||
module.exports = { | ||
...prettierConfig, | ||
importOrder: [ | ||
'<THIRD_PARTY_MODULES>', | ||
'^@jest/(.*)$', | ||
'^@testing-library/(.*)$', | ||
'^@faker-js/faker', | ||
'^@wordpress/(.*)$', | ||
'^[./]', | ||
], | ||
importOrderSeparation: true, | ||
importOrderSortSpecifiers: false, | ||
importOrderCaseInsensitive: false, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"php.suggest.basic": true, | ||
"php.validate.enable": true, | ||
"php.validate.executablePath": "/usr/bin/php", | ||
"php.format.codeStyle": "Off", | ||
"phpCodeSniffer.standardCustom": "./phpcs.xml", | ||
"phpCodeSniffer.standard": "Custom", | ||
"phpCodeSniffer.autoExecutable": true, | ||
"[php]": { | ||
"editor.defaultFormatter": "obliviousharmony.vscode-php-codesniffer" | ||
}, | ||
"prettier.configPath": ".prettierrc.js" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
{ | ||
"core": "WordPress/WordPress", | ||
"plugins": [ | ||
"." | ||
], | ||
"env": { | ||
"development": { | ||
"phpVersion": "8.0", | ||
"mappings": { | ||
"wp-content/plugins/entities-search": "." | ||
} | ||
} | ||
} | ||
"core": "./vendor/roots/wordpress-no-content", | ||
"plugins": ["."], | ||
"env": { | ||
"development": { | ||
"phpVersion": "8.0", | ||
"mappings": { | ||
"wp-content/plugins/entities-search": "." | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import type { Set } from 'immutable'; | ||
import React from 'react'; | ||
|
||
import { BaseEntityRecords, Context } from '@wordpress/core-data'; | ||
|
||
type ComponentStateAware<V> = { | ||
value: Set<V>; | ||
setValue(value: ComponentStateAware<V>['value']): void; | ||
}; | ||
|
||
export default EntitiesSearch; | ||
|
||
declare namespace EntitiesSearch { | ||
type PostType<C extends Context = 'view'> = BaseEntityRecords.Type<C>; | ||
|
||
type ViewablePostType = Readonly<{ | ||
[K in keyof PostType<'edit'>]: K extends 'viewable' | ||
? true | ||
: PostType<'edit'>[K]; | ||
}>; | ||
|
||
type ControlOption<V extends any> = Readonly<{ | ||
value: V; | ||
label: string; | ||
}>; | ||
|
||
type ComponentStateAware<V> = { | ||
value: V; | ||
setValue(value: ComponentStateAware['value']): void; | ||
}; | ||
|
||
type EntitiesRecords<Entity> = Readonly<{ | ||
records(): Set<Entity>; | ||
isResolving(): boolean; | ||
errored(): boolean; | ||
succeed(): boolean; | ||
}>; | ||
|
||
/** | ||
* Components | ||
*/ | ||
interface PostTypeSelect<V> { | ||
readonly value: V | null; | ||
readonly options: Set<ControlOption<V>>; | ||
readonly onChange: (value: PostTypeSelect<V>['value']) => void; | ||
} | ||
|
||
interface PostsSelect<V> { | ||
readonly value: Set<V> | null; | ||
readonly options: Set<ControlOption<V>>; | ||
readonly onChange: (values: PostsSelect<V>['value']) => void; | ||
} | ||
|
||
interface PostsController<P, T> { | ||
readonly postsComponent: React.ComponentType< | ||
ComponentStateAware<Set<P>> | ||
>; | ||
readonly typesComponent: React.ComponentType<ComponentStateAware<T>>; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,39 @@ | ||
{ | ||
"name": "widoz/entities-search", | ||
"description": "A WordPress package to search Entities including Rest API Endpoints and React Components", | ||
"type": "library", | ||
"license": "GPL-v2-or-later", | ||
"autoload": { | ||
"psr-4": { | ||
"Widoz\\EntitiesSearch\\": "sources/php/src/" | ||
} | ||
}, | ||
"authors": [ | ||
{ | ||
"name": "guido scialfa", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"minimum-stability": "stable", | ||
"require": { | ||
"php": ">=8.0" | ||
}, | ||
"require-dev": { | ||
"roots/wordpress": "^6.2", | ||
"inpsyde/modularity": "^1.5" | ||
}, | ||
"config": { | ||
"platform": { | ||
"php": "8.0" | ||
}, | ||
"allow-plugins": { | ||
"roots/wordpress-core-installer": true | ||
} | ||
}, | ||
"extra": { | ||
"wordpress-install-dir": "vendor/wordpress/wordpress", | ||
"installer-disable": [ | ||
"wordpress" | ||
] | ||
} | ||
"name": "widoz/entities-search", | ||
"description": "A WordPress package to search Entities including Rest API Endpoints and React Components", | ||
"type": "library", | ||
"license": "GPL-v2-or-later", | ||
"version": "1.0.0", | ||
"autoload": { | ||
"psr-4": { | ||
"Widoz\\EntitiesSearch\\": "sources/php/src/" | ||
} | ||
}, | ||
"authors": [ | ||
{ | ||
"name": "guido scialfa", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"minimum-stability": "stable", | ||
"require": { | ||
"php": ">=8.0" | ||
}, | ||
"require-dev": { | ||
"inpsyde/modularity": "^1.5", | ||
"inpsyde/php-coding-standards": "^1.0", | ||
"roots/wordpress-no-content": "^6.3" | ||
}, | ||
"config": { | ||
"platform": { | ||
"php": "8.0" | ||
}, | ||
"allow-plugins": { | ||
"dealerdirect/phpcodesniffer-composer-installer": true | ||
} | ||
}, | ||
"scripts": { | ||
"cs": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs", | ||
"cs:fix": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcbf" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,43 +3,49 @@ | |
"version": "1.0.0", | ||
"description": "A WordPress package to search Entities including Rest API Endpoints and React Components", | ||
"author": "guido scialfa <[email protected]>", | ||
"main": "./sources/js/src/index.ts", | ||
"types": "./sources/js/src/@types/index.d.ts", | ||
"main": "./build/index.js", | ||
"license": "GPL-2.0-or-later", | ||
"engines": { | ||
"node": "16" | ||
}, | ||
"devDependencies": { | ||
"@faker-js/faker": "^7.6.0", | ||
"@jest/globals": "^29.4.3", | ||
"@testing-library/dom": "^9.3.1", | ||
"@testing-library/react": "^14.0.0", | ||
"@testing-library/user-event": "^14.5.1", | ||
"@total-typescript/shoehorn": "^0.1.0", | ||
"@trivago/prettier-plugin-sort-imports": "^4.0.0", | ||
"@wordpress/dependency-extraction-webpack-plugin": "^4.8.0", | ||
"@wordpress/env": "^5.9.0", | ||
"@wordpress/eslint-plugin": "^14.8.0", | ||
"@wordpress/scripts": "^25.1.0", | ||
"@wordpress/scripts": "^26.0.0", | ||
"eslint-import-resolver-typescript": "^3.5.5", | ||
"jest": "^29.4.3", | ||
"jest-environment-jsdom": "^29.5.0", | ||
"prettier": "^2.8.1", | ||
"ts-jest": "^29.0.5", | ||
"ts-loader": "^9.4.2", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^5.0.3", | ||
"typescript": "~5.1.0", | ||
"yarn": "^1.22.19" | ||
}, | ||
"dependencies": { | ||
"@emotion/styled": "^11.10.5", | ||
"@wordpress/api-fetch": "^6.21.0", | ||
"@wordpress/components": "^23.1.0", | ||
"@wordpress/element": "^5.1.0", | ||
"@wordpress/i18n": "^4.24.0", | ||
"react": "^18.2.0", | ||
"react-select": "^5.7.0" | ||
"@emotion/styled": "~11.10.5", | ||
"@wordpress/api-fetch": "~6.21.0", | ||
"@wordpress/components": "~23.1.0", | ||
"@wordpress/core-data": "~6.12.0", | ||
"@wordpress/element": "~5.1.0", | ||
"@wordpress/i18n": "~4.24.0", | ||
"immutable": "~4.3.0", | ||
"react": "~18.2.0", | ||
"react-select": "~5.7.0" | ||
}, | ||
"scripts": { | ||
"wp-env": "wp-env", | ||
"build": "wp-scripts build --webpack-src-dir=./sources/js/src", | ||
"build:dev": "wp-scripts build --mode=development --webpack-src-dir=./sources/js/src", | ||
"build:dev": "wp-scripts start --webpack--devtool=inline-source-map --webpack-src-dir=./sources/js/src", | ||
"cs": "yarn prettier --check ./sources/js", | ||
"cs:fix": "wp-scripts format ./sources/js", | ||
"lint:js": "wp-scripts lint-js", | ||
"lint:js:fix": "wp-scripts lint-js --fix", | ||
|
Oops, something went wrong.