Skip to content

Commit bc0ae8c

Browse files
authored
Merge pull request #122 from 8lines/migration-to-bs5
Migration to Bootstrap 5
2 parents 3199a8f + c52d301 commit bc0ae8c

File tree

533 files changed

+4609
-4489
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

533 files changed

+4609
-4489
lines changed

.eslintrc.cjs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
browser: true,
5+
es2021: true,
6+
},
7+
extends: [
8+
"eslint:recommended",
9+
],
10+
parserOptions: {
11+
sourceType: "module"
12+
},
13+
globals: {
14+
Translator: 'readonly',
15+
},
16+
};

.github/workflows/code_quality.yaml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@ jobs:
1515
runs-on: ubuntu-latest
1616

1717
steps:
18-
- uses: actions/checkout@v2
18+
- uses: actions/checkout@v4
1919

2020
-
2121
name: 'Setup PHP'
2222
uses: shivammathur/setup-php@v2
2323
with:
24-
php-version: '7.4'
24+
php-version: '8.0'
2525
coverage: none
2626

2727
- name: Composer - Get Cache Directory
2828
id: composer-cache
2929
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
3030

31-
- uses: actions/cache@v1
31+
- uses: actions/cache@v3
3232
id: cache-composer
3333
with:
3434
path: ${{ steps.composer-cache.outputs.dir }}
@@ -48,5 +48,15 @@ jobs:
4848
- name: Composer - Update dependencies
4949
run: composer update --no-progress
5050

51+
- name: Yarn install
52+
uses: borales/actions-yarn@v4
53+
with:
54+
cmd: install
55+
56+
- name: Yarn ESLint
57+
uses: borales/actions-yarn@v4
58+
with:
59+
cmd: lint
60+
5161
- name: TwigCS - Check
52-
run: vendor/bin/twigcs SyliusShopBundle/ --severity error --display blocking
62+
run: vendor/bin/twigcs templates/ --severity error --display blocking --reporter githubAction

.github/workflows/sylius.yaml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: Install & Test
2+
'on':
3+
push:
4+
branches:
5+
- master
6+
paths-ignore:
7+
- README.md
8+
pull_request:
9+
paths-ignore:
10+
- README.md
11+
jobs:
12+
sylius:
13+
name: 'Sylius ${{ matrix.sylius }} Node ${{ matrix.node }}'
14+
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
php:
19+
- 8.2
20+
sylius:
21+
- 1.12.0
22+
symfony:
23+
- 6.3
24+
node:
25+
- 18.x
26+
env:
27+
APP_ENV: test
28+
package-name: sylius/bootstrap-theme
29+
steps:
30+
-
31+
name: 'Setup PHP'
32+
uses: shivammathur/setup-php@v2
33+
with:
34+
php-version: '${{ matrix.php }}'
35+
ini-values: date.timezone=UTC
36+
extensions: intl
37+
tools: symfony
38+
coverage: none
39+
-
40+
name: 'Setup Node'
41+
uses: actions/setup-node@v3
42+
with:
43+
node-version: '${{ matrix.node }}'
44+
-
45+
uses: actions/checkout@v3
46+
-
47+
name: 'Composer - Get Cache Directory'
48+
id: composer-cache
49+
run: 'echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT'
50+
-
51+
name: 'Composer - Set cache'
52+
uses: actions/cache@v3
53+
id: cache-composer
54+
with:
55+
path: '${{ steps.composer-cache.outputs.dir }}'
56+
key: 'php-${{ matrix.php }}-sylius-${{ matrix.sylius }}-symfony-${{ matrix.symfony }}-composer-${{ hashFiles(''**/composer.json'') }}'
57+
restore-keys: 'php-${{ matrix.php }}-sylius-${{ matrix.sylius }}-symfony-${{ matrix.symfony }}-composer-'
58+
-
59+
name: 'Composer - Create cache directory'
60+
run: 'mkdir -p /home/runner/.composer/cache'
61+
if: 'steps.cache-composer.outputs.cache-hit != ''true'''
62+
-
63+
name: 'Composer - Github Auth'
64+
run: 'composer config -g github-oauth.github.com ${{ github.token }}'
65+
-
66+
name: 'Yarn - Get cache directory'
67+
id: yarn-cache
68+
run: 'echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT'
69+
-
70+
name: 'Yarn - Set Cache'
71+
uses: actions/cache@v3
72+
with:
73+
path: '${{ steps.yarn-cache.outputs.dir }}'
74+
key: 'node-${{ matrix.node }}-yarn-${{ hashFiles(''**/package.json **/yarn.lock'') }}'
75+
restore-keys: "node-${{ matrix.node }}-yarn-\n"
76+
-
77+
name: 'Install Sylius-Standard and Plugin'
78+
run: 'make install -e SYLIUS_VERSION=${{ matrix.sylius }} SYMFONY_VERSION=${{ matrix.symfony }} PHP_VERSION=${{ matrix.php }}'
79+
-
80+
name: 'Output PHP version for Symfony CLI'
81+
working-directory: ./tests/Application
82+
run: 'php -v | head -n 1 | awk ''{ print $2 }'' > .php-version'
83+
-
84+
name: 'Install certificates'
85+
working-directory: ./tests/Application
86+
run: 'symfony server:ca:install'
87+
-
88+
name: 'Run webserver'
89+
working-directory: ./tests/Application
90+
run: 'symfony server:start --port=8080 --dir=public --daemon'
91+
-
92+
name: 'Run PHPUnit'
93+
run: 'make phpunit'
94+
services:
95+
mariadb:
96+
image: 'mariadb:10'
97+
ports:
98+
- '3306:3306'
99+
env:
100+
MYSQL_ALLOW_EMPTY_PASSWORD: true
101+
options: '--health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3'

