-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from wedevelopnl/feature/added-docker-csfixer-etc
Added Dockerfile and docker-compose.yml
- Loading branch information
Showing
16 changed files
with
328 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
/node_modules/ | ||
/**/*.js.map | ||
/**/*.css.map | ||
/vendor/ | ||
/composer.lock | ||
/resources/ | ||
/.idea/ | ||
.php-cs-fixer.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"php":"8.1.12","version":"3.4.0:v3.4.0#47177af1cfb9dab5d1cc4daf91b7179c2efe7fad","indent":" ","lineEnding":"\n","rules":{"octal_notation":true,"clean_namespace":true,"no_unset_cast":true,"assign_null_coalescing_to_coalesce_equal":true,"normalize_index_brace":true,"short_scalar_cast":true,"heredoc_indentation":true,"method_argument_space":{"on_multiline":"ensure_fully_multiline"},"no_whitespace_before_comma_in_array":{"after_heredoc":true},"trailing_comma_in_multiline":{"after_heredoc":true},"list_syntax":true,"visibility_required":true,"ternary_to_null_coalescing":true,"array_syntax":{"syntax":"short"},"blank_line_after_opening_tag":true,"braces":{"allow_single_line_anonymous_class_with_empty_body":true},"class_definition":{"space_before_parenthesis":true},"compact_nullable_typehint":true,"declare_equal_normalize":true,"lowercase_cast":true,"lowercase_static_reference":true,"new_with_braces":true,"no_blank_lines_after_class_opening":true,"no_leading_import_slash":true,"no_whitespace_in_blank_line":true,"ordered_class_elements":{"order":["use_trait"]},"ordered_imports":{"imports_order":["class","function","const"],"sort_algorithm":"none"},"return_type_declaration":true,"single_blank_line_before_namespace":true,"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"blank_line_after_namespace":true,"constant_case":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"no_break_comment":true,"no_closing_tag":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true,"array_push":true,"no_unused_imports":true,"strict_comparison":true,"strict_param":true,"cast_spaces":{"space":"none"}},"hashes":{"src\/Model\/Menu.php":3572943324,"src\/Model\/MenuItem.php":2391585450}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
$finder = PhpCsFixer\Finder::create() | ||
->in(__DIR__ . '/src') | ||
; | ||
|
||
$config = new PhpCsFixer\Config(); | ||
$config | ||
->setRules([ | ||
'@PHP81Migration' => true, | ||
'@PSR12' => true, | ||
'array_push' => true, | ||
'no_unused_imports' => true, | ||
// TODO: Add PHPStan and enable declare_strict_Types | ||
'declare_strict_types' => false, | ||
'strict_comparison' => true, | ||
'strict_param' => true, | ||
'cast_spaces' => ['space' => 'none'], | ||
'array_syntax' => ['syntax' => 'short'], | ||
]) | ||
->setRiskyAllowed(true) | ||
->setFinder($finder) | ||
; | ||
|
||
return $config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
ARG ALPINE_VERSION=3.16 | ||
|
||
ARG NODE_VERSION=18.12.1 | ||
|
||
FROM node:$NODE_VERSION-alpine$ALPINE_VERSION AS node | ||
FROM php:8.1-cli-alpine$ALPINE_VERSION AS php-cli | ||
|
||
RUN apk add php make perl --no-cache | ||
|
||
WORKDIR /app | ||
|
||
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer | ||
COPY composer.json ./ | ||
ENV COMPOSER_ALLOW_SUPERUSER 1 | ||
RUN composer install --prefer-dist --no-progress --no-suggest --no-interaction --no-plugins --ignore-platform-reqs | ||
|
||
COPY dev/docker/docker-entrypoint.sh /usr/local/bin/docker-entrypoint | ||
RUN chmod +x /usr/local/bin/docker-entrypoint | ||
|
||
ENTRYPOINT ["docker-entrypoint"] | ||
|
||
CMD ["php"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,21 @@ | ||
Copyright (c) 2017, The Webmen | ||
All rights reserved. | ||
MIT License | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
Copyright (c) 2022 WeDevelop | ||
|
||
* Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
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: | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
* Neither the name of the {organization} nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
.PHONY: * | ||
|
||
.DEFAULT_GOAL := help | ||
docker := $(shell if [ `pwd` != "/app" ]; then echo 'docker compose exec php'; fi;) | ||
|
||
HELP_FUNCTION = \ | ||
%help; \ | ||
while(<>) { push @{$$help{$$2 // 'options'}}, [$$1, $$3] if /^(.+)\s*:.*\#\#(?:@(\w+))?\s(.*)$$/ }; \ | ||
print "usage: make [target]\n\n"; \ | ||
for (keys %help) { \ | ||
print "\033[33m $$_:\n"; \ | ||
printf " \033[32m%-30s\033[0m %s\n", $$_->[0], $$_->[1] for @{$$help{$$_}} \ | ||
} | ||
|
||
help: ##@develop Show this help. | ||
@perl -e '$(HELP_FUNCTION)' $(MAKEFILE_LIST) | ||
|
||
build: ##@develop Build docker container and detach | ||
docker compose up --build -d | ||
|
||
up: ##@develop Docker compose up | ||
docker compose up -d | ||
|
||
down: ##@develop Docker compose down | ||
docker compose down | ||
|
||
test: ##@develop Run code style test | ||
${docker} ./vendor/bin/php-cs-fixer fix --diff --dry-run | ||
|
||
fix-cs: ##@develop Fix code styling | ||
${docker} ./vendor/bin/php-cs-fixer fix | ||
|
||
sh: ##@develop Open shell in container | ||
${docker} sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,41 @@ | ||
# SilverStripe Menustructure module | ||
|
||
# silverstripe-menustructure | ||
This module makes it possible to use multiple menus on 1 SilverStripe site, instead of using the "default" menu. | ||
The menus in this module are also more customizable then the "default" silverstripe menu. | ||
|
||
# Requirements | ||
* SilverStripe 4.x | ||
|
||
# Installation | ||
`composer require thewebmen/silverstripe-menustructure` | ||
## Requirements | ||
* See `composer.json` requirements | ||
|
||
# Documentation | ||
* [Configuration](docs/configuration.md) | ||
## Installation | ||
``` | ||
composer require wedevelopnl/silverstripe-menustructure | ||
``` | ||
|
||
# License | ||
## License | ||
See [License](LICENSE) | ||
|
||
## Maintainers | ||
* [Webmen](https://www.webmen.nl/) <developement@webmen.nl> | ||
|
||
## Contributing | ||
See [Contributing](CONTRIBUTING.md) | ||
* [WeDevelop](https://www.wedevelop.nl/) <development@wedevelop.nl> | ||
|
||
## Development and contribution | ||
If you would like to make contributions to the module please ensure you raise a pull request and discuss with the module maintainers. | ||
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. | ||
See read our [contributing](CONTRIBUTING.md) document for more information. | ||
|
||
### Getting started | ||
We advise to use [Docker](https://docker.com)/[Docker compose](https://docs.docker.com/compose/) for development.\ | ||
We also included a [Makefile](https://www.gnu.org/software/make/) to simplify some commands | ||
|
||
Our development container contains some built-in tools like `PHPCSFixer` and `yarn`. | ||
|
||
#### Getting development container up | ||
`make build` to build the Docker container and then run detached.\ | ||
If you want to only get the container up, you can simply type `make up`. | ||
|
||
You can SSH into the container using `make sh`. | ||
|
||
#### Front-end | ||
Webpack and yarn are used to compile front-end assets. | ||
|
||
If you use the Docker environment, you can just run `make yarn-watch` to watch for changes or run `make yarn-build` to build assets (minified and production ready!) | ||
|
||
#### All make commands | ||
You can run `make help` to get a list with all available `make` commands. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,44 @@ | ||
{ | ||
"name": "thewebmen/silverstripe-menustructure", | ||
"name": "wedevelopnl/silverstripe-menustructure", | ||
"description": "Silverstripe module to create nested menus", | ||
"type": "silverstripe-vendormodule", | ||
"keywords": [ | ||
"silverstripe", | ||
"menu", | ||
"nested", | ||
"links" | ||
], | ||
"license": "BSD-3-Clause", | ||
"authors": [{ | ||
"name": "Michel van der Steege", | ||
"email": "michel@thewebmen.com" | ||
"name": "WeDevelop", | ||
"email": "development@wedevelop.nl" | ||
}], | ||
"minimum-stability": "dev", | ||
"prefer-stable": true, | ||
"require": { | ||
"php": "^8.1", | ||
"silverstripe/cms": "^4.0@dev", | ||
"php": ">=8.1", | ||
"silverstripe/cms": "^4@stable", | ||
"silverstripe/vendor-plugin": "^1.0", | ||
"silverstripe/display-logic": "^2.0", | ||
"symbiote/silverstripe-gridfieldextensions": "^3.1" | ||
"symbiote/silverstripe-gridfieldextensions": "^3.5" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^5.7", | ||
"squizlabs/php_codesniffer": "^3.0" | ||
"friendsofphp/php-cs-fixer": "^3.4" | ||
}, | ||
"extra": { | ||
"installer-name": "silverstripe-menustructure", | ||
"branch-alias": { | ||
"dev-master": "2.x-dev" | ||
"dev-main": "3.x-dev" | ||
} | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"TheWebmen\\Menustructure\\": "src/" | ||
"WeDevelop\\Menustructure\\": "src/" | ||
} | ||
}, | ||
"config": { | ||
"allow-plugins": { | ||
"composer/installers": false, | ||
"silverstripe/vendor-plugin": false, | ||
"silverstripe/recipe-plugin": false | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
# first arg is `-f` or `--some-option` | ||
if [ "${1#-}" != "$1" ]; then | ||
set -- php "$@" | ||
fi | ||
|
||
if [ "$1" = 'php' ]; then | ||
composer install --prefer-dist --no-progress --no-suggest --no-interaction --no-plugins --ignore-platform-reqs | ||
echo "Container is ready!" | ||
fi | ||
|
||
exec docker-php-entrypoint "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: '3.6' | ||
services: | ||
php: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
target: php-cli | ||
working_dir: /app | ||
volumes: | ||
- .:/app/ | ||
tty: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,19 @@ | ||
<?php | ||
|
||
namespace TheWebmen\Menustructure\Admin; | ||
namespace WeDevelop\Menustructure\Admin; | ||
|
||
use SilverStripe\Admin\ModelAdmin; | ||
use TheWebmen\Menustructure\Model\Menu; | ||
use WeDevelop\Menustructure\Model\Menu; | ||
|
||
class MenusAdmin extends ModelAdmin | ||
{ | ||
private static $managed_models = [ | ||
Menu::class | ||
]; | ||
|
||
private static $url_segment = 'menus'; | ||
|
||
private static $menu_title = 'Menus'; | ||
private static string $menu_title = 'Menus'; | ||
|
||
private static $menu_icon_class = 'font-icon-menu'; | ||
private static string $url_segment = 'menus'; | ||
|
||
public function getEditForm($id = null, $fields = null) | ||
{ | ||
$form = parent::getEditForm($id, $fields); | ||
private static string $menu_icon_class = 'font-icon-menu'; | ||
|
||
$gridField = $form->Fields()->fieldByName($this->sanitiseClassName($this->modelClass)); | ||
if (class_exists('SilverStripe\Subsites\Model\Subsite')) { | ||
$list = $gridField->getList()->filter(array('SubsiteID' => \SilverStripe\Subsites\State\SubsiteState::singleton()->getSubsiteId())); | ||
$gridField->setList($list); | ||
} | ||
|
||
return $form; | ||
} | ||
|
||
public function subsiteCMSShowInMenu() | ||
{ | ||
return true; | ||
} | ||
private static array $managed_models = [ | ||
Menu::class, | ||
]; | ||
} |
Oops, something went wrong.