Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
a40fee4819 | |||
a54568abad | |||
7f5784d710 | |||
5c5b74fcdf | |||
570964309b | |||
8de9123000 | |||
6851ddf757 | |||
7e29580d2e | |||
d85b851af4 | |||
6d082f7900 |
51
.github/workflows/CI.yml
vendored
Normal file
51
.github/workflows/CI.yml
vendored
Normal 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
45
.github/workflows/CI.yml.dist
vendored
Normal 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
|
34
.php_cs.dist
34
.php_cs.dist
@ -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,
|
||||
|
29
.travis.yml
29
.travis.yml
@ -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
|
@ -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
|
11
README.md
11
README.md
@ -1,7 +1,7 @@
|
||||
# oxid-esales/graphql-module-skeleton
|
||||
|
||||
|
||||
[](https://travis-ci.com/OXID-eSales/graphql-module-skeleton) [](https://github.com/oxid-esales/graphql-module-skeleton) [](https://packagist.org/packages/oxid-esales/graphql-module-skeleton)
|
||||
[](https://github.com/oxid-esales/graphql-module-skeleton) [](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
|
||||
|
||||
|
@ -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",
|
||||
|
@ -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' => [
|
||||
|
@ -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']
|
||||
|
@ -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(
|
||||
|
@ -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']
|
||||
);
|
||||
|
||||
|
@ -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__');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user