From 4ee99c855ee64be851e4648d6c203ee0304aab7e Mon Sep 17 00:00:00 2001 From: Christian Wolf Date: Sat, 7 May 2022 12:48:28 +0200 Subject: [PATCH 1/3] Add VS Code configuration to workspace Signed-off-by: Christian Wolf --- .vscode/launch.json | 46 ++++++++++++++++++++++++++++++++++++++ .vscode/settings.json | 24 ++++++++++++++++++++ cookbook.code-workspace | 49 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 119 insertions(+) create mode 100644 .vscode/launch.json create mode 100644 .vscode/settings.json create mode 100644 cookbook.code-workspace diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 000000000..5999054b2 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,46 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Xdebug on 9000 for PHPUnit", + "type": "php", + "request": "launch", + "port": 9000, + "pathMappings": { + "/nextcloud/custom_apps/cookbook": "${workspaceFolder:cookbook}" + } + }, + { + "name": "Xdebug on 9000 for Live-Test", + "type": "php", + "request": "launch", + "port": 9000, + "pathMappings": { + "/var/www/html/custom_apps/cookbook": "${workspaceFolder:cookbook}", + "/var/www/html": "${workspaceFolder:base}" + } + }, + { + "name": "Xdebug on 9003 for PHPUnit", + "type": "php", + "request": "launch", + "port": 9003, + "pathMappings": { + "/nextcloud/custom_apps/cookbook": "${workspaceFolder:cookbook}" + } + }, + { + "name": "Xdebug on 9003 for Live-Test", + "type": "php", + "request": "launch", + "port": 9003, + "pathMappings": { + "/var/www/html/custom_apps/cookbook": "${workspaceFolder:cookbook}", + "/var/www/html": "${workspaceFolder:base}" + } + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..36162004d --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,24 @@ +{ + "css.validate": false, + "less.validate": false, + "scss.validate": false, + "intelephense.environment.includePaths": [ + "../../base/lib", + ], + "intelephense.files.exclude": [ + "**/.git/**", + "**/.svn/**", + "**/.hg/**", + "**/CVS/**", + "**/.DS_Store/**", + "**/node_modules/**", + "**/bower_components/**", + "**/vendor/**/{Tests,tests}/**", + "**/.history/**", + "**/vendor/**/vendor/**", + ".github/actions/run-tests/volumes/nextcloud/custom_apps/cookbook/**", + ".github/actions/run-tests/volumes/nextcloud/3rdparty/**", + ".github/actions/run-tests/volumes/**", + ".github/actions/run-tests/volumes" + ] +} diff --git a/cookbook.code-workspace b/cookbook.code-workspace new file mode 100644 index 000000000..150020e5c --- /dev/null +++ b/cookbook.code-workspace @@ -0,0 +1,49 @@ +{ + "folders": [ + { + "path": "." + }, + { + "path": "../../base" + }, + { + "path": "tests/phpunit/vendor", + "name": "phpunit-composer" + } + ], + "settings": { + "editor.insertSpaces": false, + "files.exclude": { + ".github/actions/run-tests/volumes/cookbook/**/*": true, + ".github/actions/run-tests/volumes/coverage/**/*": true, + ".github/actions/run-tests/volumes/data/**/*": true, + ".github/actions/run-tests/volumes/dumps/**/*": true, + ".github/actions/run-tests/volumes/mysql/**/*": true, + ".github/actions/run-tests/volumes/output/**/*": true, + ".github/actions/run-tests/volumes/postgres/**/*": true, + ".github/actions/run-tests/volumes/nextcloud/custom_apps/cookbook/**/*": true, + ".github/actions/run-tests/volumes/**/*": true + }, + "files.watcherExclude": { + ".github/actions/run-tests/volumes/nextcloud/custom_apps/cookbook/**/*": true, + ".github/actions/run-tests/volumes/nextcloud/**/*": true + }, + "intelephense.trace.server": "message", + "intelephense.files.exclude": [ + "**/.git/**", + "**/.svn/**", + "**/.hg/**", + "**/CVS/**", + "**/.DS_Store/**", + "**/node_modules/**", + "**/bower_components/**", + "**/vendor/**/{Tests,tests}/**", + "**/.history/**", + "**/vendor/**/vendor/**", + "3rdparty/**" + ], + "cSpell.words": [ + "Nextcloud" + ] + } +} From 1128774a26e76a21ffa7d2f555aa73b3a7560f62 Mon Sep 17 00:00:00 2001 From: Christian Wolf Date: Sat, 7 May 2022 15:36:25 +0200 Subject: [PATCH 2/3] Cleanup Makefile a bit Signed-off-by: Christian Wolf --- Makefile | 73 ++++++++++++++++++++------------------------------------ 1 file changed, 26 insertions(+), 47 deletions(-) diff --git a/Makefile b/Makefile index 90a66fd12..d7af2e4d6 100755 --- a/Makefile +++ b/Makefile @@ -13,18 +13,10 @@ # * tar: for building the archive # * npm: for building and testing everything JS # -# If no composer.json is in the app root directory, the Composer step -# will be skipped. The same goes for the package.json which can be located in -# the app root or the js/ directory. -# # The npm command by launches the npm build script: # # npm run build # -# The npm test command launches the npm test script: -# -# npm run test -# # The idea behind this is to be completely testing and build tool agnostic. All # build tools and additional package managers should be installed locally in # your project, since this won't pollute people's global namespace. @@ -48,23 +40,19 @@ appstore_package_name=$(appstore_build_directory)/$(app_name) npm=$(shell which npm 2> /dev/null) composer=$(shell which composer 2> /dev/null) +ifeq (, $(composer)) + composer_bin:=php $(build_tools_directory)/composer.phar +else + composer_bin:=composer +endif + all: build appinfo/info.xml # Fetches the PHP and JS dependencies and compiles the JS. If no composer.json # is present, the composer step is skipped, if no package.json or js/package.json # is present, the npm step is skipped .PHONY: build -build: -ifneq (,$(wildcard $(CURDIR)/composer.json)) - $(MAKE) composer -endif -ifneq (,$(wildcard $(CURDIR)/package.json)) - $(MAKE) npm -endif -ifneq (,$(wildcard $(CURDIR)/js/package.json)) - $(MAKE) npm -endif - +build: prepare_phpunit composer npm .PHONY: install_composer install_composer: @@ -75,34 +63,25 @@ ifeq (, $(composer)) mv composer.phar $(build_tools_directory) endif +.PHONY: prepare_phpunit +prepare_phpunit: install_composer + cd tests/phpunit && $(composer_bin) install --prefer-dist + # Installs and updates the composer dependencies. If composer is not installed # a copy is fetched from the web .PHONY: composer composer: install_composer -ifeq (, $(composer)) - php $(build_tools_directory)/composer.phar install --prefer-dist - php $(build_tools_directory)/composer.phar update --prefer-dist -else - composer install --prefer-dist - composer update --prefer-dist -endif + $(composer_bin) install --prefer-dist + $(composer_bin) update --prefer-dist .PHONY: composer_dist composer_dist: install_composer -ifeq (, $(composer)) - php $(build_tools_directory)/composer.phar install --prefer-dist --no-dev -else - composer install --prefer-dist --no-dev -endif + $(composer_bin) install --prefer-dist --no-dev # Installs npm dependencies .PHONY: npm npm: -ifeq (,$(wildcard $(CURDIR)/package.json)) - cd js && $(npm) run build -else npm run build -endif # Removes the appstore build .PHONY: clean @@ -113,10 +92,7 @@ clean: # npm .PHONY: distclean distclean: clean - rm -rf vendor - rm -rf node_modules - rm -rf js/vendor - rm -rf js/node_modules + rm -rf vendor node_modules tests/phpunit/vendor # Builds the source and appstore package .PHONY: dist @@ -137,6 +113,8 @@ source: appinfo/info.xml --exclude="../$(app_name)/*.log" \ --exclude="../$(app_name)/js/*.log" \ --exclude="../$(app_name)/.hooks" \ + --exclude="../$(app_name)/.github/actions/run-tests/volumes" \ + --exclude="../$(app_name)/cookbook.code-workspace" \ ../$(app_name) # Builds the source package for the app store, ignores php and js tests @@ -147,20 +125,13 @@ appstore: appinfo/info.xml tar cvzf $(appstore_package_name).tar.gz \ --exclude-vcs \ --exclude="../$(app_name)/build" \ + --exclude="../$(app_name)/docs" \ --exclude="../$(app_name)/documentation" \ --exclude="../$(app_name)/tests" \ --exclude="../$(app_name)/Makefile" \ --exclude="../$(app_name)/*.log" \ --exclude="../$(app_name)/phpunit*xml" \ --exclude="../$(app_name)/composer.*" \ - --exclude="../$(app_name)/js/node_modules" \ - --exclude="../$(app_name)/js/tests" \ - --exclude="../$(app_name)/js/test" \ - --exclude="../$(app_name)/js/*.log" \ - --exclude="../$(app_name)/js/package.json" \ - --exclude="../$(app_name)/js/bower.json" \ - --exclude="../$(app_name)/js/karma.*" \ - --exclude="../$(app_name)/js/protractor.*" \ --exclude="../$(app_name)/node_modules" \ --exclude="../$(app_name)/src" \ --exclude="../$(app_name)/translationfiles" \ @@ -172,13 +143,21 @@ appstore: appinfo/info.xml --exclude="../$(app_name)/protractor\.*" \ --exclude="../$(app_name)/.*" \ --exclude="../$(app_name)/webpack.*.js" \ + --exclude="../$(app_name)/stylelint.config.js" \ --exclude="../$(app_name)/js/.*" \ --exclude="../$(app_name)/.hooks" \ + --exclude="../$(app_name)/cookbook.code-workspace" \ ../$(app_name) .PHONY: test test: composer @echo "This functionality has been move to the file .github/acrions/run-tests/run-locally.sh. See its output with parameter --help." +.PHONY: code_style +code_style: + $(composer_bin) cs:fix + npm run stylelint-fix + npm run prettier-fix + appinfo/info.xml: .github/actions/deploy/patch .github/actions/deploy/minor .github/actions/deploy/major .github/actions/deploy/appinfo/info.xml.dist .github/actions/deploy/update-data.sh From 091f3ec6bb4383791862472fed4ca78b43f35846 Mon Sep 17 00:00:00 2001 From: Christian Wolf Date: Sat, 7 May 2022 15:40:14 +0200 Subject: [PATCH 3/3] Update changelog Signed-off-by: Christian Wolf --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e6602936..17509551e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## [Unreleased] +### Added +- Add IDE configuration to codebase to prevent small issues + [#978](https://github.com/nextcloud/cookbook/pull/978) @christianlupus + ### Fixed - Refactor the code for image handling to make it testable [#933](https://github.com/nextcloud/cookbook/pull/933) @christianlupus