.gitignore

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
/vendor/
2-
/node_modules
31
/composer.lock
42

53
/etc/build/*
64
!/etc/build/.gitignore
75

8-
/tests/Application/yarn.lock
6+
/tests/Application/
7+
/install/Application/*.local
98

109
/.phpunit.result.cache
1110
/behat.yml
12-
/phpspec.yml
13-
/phpunit.xml
1411

1512
###> symfony/webpack-encore-bundle ###
1613
/node_modules/

Dockerfile

Lines changed: 0 additions & 69 deletions
This file was deleted.

Makefile

Lines changed: 86 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,90 @@
11
.DEFAULT_GOAL := help
2+
SHELL=/bin/bash
3+
COMPOSER_ROOT=composer
4+
TEST_DIRECTORY=tests/Application
5+
CONSOLE=cd tests/Application && php bin/console -e test
6+
COMPOSER=cd tests/Application && composer
7+
YARN=cd tests/Application && yarn
28

3-
##
4-
## Project setup
5-
##---------------------------------------------------------------------------
6-
.PHONY: install start stop clean
7-
8-
install: start ## Install requirements for tests
9-
sudo chmod -Rf 777 tests/Application/var
10-
sudo chmod -Rf 777 tests/Application/public/media
11-
docker-compose exec php php -d memory_limit=-1 /usr/bin/composer install
12-
docker-compose exec nodejs yarn --cwd tests/Application install
13-
docker-compose exec php tests/Application/bin/console doctrine:database:create --if-not-exists -vvv
14-
docker-compose exec php tests/Application/bin/console doctrine:schema:create -vvv
15-
docker-compose exec php tests/Application/bin/console assets:install tests/Application/public -vvv
16-
docker-compose exec nodejs yarn --cwd tests/Application build
17-
docker-compose exec php php -d memory_limit=-1 tests/Application/bin/console cache:warmup -vvv
18-
docker-compose exec php tests/Application/bin/console sylius:fixtures:load -n
19-
20-
start: ## Start the project
21-
docker-compose up -d
22-
23-
stop: ## Stop and clean
24-
docker-compose kill
25-
docker-compose rm -v --force
26-
27-
clean: stop ## Clean plugin
28-
docker-compose down -v
29-
sudo rm -Rf node_modules vendor .phpunit.result.cache composer.lock
30-
31-
##
32-
## Assets
33-
##---------------------------------------------------------------------------
34-
.PHONY: assets assets-watch
35-
36-
assets: ## Build assets for dev environment
37-
docker-compose exec nodejs yarn --cwd tests/Application dev
38-
39-
assets-watch: ## Watch asset during development
40-
docker-compose exec nodejs yarn --cwd tests/Application watch
41-
42-
##
43-
## QA
44-
##---------------------------------------------------------------------------
45-
.PHONY: validate behat ci
46-
47-
validate: ## Validate composer.json
48-
docker-compose exec php composer validate --ansi --strict
49-
50-
behat: ## Run behat
51-
docker-compose exec php php -d memory_limit=-1 vendor/bin/behat --profile docker --colors --strict -vvv -f progress --no-interaction --tags="@javascript && ~@todo && ~@cli"
52-
53-
ci: validate behat ## Execute github actions tasks
54-
55-
##
56-
## Utilities
57-
##---------------------------------------------------------------------------
58-
.PHONY: help
9+
SYLIUS_VERSION=1.12.0
10+
SYMFONY_VERSION=6.3
11+
PHP_VERSION=8.2
12+
PLUGIN_NAME=sylius/bootstrap-theme
13+
14+
###
15+
### DEVELOPMENT
16+
### ¯¯¯¯¯¯¯¯¯¯¯
17+
18+
install: sylius ## Install Plugin on Sylius [SYLIUS_VERSION=1.12.0] [SYMFONY_VERSION=6.3] [PHP_VERSION=8.2]
19+
.PHONY: install
20+
21+
reset: ## Remove dependencies
22+
ifneq ("$(wildcard tests/Application/bin/console)","")
23+
${CONSOLE} doctrine:database:drop --force --if-exists || true
24+
endif
25+
rm -rf tests/Application
26+
.PHONY: reset
27+
28+
phpunit: phpunit-configure phpunit-run ## Run PHPUnit
29+
.PHONY: phpunit
30+
31+
###
32+
### OTHER
33+
### ¯¯¯¯¯¯
34+
35+
sylius: sylius-standard update-dependencies install-plugin install-theme install-sylius
36+
.PHONY: sylius
5937

60-
help: ## Show all make tasks (default)
61-
@grep -E '(^[a-zA-Z_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/'
38+
sylius-standard:
39+
${COMPOSER_ROOT} create-project sylius/sylius-standard ${TEST_DIRECTORY} "~${SYLIUS_VERSION}" --no-install --no-scripts
40+
${COMPOSER} config allow-plugins true
41+
${COMPOSER} require sylius/sylius:"~${SYLIUS_VERSION}"
6242

63-
-include Makefile.local
43+
update-dependencies:
44+
${COMPOSER} config extra.symfony.require "~${SYMFONY_VERSION}"
45+
${COMPOSER} update --no-progress -n
46+
47+
install-plugin:
48+
${COMPOSER} config repositories.plugin '{"type": "path", "url": "../../"}'
49+
${COMPOSER} config extra.symfony.allow-contrib true
50+
${COMPOSER} config minimum-stability "dev"
51+
${COMPOSER} config prefer-stable true
52+
${COMPOSER} req ${PLUGIN_NAME}:* --prefer-source --no-scripts
53+
54+
install-theme:
55+
ifneq ("$(wildcard install/Application)","")
56+
cp -r install/Application tests
57+
endif
58+
mkdir ${TEST_DIRECTORY}/themes/BootstrapTheme
59+
cp -r assets ${TEST_DIRECTORY}/themes/BootstrapTheme
60+
cp -r templates ${TEST_DIRECTORY}/themes/BootstrapTheme
61+
cp composer.json ${TEST_DIRECTORY}/themes/BootstrapTheme
62+
cp webpack.config.js ${TEST_DIRECTORY}/themes/BootstrapTheme
63+
echo "const bootstrapTheme = require('./themes/BootstrapTheme/webpack.config');" >> ${TEST_DIRECTORY}/webpack.config.js
64+
echo "module.exports = [shopConfig, adminConfig, appShopConfig, appAdminConfig, bootstrapTheme];" >> ${TEST_DIRECTORY}/webpack.config.js
65+
echo " bootstrapTheme:" >> ${TEST_DIRECTORY}/config/packages/assets.yaml
66+
echo " json_manifest_path: '%kernel.project_dir%/public/themes/bootstrap-theme/manifest.json'" >> ${TEST_DIRECTORY}/config/packages/assets.yaml
67+
echo " bootstrapTheme: '%kernel.project_dir%/public/themes/bootstrap-theme'" >> ${TEST_DIRECTORY}/config/packages/webpack_encore.yaml
68+
69+
install-sylius:
70+
${CONSOLE} doctrine:database:create --if-not-exists
71+
${CONSOLE} doctrine:migrations:migrate -n
72+
${CONSOLE} sylius:fixtures:load default -n
73+
${YARN} install
74+
${YARN} add bootstrap@^5.3 @fortawesome/fontawesome-free@^6.4.2 lightbox axios @popperjs/core@^2.11 glightbox
75+
${YARN} build
76+
${CONSOLE} cache:clear
77+
78+
phpunit-configure:
79+
cp phpunit.xml.dist ${TEST_DIRECTORY}/phpunit.xml
80+
81+
phpunit-run:
82+
cd ${TEST_DIRECTORY} && ./vendor/bin/phpunit --testdox
83+
84+
help: SHELL=/bin/bash
85+
help: ## Dislay this help
86+
@IFS=$$'\n'; for line in `grep -h -E '^[a-zA-Z_#-]+:?.*?##.*$$' $(MAKEFILE_LIST)`; do if [ "$${line:0:2}" = "##" ]; then \
87+
echo $$line | awk 'BEGIN {FS = "## "}; {printf "\033[33m %s\033[0m\n", $$2}'; else \
88+
echo $$line | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m%s\n", $$1, $$2}'; fi; \
89+
done; unset IFS;
90+
.PHONY: help

0 commit comments

Comments
 (0)