Skip to content

Commit 1a4732a

Browse files
Merge pull request #978 from nextcloud/maintenance/vs-code
Add editor configuration to codebase
2 parents a875d1c + 091f3ec commit 1a4732a

File tree

5 files changed

+149
-47
lines changed

5 files changed

+149
-47
lines changed

.vscode/launch.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Xdebug on 9000 for PHPUnit",
9+
"type": "php",
10+
"request": "launch",
11+
"port": 9000,
12+
"pathMappings": {
13+
"/nextcloud/custom_apps/cookbook": "${workspaceFolder:cookbook}"
14+
}
15+
},
16+
{
17+
"name": "Xdebug on 9000 for Live-Test",
18+
"type": "php",
19+
"request": "launch",
20+
"port": 9000,
21+
"pathMappings": {
22+
"/var/www/html/custom_apps/cookbook": "${workspaceFolder:cookbook}",
23+
"/var/www/html": "${workspaceFolder:base}"
24+
}
25+
},
26+
{
27+
"name": "Xdebug on 9003 for PHPUnit",
28+
"type": "php",
29+
"request": "launch",
30+
"port": 9003,
31+
"pathMappings": {
32+
"/nextcloud/custom_apps/cookbook": "${workspaceFolder:cookbook}"
33+
}
34+
},
35+
{
36+
"name": "Xdebug on 9003 for Live-Test",
37+
"type": "php",
38+
"request": "launch",
39+
"port": 9003,
40+
"pathMappings": {
41+
"/var/www/html/custom_apps/cookbook": "${workspaceFolder:cookbook}",
42+
"/var/www/html": "${workspaceFolder:base}"
43+
}
44+
}
45+
]
46+
}

.vscode/settings.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"css.validate": false,
3+
"less.validate": false,
4+
"scss.validate": false,
5+
"intelephense.environment.includePaths": [
6+
"../../base/lib",
7+
],
8+
"intelephense.files.exclude": [
9+
"**/.git/**",
10+
"**/.svn/**",
11+
"**/.hg/**",
12+
"**/CVS/**",
13+
"**/.DS_Store/**",
14+
"**/node_modules/**",
15+
"**/bower_components/**",
16+
"**/vendor/**/{Tests,tests}/**",
17+
"**/.history/**",
18+
"**/vendor/**/vendor/**",
19+
".github/actions/run-tests/volumes/nextcloud/custom_apps/cookbook/**",
20+
".github/actions/run-tests/volumes/nextcloud/3rdparty/**",
21+
".github/actions/run-tests/volumes/**",
22+
".github/actions/run-tests/volumes"
23+
]
24+
}

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## [Unreleased]
22

