10 Commits

Author SHA1 Message Date
a40fee4819 add ids 2024-07-19 18:13:56 +02:00
a54568abad set json 2024-07-19 17:56:27 +02:00
7f5784d710 add php v8 2024-07-19 17:31:08 +02:00
5c5b74fcdf Update README.md
Travis no longer usable
2023-03-20 14:06:23 +01:00
570964309b Merge pull request #1 from hkreuter/master_fixes
Small fixes
2021-08-19 17:26:43 +03:00
8de9123000 Small fixes 2021-06-20 18:28:17 +02:00
6851ddf757 Add install into shop section 2021-04-22 14:03:37 +02:00
7e29580d2e fix packages 2021-04-21 15:22:25 +02:00
d85b851af4 Update to latest base module 2021-04-21 15:20:57 +02:00
6d082f7900 OXDEV-4026 Use new grapql module ids 2020-10-20 11:53:34 +03:00
12 changed files with 138 additions and 107 deletions

51
.github/workflows/CI.yml vendored Normal file
View File

@ -0,0 +1,51 @@
name: CI
on: [push, pull_request]
jobs:
build:
runs-on: Ubuntu-20.04
strategy:
matrix:
php: ['7.1', '7.2', '7.3', '7.4']
DEPENDENCIES: ['', '--prefer-lowest']
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Create project
run: composer create-project oxid-esales/graphql-module --repository packages.json --remove-vcs -n --no-plugins
- name: Syntax Test
run: composer test:syntax
working-directory: ./graphql-module
- name: Lint Test
run: composer test:lint
working-directory: ./graphql-module
- name: Static Analyzer
run: composer test:static
working-directory: ./graphql-module
- name: Unit Tests
run: composer test:unit
working-directory: ./graphql-module

45
.github/workflows/CI.yml.dist vendored Normal file
View File

@ -0,0 +1,45 @@
name: CI
on: [push, pull_request]
jobs:
build:
runs-on: Ubuntu-20.04
strategy:
matrix:
php: ['7.1', '7.2', '7.3', '7.4']
DEPENDENCIES: ['', '--prefer-lowest']
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install
run: composer install -n --no-plugins $DEPENDENCIES
- name: Syntax Test
run: composer test:syntax
- name: Lint Test
run: composer test:lint
- name: Static Analyzer
run: composer test:static
- name: Unit Tests
run: composer test:unit

View File

