Skip to content

Commit

Permalink
Repo init
Browse files Browse the repository at this point in the history
  • Loading branch information
lchrusciel committed Jun 6, 2024
0 parents commit e9e0114
Show file tree
Hide file tree
Showing 110 changed files with 2,029 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .docker/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
user www-data;
worker_processes auto;
daemon off;
pid /run/nginx.pid;

include /etc/nginx/modules-enabled/*.conf;

events {
worker_connections 1024;
}

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

server_tokens off;

client_max_body_size 64m;
sendfile on;
tcp_nodelay on;
tcp_nopush on;

gzip_vary on;

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

server {
listen 80;

root /app/tests/Application/public;
index index.php;

location / {
try_files $uri /index.php$is_args$args;
}

location ~ \.php$ {
include fastcgi_params;

fastcgi_pass unix:/var/run/php8-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;

fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
}
}
}
5 changes: 5 additions & 0 deletions .docker/php/php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[PHP]
memory_limit=512M

[date]
date.timezone=${PHP_DATE_TIMEZONE}
82 changes: 82 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true

[*]
# Change these settings to your own preference
indent_style = space
indent_size = 4

# We recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.feature]
indent_style = space
indent_size = 4

[*.js]
indent_style = space
indent_size = 2

[*.json]
indent_style = space
indent_size = 2

[*.md]
indent_style = space
indent_size = 4
trim_trailing_whitespace = false

[*.neon]
indent_style = space
indent_size = 4

[*.php]
indent_style = space
indent_size = 4

[*.sh]
indent_style = space
indent_size = 4

[*.{yaml,yml}]
indent_style = space
indent_size = 4
trim_trailing_whitespace = false

[.babelrc]
indent_style = space
indent_size = 2

[.gitmodules]
indent_style = tab
indent_size = 4

[.php_cs{,.dist}]
indent_style = space
indent_size = 4

[composer.json]
indent_style = space
indent_size = 4

[package.json]
indent_style = space
indent_size = 2

[phpspec.yml{,.dist}]
indent_style = space
indent_size = 4

[phpstan.neon]
indent_style = space
indent_size = 4

[phpunit.xml{,.dist}]
indent_style = space
indent_size = 4
22 changes: 22 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/.configurator export-ignore
/.docker export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.github export-ignore
/.gitignore export-ignore
/behat.yml.dist export-ignore
/bin export-ignore
/docker-compose.yml export-ignore
/docs export-ignore
/ecs.php export-ignore
/etc export-ignore
/features export-ignore
/Makefile export-ignore
/node_modules export-ignore
/phpspec.yml.dist export-ignore
/phpstan.neon export-ignore
/phpunit.xml.dist export-ignore
/psalm.xml export-ignore
/spec export-ignore
/symfony.lock export-ignore
/tests export-ignore
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/vendor/
/node_modules/
/composer.lock

/etc/build/*
!/etc/build/.gitkeep

/tests/Application/yarn.lock

/.phpunit.result.cache
/behat.yml
/phpspec.yml
/.configurator/phpunit.xml
.phpunit.result.cache

# Symfony CLI https://symfony.com/doc/current/setup/symfony_server.html#different-php-settings-per-project
/.php-version
/php.ini
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Changelog

All notable changes to `SyliusAwesomePlugin` will be documented in this file.
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Contributing

Here should be a description of how to contribute.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) :vendor_name

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.
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
serve:
@symfony serve --dir=tests/Application --daemon
server.start: serve
server.stop:
@symfony server:stop --dir=tests/Application
frontend.install:
@cd tests/Application && npm install
frontend.build:
@cd tests/Application && npm run build
frontend.setup: frontend.install frontend.build
setup:
@composer update
@make frontend.setup
@cd tests/Application && bin/console assets:install
@cd tests/Application && bin/console doctrine:database:create --if-not-exists
@cd tests/Application && bin/console doctrine:migrations:migrate -n
@cd tests/Application && bin/console sylius:fixtures:load -n
@cd tests/Application && APP_ENV=test bin/console doctrine:database:create --if-not-exists
@cd tests/Application && APP_ENV=test bin/console doctrine:migrations:migrate -n
@cd tests/Application && APP_ENV=test bin/console sylius:fixtures:load -n
61 changes: 61 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# SyliusAwesomePlugin

[![Latest Version on Packagist](https://img.shields.io/packagist/v/acme/sylius-awesome-plugin.svg?style=flat-square)](https://packagist.org/packages/acme/sylius-awesome-plugin)
[![Total Downloads](https://img.shields.io/packagist/dt/acme/sylius-awesome-plugin.svg?style=flat-square)](https://packagist.org/packages/acme/sylius-awesome-plugin)

This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.

## Installation

1. Run `composer require acme/sylius-awesome-plugin`.

2. Import routes
```yaml
# config/routes/sylius_shop.yaml

acme_sylius_awesome_shop:
resource: "@AcmeSyliusAwesomePlugin/config/shop_routing.yaml"
prefix: /{_locale}
requirements:
_locale: ^[A-Za-z]{2,4}(_([A-Za-z]{4}|[0-9]{3}))?(_([A-Za-z]{2}|[0-9]{3}))?$

# config/routes/sylius_admin.yaml

acme_sylius_awesome_admin:
resource: "@AcmeSyliusAwesomePlugin/config/admin_routing.yml"
prefix: /admin
```
3. Import configuration
```yaml
# config/packages/_sylius.yaml

imports:
# ...
- { resource: "@AcmeSyliusAwesomePlugin/config/config.yaml" }
```
4. Apply migrations
```bash
bin/console doctrine:migrations:migrate
```

## Changelog

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

## Contributing

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

## Security Vulnerabilities

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

## Credits

- [All Contributors](../../contributors)

## License

Please see the [License File](LICENSE.md) for more information about licensing.
3 changes: 3 additions & 0 deletions assets/admin/entry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import "./main.scss";

// your code goes here
1 change: 1 addition & 0 deletions assets/admin/main.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// your code goes here
3 changes: 3 additions & 0 deletions assets/shop/entry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import "./main.scss";

// your code goes here
1 change: 1 addition & 0 deletions assets/shop/main.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// your code goes here
45 changes: 45 additions & 0 deletions bin/create_node_symlink.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

const NODE_MODULES_FOLDER_NAME = 'node_modules';
const PATH_TO_NODE_MODULES = 'tests' . DIRECTORY_SEPARATOR . 'Application' . DIRECTORY_SEPARATOR . 'node_modules';

/* cannot use `file_exists` or `stat` as gives false on symlinks if target path does not exist yet */
if (@lstat(NODE_MODULES_FOLDER_NAME))
{
if (is_link(NODE_MODULES_FOLDER_NAME) || is_dir(NODE_MODULES_FOLDER_NAME)) {
echo '> `' . NODE_MODULES_FOLDER_NAME . '` already exists as a link or folder, keeping existing as may be intentional.' . PHP_EOL;
exit(0);
} else {
echo '> Invalid symlink `' . NODE_MODULES_FOLDER_NAME . '` detected, recreating...' . PHP_EOL;
if (!@unlink(NODE_MODULES_FOLDER_NAME)) {
echo '> Could not delete file `' . NODE_MODULES_FOLDER_NAME . '`.' . PHP_EOL;
exit(1);
}
}
}

/* try to create the symlink using PHP internals... */
$success = @symlink(PATH_TO_NODE_MODULES, NODE_MODULES_FOLDER_NAME);

/* if case it has failed, but OS is Windows... */
if (!$success && strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
/* ...then try a different approach which does not require elevated permissions and folder to exist */
echo '> This system is running Windows, creation of links requires elevated privileges,' . PHP_EOL;
echo '> and target path to exist. Fallback to NTFS Junction:' . PHP_EOL;
exec(sprintf('mklink /J %s %s 2> NUL', NODE_MODULES_FOLDER_NAME, PATH_TO_NODE_MODULES), $output, $returnCode);
$success = $returnCode === 0;
if (!$success) {
echo '> Failed o create the required symlink' . PHP_EOL;
exit(2);
}
}

$path = @readlink(NODE_MODULES_FOLDER_NAME);
/* check if link points to the intended directory */
if ($path && realpath($path) === realpath(PATH_TO_NODE_MODULES)) {
echo '> Successfully created the symlink.' . PHP_EOL;
exit(0);
}

echo '> Failed to create the symlink to `' . NODE_MODULES_FOLDER_NAME . '`.' . PHP_EOL;
exit(3);
Loading

0 comments on commit e9e0114

Please sign in to comment.