3+
### Added
4+
- Add IDE configuration to codebase to prevent small issues
5+
[#978](https://github.com/nextcloud/cookbook/pull/978) @christianlupus
6+
37
### Fixed
48
- Refactor the code for image handling to make it testable
59
[#933](https://github.com/nextcloud/cookbook/pull/933) @christianlupus

Makefile

Lines changed: 26 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,10 @@
1313
# * tar: for building the archive
1414
# * npm: for building and testing everything JS
1515
#
16-
# If no composer.json is in the app root directory, the Composer step
17-
# will be skipped. The same goes for the package.json which can be located in
18-
# the app root or the js/ directory.
19-
#
2016
# The npm command by launches the npm build script:
2117
#
2218
# npm run build
2319
#
24-
# The npm test command launches the npm test script:
25-
#
26-
# npm run test
27-
#
2820
# The idea behind this is to be completely testing and build tool agnostic. All
2921
# build tools and additional package managers should be installed locally in
3022
# your project, since this won't pollute people's global namespace.
@@ -48,23 +40,19 @@ appstore_package_name=$(appstore_build_directory)/$(app_name)
4840
npm=$(shell which npm 2> /dev/null)
4941
composer=$(shell which composer 2> /dev/null)
5042

43+
ifeq (, $(composer))
44+
composer_bin:=php $(build_tools_directory)/composer.phar
45+
else
46+
composer_bin:=composer
47+
endif
48+
5149
all: build appinfo/info.xml
5250

5351
# Fetches the PHP and JS dependencies and compiles the JS. If no composer.json
5452
# is present, the composer step is skipped, if no package.json or js/package.json
5553
# is present, the npm step is skipped
5654
.PHONY: build
57-
build:
58-
ifneq (,$(wildcard $(CURDIR)/composer.json))
59-
$(MAKE) composer
60-
endif
61-
ifneq (,$(wildcard $(CURDIR)/package.json))
62-
$(MAKE) npm
63-
endif
64-
ifneq (,$(wildcard $(CURDIR)/js/package.json))
65-
$(MAKE) npm
66-
endif
67-
55+
build: prepare_phpunit composer npm
6856

6957
.PHONY: install_composer
7058
install_composer:
@@ -75,34 +63,25 @@ ifeq (, $(composer))
7563
mv composer.phar $(build_tools_directory)
7664
endif
7765

66+
.PHONY: prepare_phpunit
67+
prepare_phpunit: install_composer
68+
cd tests/phpunit && $(composer_bin) install --prefer-dist
69+
7870
# Installs and updates the composer dependencies. If composer is not installed
7971
# a copy is fetched from the web
8072
.PHONY: composer
8173
composer: install_composer
82-
ifeq (, $(composer))
83-
php $(build_tools_directory)/composer.phar install --prefer-dist
84-
php $(build_tools_directory)/composer.phar update --prefer-dist
85-
else
86-
composer install --prefer-dist
87-
composer update --prefer-dist
88-
endif
74+
$(composer_bin) install --prefer-dist
75+
$(composer_bin) update --prefer-dist
8976

9077
.PHONY: composer_dist
9178
composer_dist: install_composer
92-
ifeq (, $(composer))
93-
php $(build_tools_directory)/composer.phar install --prefer-dist --no-dev
94-
else
95-
composer install --prefer-dist --no-dev
96-
endif
79+
$(composer_bin) install --prefer-dist --no-dev
9780

9881
# Installs npm dependencies
9982
.PHONY: npm
10083
npm:
101-
ifeq (,$(wildcard $(CURDIR)/package.json))
102-
cd js && $(npm) run build
103-
else
10484
npm run build
105-
endif
10685

10786
# Removes the appstore build
10887
.PHONY: clean
@@ -113,10 +92,7 @@ clean:
11392
# npm
11493
.PHONY: distclean
11594
distclean: clean
116-
rm -rf vendor
117-
rm -rf node_modules
118-
rm -rf js/vendor
119-
rm -rf js/node_modules
95+
rm -rf vendor node_modules tests/phpunit/vendor
12096

12197
# Builds the source and appstore package
12298
.PHONY: dist
@@ -137,6 +113,8 @@ source: appinfo/info.xml
137113
--exclude="../$(app_name)/*.log" \
138114
--exclude="../$(app_name)/js/*.log" \
139115
--exclude="../$(app_name)/.hooks" \
116+
--exclude="../$(app_name)/.github/actions/run-tests/volumes" \
117+
--exclude="../$(app_name)/cookbook.code-workspace" \
140118
../$(app_name)
141119

142120
# Builds the source package for the app store, ignores php and js tests
@@ -147,20 +125,13 @@ appstore: appinfo/info.xml
147125
tar cvzf $(appstore_package_name).tar.gz \
148126
--exclude-vcs \
149127
--exclude="../$(app_name)/build" \
128+
--exclude="../$(app_name)/docs" \
150129
--exclude="../$(app_name)/documentation" \
151130
--exclude="../$(app_name)/tests" \
152131
--exclude="../$(app_name)/Makefile" \
153132
--exclude="../$(app_name)/*.log" \
154133
--exclude="../$(app_name)/phpunit*xml" \
155134
--exclude="../$(app_name)/composer.*" \
156-
--exclude="../$(app_name)/js/node_modules" \
157-
--exclude="../$(app_name)/js/tests" \
158-
--exclude="../$(app_name)/js/test" \
159-
--exclude="../$(app_name)/js/*.log" \
160-
--exclude="../$(app_name)/js/package.json" \
161-
--exclude="../$(app_name)/js/bower.json" \
162-
--exclude="../$(app_name)/js/karma.*" \
163-
--exclude="../$(app_name)/js/protractor.*" \
164135
--exclude="../$(app_name)/node_modules" \
165136
--exclude="../$(app_name)/src" \
166137
--exclude="../$(app_name)/translationfiles" \
@@ -172,13 +143,21 @@ appstore: appinfo/info.xml
172143
--exclude="../$(app_name)/protractor\.*" \
173144
--exclude="../$(app_name)/.*" \
174145
--exclude="../$(app_name)/webpack.*.js" \
146+
--exclude="../$(app_name)/stylelint.config.js" \
175147
--exclude="../$(app_name)/js/.*" \
176148
--exclude="../$(app_name)/.hooks" \
149+
--exclude="../$(app_name)/cookbook.code-workspace" \
177150
../$(app_name)
178151

179152
.PHONY: test
180153
test: composer
181154
@echo "This functionality has been move to the file .github/acrions/run-tests/run-locally.sh. See its output with parameter --help."
182155

156+
.PHONY: code_style
157+
code_style:
158+
$(composer_bin) cs:fix
159+
npm run stylelint-fix
160+
npm run prettier-fix
161+
183162
appinfo/info.xml: .github/actions/deploy/patch .github/actions/deploy/minor .github/actions/deploy/major .github/actions/deploy/appinfo/info.xml.dist
184163
.github/actions/deploy/update-data.sh

cookbook.code-workspace

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"folders": [
3+
{
4+
"path": "."
5+
},
6+
{
7+
"path": "../../base"
8+
},
9+
{
10+
"path": "tests/phpunit/vendor",
11+
"name": "phpunit-composer"
12+
}
13+
],
14+
"settings": {
15+
"editor.insertSpaces": false,
16+
"files.exclude": {
17+
".github/actions/run-tests/volumes/cookbook/**/*": true,
18+
".github/actions/run-tests/volumes/coverage/**/*": true,
19+
".github/actions/run-tests/volumes/data/**/*": true,
20+
".github/actions/run-tests/volumes/dumps/**/*": true,
21+
".github/actions/run-tests/volumes/mysql/**/*": true,
22+
".github/actions/run-tests/volumes/output/**/*": true,
23+
".github/actions/run-tests/volumes/postgres/**/*": true,
24+
".github/actions/run-tests/volumes/nextcloud/custom_apps/cookbook/**/*": true,
25+
".github/actions/run-tests/volumes/**/*": true
26+
},
27+
"files.watcherExclude": {
28+
".github/actions/run-tests/volumes/nextcloud/custom_apps/cookbook/**/*": true,
29+
".github/actions/run-tests/volumes/nextcloud/**/*": true
30+
},
31+
"intelephense.trace.server": "message",
32+
"intelephense.files.exclude": [
33+
"**/.git/**",
34+
"**/.svn/**",
35+
"**/.hg/**",
36+
"**/CVS/**",
37+
"**/.DS_Store/**",
38+
"**/node_modules/**",
39+
"**/bower_components/**",
40+
"**/vendor/**/{Tests,tests}/**",
41+
"**/.history/**",
42+
"**/vendor/**/vendor/**",
43+
"3rdparty/**"
44+
],
45+
"cSpell.words": [
46+
"Nextcloud"
47+
]
48+
}
49+
}

0 commit comments

Comments
 (0)