Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
amansilla committed Jan 18, 2024
0 parents commit d6cd06f
Show file tree
Hide file tree
Showing 49 changed files with 6,204 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .env.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SPRYKER_TOOLKIT_CHATGPT_API_AUTH_KEY=""
SPRYKER_TOOLKIT_DEEPL_API_AUTH_KEY=""
71 changes: 71 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: CI

on:
pull_request:

push:
branches:
- main

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

concurrency:
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
validation:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-version: [
'8.1',
'8.2',
'8.3'
]

steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, intl

- name: Checkout
uses: actions/checkout@v3

- name: Composer validate
run: composer validate

- name: Composer get cache directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Composer cache
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Composer install
run: |
composer --version
if [[ ${{ matrix.php-version }} == '8.2' ]]; then
composer update --prefer-stable --optimize-autoloader
else
composer install --optimize-autoloader
fi
- name: Warmup
run: ./bin/spryker-toolkit container:dump

- name: PHPStan checks
run: composer stan

- name: CodeStyle checks
run: composer cs-check
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# IDE
.idea/
.project/
nbproject/
.buildpath/
.settings/
*.sublime-*

# app
/.env
/var/*
!/var/cache
/var/cache/*
!/var/cache/.gitkeep
!/var/log
/var/log/*
!/var/log/.gitkeep

# tooling
vendor/
Empty file added CONTRIBUTING.md
Empty file.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Spryker Community

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
139 changes: 139 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
<h1 align="center">
Spryker CLI Toolkit
<br>
</h1>

<h4 align="center">A suite of utilities designed to enhance performance in your day-to-day operations with Spryker Commerce OS.</h4>

<p align="center">
<a href="#installation">Installation</a> •
<a href="#usage">Usage</a> •
<a href="#contributing">Contributing</a>
</p>

<p align="center">
<a href="https://github.com/spryker-community/spryker-toolkit/actions?query=workflow%3ACI+branch%3Amain">
<img src="https://github.com/spryker-community/spryker-toolkit/workflows/CI/badge.svg?branch=main"/>
</a>
<a href="https://packagist.org/packages/spryker-community/sprkyer-translations">
<img src="https://img.shields.io/packagist/v/spryker-community/sprkyer-translations.svg?style=flat-square">
</a>
<a href="LICENSE">
<img src="https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square">
</a>
<a href="https://commercequest.space/">
<img src="https://img.shields.io/badge/join-commercequest-blue.svg?logo=data:image/svg%2bxml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSIxNnB4IiBoZWlnaHQ9IjE2cHgiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgMTYgMTYiIHhtbDpzcGFjZT0icHJlc2VydmUiPiAgPGltYWdlIGlkPSJpbWFnZTAiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgeD0iMCIgeT0iMCIKICAgIGhyZWY9ImRhdGE6aW1hZ2UvcG5nO2Jhc2U2NCxpVkJPUncwS0dnb0FBQUFOU1VoRVVnQUFBQkFBQUFBUUNBTUFBQUFvTFE5VEFBQUFCR2RCVFVFQUFMR1BDL3hoQlFBQUFDQmpTRkpOCkFBQjZKZ0FBZ0lRQUFQb0FBQUNBNkFBQWRUQUFBT3BnQUFBNm1BQUFGM0NjdWxFOEFBQUNXRkJNVkVVQUFBQUFydThBcmU0QXNQSGQKQ3BIckFJdnNBSXpxQUl2WkFJRUFpcjBBc1BEWURaTGVBb2NBcWVnQXJlMEFwdU1BU0dRQWw5Q0xmdjhBREE4QW9OeW5BRnNBWG9IRApCbndBLy84QWxNdU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MXdBREl3TWpNdE1USXRNVFJVTVRBNgpNakE2TlRVck1EQTZNRENPVTVIV0FBQUFBRWxGVGtTdVFtQ0MiIC8+Cjwvc3ZnPgo=&style=flat-square"/>
</a>
</p>

## Installation

### Git clone

```bash
git clone https://github.com/spyker-community/spryker-toolkit && cd spryker-toolkit
bin/spryker-toolkit
```

### Composer

```bash
composer require --dev spryker-community/spryker-toolkit
vendor/bin/spryker-toolkit
```

## Usage

You can see all the available commands by executing:

```bash
bin/spryker-toolkit --help
```

### Prerequisites

Some of the commands use external services like OpenAI or DeepL that requires API credentials. In those cases you will require to add the credential to your `.env` file.

1. Copy the template for the environment variables:

```bash
cp .env.dist .env
```

2. Add your own auth credentials for the service you are using:
```
SPRYKER_TOOLKIT_DEEPL_API_AUTH_KEY="your_deepl_api_token"
SPRYKER_TOOLKIT_CHATGPT_API_AUTH_KEY="your_chatgpt_api_token"
```

### Generate translations for the Spryker Yves storefront

```bash
bin/spryker-toolkit translation:yves:generate
```

#### Arguments

* `locales`: List of locales to which we want the Spryker glossary translated.

#### Options

* `--working-dir`: If specified, use the given directory as Spryker project working directory.
* `--translation-engine`: The translation engine to be used for translation generation. Allowed values are deepl or chatgpt [default: "chatgpt"]

#### Examples

1. Generate missing translations Yves glossary to Spanish from Spain (es_ES) by ChatGPT.

```bash
bin/spryker-toolkit translation:yves:generate es_ES --working-dir=../b2b-demo-marketplace- --translation-engine=chatgpt
```

2. Generate missing translations Yves glossary to Spanish from Spain (es_ES) and French from France by DeepL.

```bash
bin/spryker-toolkit translation:yves:generate es_ES fr_FR --working-dir=../b2b-demo-marketplace --translation-engine=deepl
```

### Generate translations for the Spryker Zed backoffice

```bash
bin/spryker-toolkit translation:yves:generate
```

#### Arguments

* `locales`: List of locales to which we want the Spryker glossary translated.

#### Options

* `--working-dir`: If specified, use the given directory as Spryker project working directory.
* `--translation-engine`: The translation engine to be used for translation generation. Allowed values are `deepl` or `chatgpt` [default: `chatgpt`]

#### Examples

1. Generate missing translations Zed glossary to Spanish from Spain (es_ES) by ChatGPT.

```bash
bin/spryker-toolkit translation:zed:generate es_ES --working-dir=../b2b-demo-marketplace --translation-engine=chatgpt
```

2. Generate missing translations Zed glossary to Spanish from Spain (es_ES) and French from France by DeepL.

```bash
bin/spryker-toolkit translation:zed:generate es_ES fr_FR --working-dir=../b2b-demo-marketplace --translation-engine=deepl
```

## Contributing

We love contributions, big or small. Please don't forget to read the [contribution guidelines](CONTRIBUTING.md).

## License

This package is released under the [MIT license](LICENSE)

#

<p align="center">
Supported with :heart: by the Spryker Community
</p>
32 changes: 32 additions & 0 deletions bin/spryker-toolkit
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env php
<?php
require_once __DIR__ . '/../vendor/autoload.php';

use SprykerCommunity\Toolkit\Release\Commands\PackagesReleaseCommand;
use SprykerCommunity\Toolkit\Release\Commands\PrepareDemoCommand;
use SprykerCommunity\Toolkit\Shared\Commands\ContainerDumpCommand;
use SprykerCommunity\Toolkit\Translator\Commands\YvesTranslationCommand;
use SprykerCommunity\Toolkit\Translator\Commands\ZedTranslationCommand;
use Symfony\Component\Console\Application;
use Symfony\Component\Dotenv\Dotenv;

(new Dotenv())->bootEnv(dirname(__DIR__, 1) . '/.env');

$container = include __DIR__ . '/../src/container.php';
$container->compile(true);

$commands = array(
new YvesTranslationCommand(),
new ZedTranslationCommand(),
new ContainerDumpCommand(),
);

$app = new Application('Spryker Toolkit');
foreach ($commands as $command) {
if (method_exists($command, 'setContainer')) {
$command->setContainer($container);
}
$app->add($command);
}

$app->run();
53 changes: 53 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"name": "spryker-community/spryker-toolkit",
"description": "The Spryker Toolkit",
"type": "library",
"license": "MIT",
"prefer-stable": true,
"autoload": {
"psr-4": {
"SprykerCommunity\\Toolkit\\": "src"
},
"classmap": ["src"]
},
"require": {
"php": ">=8.1",
"ext-curl": "*",
"ext-intl": "*",
"ext-json": "*",
"czproject/git-php": "^4.2",
"deeplcom/deepl-php": "^1.5",
"guzzlehttp/psr7": "^2.6",
"knplabs/github-api": "^3.0",
"league/csv": "^9.8",
"monolog/monolog": "^3.5",
"openai-php/client": "^0.7.7",
"php-http/guzzle7-adapter": "^1.0",
"symfony/config": "^6.4",
"symfony/console": "^6.3",
"symfony/dependency-injection": "^6.4",
"symfony/dotenv": "^6.3",
"symfony/intl": "^6.3",
"symfony/yaml": "^6.4"
},
"require-dev": {
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-symfony": "^1.3",
"spryker/code-sniffer": "^0.17.19"
},
"config": {
"sort-packages": true,
"platform": {
"php": "8.1"
},
"allow-plugins": {
"php-http/discovery": true,
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"scripts": {
"cs-check": "phpcs",
"cs-fix": "phpcbf",
"stan": "phpstan --memory-limit=-1 analyze src/"
}
}
Loading

0 comments on commit d6cd06f

Please sign in to comment.