Skip to content

Commit d9c6ac5

Browse files
authored
Merge pull request #4 from bourtitom/feat/upgrade-2.x
2 parents 316dbe3 + fa41c8d commit d9c6ac5

27 files changed

+109
-82
lines changed

.github/workflows/recipe.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Flex Recipe
22

33
on:
44
push:
5-
branches: [ master ]
5+
branches: [ $default-branch ]
66
pull_request:
77

88
jobs:
@@ -14,8 +14,8 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
php: ['8.1', '8.2', '8.3']
18-
sylius: ["~1.12.0", "~1.13.0", "1.14.0"]
17+
php: ['8.2', '8.3']
18+
sylius: ["~2.0.0", "~2.1.0"]
1919

2020
steps:
2121
- name: Setup PHP

.github/workflows/security.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
php: ['8.1', '8.2', '8.3']
16+
php: ['8.2', '8.3']
1717

1818
steps:
1919
- uses: actions/checkout@v3
@@ -50,4 +50,3 @@ jobs:
5050
run: composer update --prefer-dist
5151

5252
- uses: symfonycorp/security-checker-action@v4
53-

.github/workflows/tests.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Tests
22

33
on:
44
push:
5-
branches: [ master ]
5+
branches: [ $default-branch ]
66
pull_request:
77

88
jobs:
@@ -14,7 +14,8 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
php: ['8.1', '8.2', '8.3']
17+
php: ['8.2', '8.3']
18+
node: ['20']
1819

1920
env:
2021
SYMFONY_ARGS: --no-tls
@@ -25,7 +26,7 @@ jobs:
2526
- uses: actions/checkout@v2
2627
- uses: actions/setup-node@v2
2728
with:
28-
node-version: '14'
29+
node-version: ${{ matrix.node }}
2930
- name: Setup PHP
3031
uses: shivammathur/setup-php@v2
3132
with:
@@ -75,5 +76,5 @@ jobs:
7576
- run: make test.twig
7677

7778
- run: make test.schema
78-
79+
7980
- run: make test.container

Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.DEFAULT_GOAL := help
22
SHELL=/bin/bash
33
APP_DIR=tests/Application
4-
SYLIUS_VERSION=1.14.0
4+
SYLIUS_VERSION=2.1.0
55
SYMFONY=cd ${APP_DIR} && symfony
66
COMPOSER=symfony composer
77
CONSOLE=${SYMFONY} console
@@ -74,6 +74,9 @@ setup_application:
7474
(cd ${APP_DIR} && ${COMPOSER} config --no-plugins allow-plugins true)
7575
(cd ${APP_DIR} && ${COMPOSER} config --no-plugins --json extra.symfony.endpoint '["https://api.github.com/repos/monsieurbiz/symfony-recipes/contents/index.json?ref=flex/master","flex://defaults"]')
7676
(cd ${APP_DIR} && ${COMPOSER} require --no-install --no-scripts --no-progress sylius/sylius="~${SYLIUS_VERSION}") # Make sure to install the required version of sylius because the sylius-standard has a soft constraint
77+
# Temporary fix for Sylius 2.1
78+
(cd ${APP_DIR} && ${COMPOSER} require --no-install --no-scripts --no-progress api-platform/state)
79+
# End Temporary fix for Sylius 2.1
7780
$(MAKE) ${APP_DIR}/.php-version
7881
$(MAKE) ${APP_DIR}/php.ini
7982
(cd ${APP_DIR} && ${COMPOSER} install --no-interaction)
@@ -138,13 +141,13 @@ test.container: ## Lint the symfony container
138141
${CONSOLE} lint:container
139142

140143
test.yaml: ## Lint the symfony Yaml files
141-
${CONSOLE} lint:yaml ../../src/Resources/config --parse-tags
144+
${CONSOLE} lint:yaml ../../config --parse-tags
142145

143146
test.schema: ## Validate MySQL Schema
144147
${CONSOLE} doctrine:schema:validate
145148

146149
test.twig: ## Validate Twig templates
147-
${CONSOLE} lint:twig --no-debug templates/ ../../src/Resources/views/
150+
${CONSOLE} lint:twig --no-debug templates/ ../../templates/
148151

149152
###
150153
### SYLIUS

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ For example, add Google Analytics, Facebook Pixel, or any other tracking script.
2424