@ -10,33 +10,14 @@ EOF;
$finder = PhpCsFixer\Finder::create()
->exclude('Codeception/_support/_generated/')
->in(__DIR__ . '/src')
->in(__DIR__ . '/tests/');
->in(__DIR__ . '/tests/')
->name('*.stub');
return PhpCsFixer\Config::create()
->setFinder($finder)
->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
'blank_line_after_opening_tag' => true,
'compact_nullable_typehint' => true,
'declare_equal_normalize' => [
'space' => 'none'
],
'function_typehint_space' => true,
'final_class' => true,
'method_argument_space' => [
'on_multiline' => 'ensure_fully_multiline',
],
'new_with_braces' => true,
'no_empty_statement' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_whitespace_in_blank_line' => true,
'return_type_declaration' => [
'space_before' => 'none'
],
'single_trait_insert_per_statement' => true,
'@PSR12' => true,
'align_multiline_comment' => [
'comment_type' => 'all_multiline'
],
@ -91,6 +72,15 @@ return PhpCsFixer\Config::create()
],
'declare_strict_types' => true,
'dir_constant' => true,
'final_internal_class' => [
'annotation-white-list' => [],
'consider-absent-docblock-as-internal-class' => true,
'annotation-black-list' => [
'@eshopExtension',
'@dataType-extension',
'@extendable-dataType'
],
],
'global_namespace_import' => [
'import_classes' => true,
'import_constants' => true,

View File

@ -1,29 +0,0 @@
language: php
dist: bionic
notifications:
email: false
php:
- "7.1"
- "7.2"
- "7.3"
- "7.4"
cache:
directories:
- $HOME/.composer/cache/files
matrix:
fast_finish: true
before_script:
- composer create-project oxid-esales/graphql-module --repository packages.json --remove-vcs -n
script:
- cd graphql-module
- composer test:syntax
- composer test:lint
- composer test:static
- composer test:unit

View File

@ -1,28 +0,0 @@
language: php
dist: bionic
notifications:
email: false
php:
- "7.1"
- "7.2"
- "7.3"
- "7.4"
cache:
directories:
- $HOME/.composer/cache/files
matrix:
fast_finish: true
before_script:
- composer install --prefer-dist
script:
- composer test:syntax
- composer test:lint
- composer test:static
- composer test:unit

View File

@ -1,7 +1,7 @@
# oxid-esales/graphql-module-skeleton
[![Build Status](https://img.shields.io/travis/com/OXID-eSales/graphql-module-skeleton/master.svg?style=for-the-badge&logo=travis)](https://travis-ci.com/OXID-eSales/graphql-module-skeleton) [![PHP Version](https://img.shields.io/packagist/php-v/oxid-esales/graphql-module-skeleton.svg?style=for-the-badge)](https://github.com/oxid-esales/graphql-module-skeleton) [![Stable Version](https://img.shields.io/packagist/v/oxid-esales/graphql-module-skeleton.svg?style=for-the-badge&label=latest)](https://packagist.org/packages/oxid-esales/graphql-module-skeleton)
[![PHP Version](https://img.shields.io/packagist/php-v/oxid-esales/graphql-module-skeleton.svg?style=for-the-badge)](https://github.com/oxid-esales/graphql-module-skeleton) [![Stable Version](https://img.shields.io/packagist/v/oxid-esales/graphql-module-skeleton.svg?style=for-the-badge&label=latest)](https://packagist.org/packages/oxid-esales/graphql-module-skeleton)
## What is this?
@ -19,7 +19,14 @@ This skeleton will set you up with a
$ composer create-project oxid-esales/graphql-module-skeleton
```
This provides you with a basic GraphQL OXID module, that you may install into the shop via `composer`.
This provides you with a basic GraphQL OXID module. To install this freshly created module into your OXID eShop you can:
```bash
$ composer config repositories.graphql path path-to-module/that-you-just-created
$ composer require my-vendor/my-package
```
Make sure that `my-vendor/my-package` matches the package name in the package `composer.json`.
## License

View File

@ -10,15 +10,15 @@
}
},
"require": {
"php": "^7.1",
"oxid-esales/graphql-base": "^3.1.3"
"php": "^7.1|^8",
"oxid-esales/graphql-base": "^8.0"
},
"require-dev": {
"phpunit/phpunit": "^7.5.20|^8.5|^9",
"friendsofphp/php-cs-fixer": "^2.16.4",
"friendsofphp/php-cs-fixer": "^2.18.2",
"php-parallel-lint/php-parallel-lint": "^1.1",
"phpstan/phpstan": "^0.12.26",
"oxid-esales/oxideshop-ce": "^6.5",
"oxid-esales/oxideshop-ce": "^7.0",
"oxid-esales/oxideshop-unified-namespace-generator": "^2.0"
},
"autoload": {
@ -28,12 +28,6 @@
}
},
"scripts": {
"pre-install-cmd": [
"OxidEsales\\GraphQL\\Skeleton\\Installer::preInstall"
],
"pre-update-cmd": [
"OxidEsales\\GraphQL\\Skeleton\\Installer::preInstall"
],
"post-create-project-cmd": [
"OxidEsales\\GraphQL\\Skeleton\\Installer::postInstall",
"composer update",

View File

@ -13,12 +13,12 @@ $sMetadataVersion = '2.0';
* Module information
*/
$aModule = [
'id' => '__PackageFull__',
'title' => 'GraphQL __Package__',
'id' => 'graphql-module-skeleton',
'title' => 'GraphQL module skeleton',
'description' => '',
'thumbnail' => 'out/pictures/logo.png',
'version' => '0.0.1',
'author' => '__Vendor__',
'author' => 'OxidEsales',
'url' => '',
'email' => '',
'extend' => [

View File

@ -4,11 +4,11 @@ services:
public: false
autowire: true
__Vendor__\GraphQL\__Package__\:
OxidEsales\GraphQL\Skeleton\:
resource: 'src/*'
exclude: 'src/**/DataType'
exclude: 'src/**/{DataType,Exception,Infrastructure}'
public: true
__Vendor__\GraphQL\__Package__\Shared\Service\NamespaceMapper:
class: __Vendor__\GraphQL\__Package__\Shared\Service\NamespaceMapper
OxidEsales\GraphQL\Skeleton\Shared\Service\NamespaceMapper:
class: OxidEsales\GraphQL\Skeleton\Shared\Service\NamespaceMapper
tags: ['graphql_namespace_mapper']

View File

@ -24,7 +24,7 @@ final class CategoryRepository
$category = oxNew(CategoryEshopModel::class);
if (!$category->load($id)) {
throw new NotFound();
throw new NotFound($id);
}
return new CategoryDataType(

View File

@ -15,6 +15,10 @@ class Installer
private static $packageName;
public static function preInstall(Event $event): void
{
}
public static function postInstall(Event $event = null): void
{
$io = $event->getIO();
$vendor = self::ask($io, 'What is the vendor?', 'MyVendor');
@ -26,10 +30,9 @@ class Installer
// Update composer definition
$json->write($composerDefinition);
$io->write("<info>composer.json for {$composerDefinition['name']} is created.\n</info>");
}
public static function postInstall(Event $event = null): void
{
unset($event);
list($vendor, $package, $packageFull) = self::$packageName;
$skeletonRoot = dirname(__DIR__);
@ -37,10 +40,9 @@ class Installer
// remove installer files
unlink($skeletonRoot.'/README.md');
unlink($skeletonRoot.'/LICENSE');
unlink($skeletonRoot.'/.travis.yml');
unlink($skeletonRoot.'/packages.json');
rename($skeletonRoot.'/README.md.dist', $skeletonRoot.'/README.md');
rename($skeletonRoot.'/.travis.yml.dist', $skeletonRoot.'/.travis.yml');
rename($skeletonRoot.'/.github/workflows/CI.yml.dist', $skeletonRoot.'/.github/workflows/CI.yml');
unlink(__FILE__);
}
@ -74,8 +76,7 @@ class Installer
unset(
$composerDefinition['autoload']['files'],
$composerDefinition['scripts']['pre-install-cmd'],
$composerDefinition['scripts']['pre-update-cmd'],
$composerDefinition['scripts']['post-create-project-cmd'],
$composerDefinition['scripts']['post-install-cmd'],
$composerDefinition['homepage']
);

View File

@ -17,7 +17,7 @@ use OxidEsales\Facts\Facts;
class Acceptance extends \Codeception\Module
{
public function _beforeSuite($settings = []) {
exec((new Facts())->getShopRootPath() . '/bin/oe-console oe:module:activate oe/graphql-base');
exec((new Facts())->getShopRootPath() . '/bin/oe-console oe:module:activate oe_graphql_base');
exec((new Facts())->getShopRootPath() . '/bin/oe-console oe:module:activate __PackageFull__');
}
}