2525
| Sylius Version | PHP Version |
2626
|----------------|-----------------|
27-
| 1.12 | 8.1 - 8.2 - 8.3 |
28-
| 1.13 | 8.1 - 8.2 - 8.3 |
29-
| 1.14 | 8.1 - 8.2 - 8.3 |
27+
| 2.0, 2.1 | 8.2 - 8.3 |
28+
29+
ℹ️ For Sylius 1.x, see our [1.x branch](https://github.com/monsieurbiz/SyliusScriptsPlugin/tree/1.x) and all 1.x releases.
3030

3131
## Installation
3232

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
"description": "Allows you to add JS scripts from the admin panel.",
66
"license": "MIT",
77
"require": {
8-
"monsieurbiz/sylius-settings-plugin": "^1.0.0",
9-
"php": "^8.1",
10-
"sylius/sylius": ">=1.12 <2.0"
8+
"monsieurbiz/sylius-settings-plugin": "^2.0",
9+
"php": "^8.2",
10+
"sylius/sylius": "~2.0"
1111
},
1212
"require-dev": {
1313
"friendsofphp/php-cs-fixer": "^3.16",
@@ -37,7 +37,7 @@
3737
},
3838
"extra": {
3939
"branch-alias": {
40-
"dev-master": "1.1-dev"
40+
"dev-master": "2.0-dev"
4141
},
4242
"symfony": {
4343
"docker": false,

config/config.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
imports:
2+
- { resource: 'settings.yaml' }
3+
- { resource: 'twig_hooks.yaml' }

src/Resources/config/services.yaml renamed to config/services.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ services:
55
public: false
66

77
MonsieurBiz\SyliusScriptsPlugin\:
8-
resource: '../../*'
9-
exclude: '../../{Entity,Migrations}'
8+
resource: '../src/*'
9+
exclude: '../src/{Entity,Migrations}'
1010

1111
MonsieurBiz\SyliusScriptsPlugin\Controller\:
12-
resource: '../../Controller'
12+
resource: '../src/Controller'
1313
tags: [ 'controller.service_arguments' ]

src/Resources/config/monsieurbiz/settings.yaml renamed to config/settings.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ monsieurbiz_sylius_settings:
44
vendor_name: Monsieur Biz
55
plugin_name: monsieurbiz_scripts.settings.scripts.plugin_name
66
description: monsieurbiz_scripts.settings.scripts.description
7-
icon: js square
7+
icon: ix:scripts
88
use_locales: true
99
classes:
1010
form: MonsieurBiz\SyliusScriptsPlugin\Form\Type\Settings\ScriptsType

config/twig_hooks.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
sylius_twig_hooks:
2+
hooks:
3+
sylius_shop.base.head:
4+
monsieurbiz_scripts_before_head_end:
5+
template: '@MonsieurBizSyliusScriptsPlugin/shop/scripts/before_head_end.html.twig'
6+
priority: -100
7+
8+
sylius_shop.base.header:
9+
monsieurbiz_scripts_after_body_start:
10+
template: '@MonsieurBizSyliusScriptsPlugin/shop/scripts/after_body_start.html.twig'
11+
priority: -100
12+
13+
# Manage after_body_start on checkout
14+
sylius_shop.checkout.common.header:
15+
monsieurbiz_scripts_after_body_start:
16+
template: '@MonsieurBizSyliusScriptsPlugin/shop/scripts/after_body_start.html.twig'
17+
priority: -100
18+
19+
sylius_shop.base#javascripts:
20+
monsieurbiz_scripts_before_body_end:
21+
template: '@MonsieurBizSyliusScriptsPlugin/shop/scripts/before_body_end.html.twig'
22+
priority: -100
23+
24+
sylius_shop.order.thank_you:
25+
monsieurbiz_scripts_checkout_success:
26+
template: '@MonsieurBizSyliusScriptsPlugin/shop/scripts/checkout_success.html.twig'
27+
priority: -100
28+
29+
sylius_admin.base#javascripts:
30+
monsieurbiz_scripts_admin_javascripts:
31+
template: '@MonsieurBizSyliusScriptsPlugin/admin/scripts/javascripts.html.twig'
32+
priority: -100

0 commit comments

Comments
 (0)