rework dotfiles
This commit is contained in:
parent
e8392096ca
commit
0f77ef8f93
14
.dockerignore
Normal file
14
.dockerignore
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/.idea/
|
||||||
|
/*.iml
|
||||||
|
|
||||||
|
/vendor/
|
||||||
|
/vendor-bin/*/vendor/
|
||||||
|
|
||||||
|
/.php-cs-fixer.cache
|
||||||
|
/tests/.phpunit.cache
|
||||||
|
|
||||||
|
/node_modules/
|
||||||
|
/js/
|
||||||
|
/css/
|
||||||
|
|
||||||
|
/build/
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -10,3 +10,5 @@
|
|||||||
/node_modules/
|
/node_modules/
|
||||||
/js/
|
/js/
|
||||||
/css/
|
/css/
|
||||||
|
|
||||||
|
/build/
|
||||||
|
14
.l10nignore
Normal file
14
.l10nignore
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
.idea/
|
||||||
|
*.iml
|
||||||
|
|
||||||
|
vendor/
|
||||||
|
vendor-bin/*/vendor/
|
||||||
|
|
||||||
|
.php-cs-fixer.cache
|
||||||
|
tests/.phpunit.cache
|
||||||
|
|
||||||
|
node_modules/
|
||||||
|
js/
|
||||||
|
css/
|
||||||
|
|
||||||
|
build/
|
@ -2,11 +2,23 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
require_once './vendor-bin/cs-fixer/vendor/autoload.php';
|
require_once './vendor/autoload.php';
|
||||||
|
|
||||||
use Nextcloud\CodingStandard\Config;
|
use Nextcloud\CodingStandard\Config;
|
||||||
|
|
||||||
$config = new Config();
|
class MyConfig extends Config
|
||||||
|
{
|
||||||
|
public function getRules(): array
|
||||||
|
{
|
||||||
|
$rules = parent::getRules();
|
||||||
|
$rules['@PhpCsFixer'] = true;
|
||||||
|
$rules['curly_braces_position']['classes_opening_brace'] = 'next_line_unless_newline_at_signature_end';
|
||||||
|
$rules['phpdoc_to_comment'] = false;
|
||||||
|
return $rules;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$config = new MyConfig();
|
||||||
$config
|
$config
|
||||||
->getFinder()
|
->getFinder()
|
||||||
->notPath('build')
|
->notPath('build')
|
||||||
|
180
Makefile
Normal file
180
Makefile
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
# https://github.com/nextcloud/appstore/blob/fixed-templates/nextcloudappstore/scaffolding/app-templates/26/app/Makefile
|
||||||
|
# Generic Makefile for building and packaging a Nextcloud app which uses npm and
|
||||||
|
# Composer.
|
||||||
|
#
|
||||||
|
# Dependencies:
|
||||||
|
# * make
|
||||||
|
# * which
|
||||||
|
# * curl: used if phpunit and composer are not installed to fetch them from the web
|
||||||
|
# * 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.
|
||||||
|
#
|
||||||
|
# The following npm scripts in your package.json install and update the bower
|
||||||
|
# and npm dependencies and use gulp as build system (notice how everything is
|
||||||
|
# run from the node_modules folder):
|
||||||
|
#
|
||||||
|
# "scripts": {
|
||||||
|
# "test": "node node_modules/gulp-cli/bin/gulp.js karma",
|
||||||
|
# "prebuild": "npm install && node_modules/bower/bin/bower install && node_modules/bower/bin/bower update",
|
||||||
|
# "build": "node node_modules/gulp-cli/bin/gulp.js"
|
||||||
|
# },
|
||||||
|
|
||||||
|
app_name=$(notdir $(CURDIR))
|
||||||
|
build_tools_directory=$(CURDIR)/build/tools
|
||||||
|
source_build_directory=$(CURDIR)/build/artifacts/source
|
||||||
|
source_package_name=$(source_build_directory)/$(app_name)
|
||||||
|
appstore_build_directory=$(CURDIR)/build/artifacts
|
||||||
|
appstore_package_name=$(appstore_build_directory)/$(app_name)
|
||||||
|
npm=$(shell which npm 2> /dev/null)
|
||||||
|
composer=$(shell which composer 2> /dev/null)
|
||||||
|
|
||||||
|
all: build
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Installs and updates the composer dependencies. If composer is not installed
|
||||||
|
# a copy is fetched from the web
|
||||||
|
.PHONY: composer
|
||||||
|
composer:
|
||||||
|
ifeq (, $(composer))
|
||||||
|
@echo "No composer command available, downloading a copy from the web"
|
||||||
|
mkdir -p $(build_tools_directory)
|
||||||
|
curl -sS https://getcomposer.org/installer | php
|
||||||
|
mv composer.phar $(build_tools_directory)
|
||||||
|
php $(build_tools_directory)/composer.phar install --prefer-dist
|
||||||
|
else
|
||||||
|
composer install --prefer-dist
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Installs npm dependencies
|
||||||
|
.PHONY: npm
|
||||||
|
npm:
|
||||||
|
npm ci
|
||||||
|
npm run build
|
||||||
|
|
||||||
|
# Removes the appstore build
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
rm -rf ./build
|
||||||
|
|
||||||
|
# Same as clean but also removes dependencies installed by composer, bower and
|
||||||
|
# npm
|
||||||
|
.PHONY: distclean
|
||||||
|
distclean: clean
|
||||||
|
rm -rf vendor
|
||||||
|
rm -rf node_modules
|
||||||
|
rm -rf js/vendor
|
||||||
|
rm -rf js/node_modules
|
||||||
|
|
||||||
|
# Builds the source and appstore package
|
||||||
|
.PHONY: dist
|
||||||
|
dist: build
|
||||||
|
make source
|
||||||
|
make appstore
|
||||||
|
|
||||||
|
# Builds the source package
|
||||||
|
.PHONY: source
|
||||||
|
source:
|
||||||
|
rm -rf $(source_build_directory)
|
||||||
|
mkdir -p $(source_build_directory)
|
||||||
|
tar -C .. -cvzf $(source_package_name).tar.gz \
|
||||||
|
--exclude-vcs \
|
||||||
|
--exclude="$(app_name)/build" \
|
||||||
|
--exclude="$(app_name)/js/node_modules" \
|
||||||
|
--exclude="$(app_name)/node_modules" \
|
||||||
|
--exclude="$(app_name)/*.log" \
|
||||||
|
--exclude="$(app_name)/js/*.log" \
|
||||||
|
$(app_name)
|
||||||
|
|
||||||
|
# Builds the source package for the app store, ignores php tests, js tests
|
||||||
|
# and build related folders that are unnecessary for an appstore release
|
||||||
|
.PHONY: appstore
|
||||||
|
appstore:
|
||||||
|
rm -rf $(appstore_build_directory)
|
||||||
|
mkdir -p $(appstore_build_directory)
|
||||||
|
tar -C .. -cvzf $(appstore_package_name).tar.gz \
|
||||||
|
--exclude="$(app_name)/build" \
|
||||||
|
--exclude="$(app_name)/tests" \
|
||||||
|
--exclude="$(app_name)/Makefile" \
|
||||||
|
--exclude="$(app_name)/*.log" \
|
||||||
|
--exclude="$(app_name)/phpunit*xml" \
|
||||||
|
--exclude="$(app_name)/composer.*" \
|
||||||
|
--exclude="$(app_name)/node_modules" \
|
||||||
|
--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)/package.json" \
|
||||||
|
--exclude="$(app_name)/bower.json" \
|
||||||
|
--exclude="$(app_name)/karma.*" \
|
||||||
|
--exclude="$(app_name)/protractor\.*" \
|
||||||
|
--exclude="$(app_name)/.*" \
|
||||||
|
--exclude="$(app_name)/js/.*" \
|
||||||
|
--exclude="$(app_name)/tsconfig.json" \
|
||||||
|
--exclude="$(app_name)/stylelint.config.cjs" \
|
||||||
|
--exclude="$(app_name)/README.md" \
|
||||||
|
--exclude="$(app_name)/package-lock.json" \
|
||||||
|
--exclude="$(app_name)/LICENSE" \
|
||||||
|
--exclude="$(app_name)/src" \
|
||||||
|
--exclude="$(app_name)/stubs" \
|
||||||
|
--exclude="$(app_name)/screens" \
|
||||||
|
--exclude="$(app_name)/vendor" \
|
||||||
|
--exclude="$(app_name)/translationfiles" \
|
||||||
|
--exclude="$(app_name)/Dockerfile" \
|
||||||
|
--exclude="$(app_name)/psalm.xml" \
|
||||||
|
--exclude="$(app_name)/renovate.json" \
|
||||||
|
--exclude="$(app_name)/vite.config.ts" \
|
||||||
|
$(app_name)
|
||||||
|
|
||||||
|
# Start a nextcloud server on Docker to kickstart developement
|
||||||
|
.PHONY: dev
|
||||||
|
dev: build
|
||||||
|
docker stop $(app_template) || true
|
||||||
|
docker rm $(app_template) || true
|
||||||
|
docker build -t $(app_template) .
|
||||||
|
docker run -itd --rm --name $(app_template) -v $(CURDIR):/var/www/html/apps/app_template -p 80:80 $(app_template)
|
||||||
|
npm run watch
|
||||||
|
|
||||||
|
# Generate translations
|
||||||
|
.PHONY: l10n
|
||||||
|
l10n:
|
||||||
|
docker run --rm \
|
||||||
|
-v $(CURDIR):/app \
|
||||||
|
--entrypoint php \
|
||||||
|
nextcloudci/translations \
|
||||||
|
/translationtool.phar create-pot-files
|
||||||
|
docker run --rm \
|
||||||
|
-v $(CURDIR):/app \
|
||||||
|
--entrypoint php \
|
||||||
|
nextcloudci/translations \
|
||||||
|
/translationtool.phar convert-po-files
|
@ -15,32 +15,23 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"post-install-cmd": [
|
|
||||||
"@composer bin all install --ansi"
|
|
||||||
],
|
|
||||||
"post-update-cmd": [
|
|
||||||
"@composer bin all update --ansi"
|
|
||||||
],
|
|
||||||
"lint": "find . -name \\*.php -not -path './vendor/*' -not -path './vendor-bin/*' -not -path './build/*' -print0 | xargs -0 -n1 php -l",
|
"lint": "find . -name \\*.php -not -path './vendor/*' -not -path './vendor-bin/*' -not -path './build/*' -print0 | xargs -0 -n1 php -l",
|
||||||
"cs:check": "php-cs-fixer fix --dry-run --diff",
|
"cs:check": "php-cs-fixer fix --dry-run --diff",
|
||||||
"cs:fix": "php-cs-fixer fix",
|
"cs:fix": "php-cs-fixer fix",
|
||||||
"psalm": "psalm --threads=1 --no-cache",
|
"psalm": "psalm --threads=1 --no-cache --show-info=true",
|
||||||
"test:unit": "phpunit tests -c tests/phpunit.xml --colors=always --fail-on-warning --fail-on-risky",
|
|
||||||
"openapi": "generate-spec",
|
|
||||||
"rector": "rector && composer cs:fix"
|
"rector": "rector && composer cs:fix"
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"bamarni/composer-bin-plugin": "^1.8",
|
|
||||||
"php": "^8.1"
|
"php": "^8.1"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"nextcloud/ocp": "dev-stable29",
|
"nextcloud/ocp": "^30.0.2",
|
||||||
"roave/security-advisories": "dev-latest"
|
"roave/security-advisories": "dev-latest",
|
||||||
|
"nextcloud/coding-standard": "^1.3.2",
|
||||||
|
"rector/rector": "^1.2.10",
|
||||||
|
"vimeo/psalm": "^5.26.1"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"allow-plugins": {
|
|
||||||
"bamarni/composer-bin-plugin": true
|
|
||||||
},
|
|
||||||
"optimize-autoloader": true,
|
"optimize-autoloader": true,
|
||||||
"sort-packages": true,
|
"sort-packages": true,
|
||||||
"platform": {
|
"platform": {
|
||||||
|
2585
composer.lock
generated
2585
composer.lock
generated
File diff suppressed because it is too large
Load Diff
5709
package-lock.json
generated
5709
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
29
package.json
29
package.json
@ -2,30 +2,37 @@
|
|||||||
"name": "app_template",
|
"name": "app_template",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"engines": {
|
|
||||||
"node": "^20.0.0",
|
|
||||||
"npm": "^10.0.0"
|
|
||||||
},
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"dev": "vite --mode development build",
|
"dev": "vite --mode development build",
|
||||||
"watch": "vite --mode development build --watch",
|
"watch": "vite --mode development build --watch",
|
||||||
"lint": "eslint src",
|
"lint": "vue-tsc && eslint src",
|
||||||
"stylelint": "stylelint src/**/*.vue src/**/*.scss src/**/*.css"
|
"lint:fix": "vue-tsc && eslint src --fix",
|
||||||
|
"stylelint": "stylelint src/**/*.vue src/**/*.scss src/**/*.css",
|
||||||
|
"stylelint:fix": "stylelint src/**/*.vue src/**/*.scss src/**/*.css --fix"
|
||||||
},
|
},
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"extends @nextcloud/browserslist-config"
|
"extends @nextcloud/browserslist-config"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nextcloud/vue": "^8.18.0",
|
"@formatjs/intl-segmenter": "^11.7.3",
|
||||||
"vue": "^2.7.16"
|
"@nextcloud/vite-config": "^2.2.2",
|
||||||
|
"@nextcloud/vue": "9.0.0-alpha.5",
|
||||||
|
"vite": "^5.4.10",
|
||||||
|
"vue": "^3.5.12"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@nextcloud/browserslist-config": "^3.0.1",
|
"@nextcloud/browserslist-config": "^3.0.1",
|
||||||
"@nextcloud/eslint-config": "^8.4.1",
|
"@nextcloud/eslint-config": "^8.4.1",
|
||||||
|
"@nextcloud/prettier-config": "^1.1.0",
|
||||||
"@nextcloud/stylelint-config": "^3.0.1",
|
"@nextcloud/stylelint-config": "^3.0.1",
|
||||||
"@nextcloud/vite-config": "^1.4.2",
|
"@vue/eslint-config-typescript": "^13",
|
||||||
"vite": "^5.4.10"
|
"@vue/tsconfig": "^0.5.1",
|
||||||
}
|
"eslint-config-prettier": "^9.1.0",
|
||||||
|
"eslint-plugin-prettier": "^5.2.1",
|
||||||
|
"typescript": "5.5",
|
||||||
|
"vue-tsc": "^2.1.10"
|
||||||
|
},
|
||||||
|
"prettier": "@nextcloud/prettier-config"
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ use Rector\Config\RectorConfig;
|
|||||||
return RectorConfig::configure()
|
return RectorConfig::configure()
|
||||||
->withPaths([
|
->withPaths([
|
||||||
__DIR__ . '/lib',
|
__DIR__ . '/lib',
|
||||||
__DIR__ . '/tests',
|
|
||||||
])
|
])
|
||||||
->withPhpSets(php80: true)
|
->withPhpSets(php80: true)
|
||||||
->withPreparedSets(
|
->withPreparedSets(
|
||||||
@ -19,7 +18,6 @@ return RectorConfig::configure()
|
|||||||
instanceOf: true,
|
instanceOf: true,
|
||||||
earlyReturn: true,
|
earlyReturn: true,
|
||||||
strictBooleans: true,
|
strictBooleans: true,
|
||||||
carbon: true,
|
|
||||||
rectorPreset: true,
|
rectorPreset: true,
|
||||||
phpunitCodeQuality: true,
|
phpunitCodeQuality: true,
|
||||||
doctrineCodeQuality: true,
|
doctrineCodeQuality: true,
|
||||||
|
15
tsconfig.json
Normal file
15
tsconfig.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"extends": "@vue/tsconfig",
|
||||||
|
"include": ["./src/**/*.ts", "./src/**/*.vue", "**/*.ts"],
|
||||||
|
"compilerOptions": {
|
||||||
|
"allowImportingTsExtensions": true,
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"target": "ESNext",
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "Bundler",
|
||||||
|
"noImplicitAny": false,
|
||||||
|
"rootDir": ".",
|
||||||
|
"strict": true,
|
||||||
|
"noEmit": true,
|
||||||
|
}
|
||||||
|
}
|
@ -1,13 +0,0 @@
|
|||||||
import { createAppConfig } from "@nextcloud/vite-config";
|
|
||||||
import { join, resolve } from "path";
|
|
||||||
|
|
||||||
export default createAppConfig(
|
|
||||||
{
|
|
||||||
main: resolve(join("src", "main.js")),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
createEmptyCSSEntryPoints: true,
|
|
||||||
extractLicenseInformation: true,
|
|
||||||
thirdPartyLicense: false,
|
|
||||||
}
|
|
||||||
);
|
|
20
vite.config.ts
Normal file
20
vite.config.ts
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import { join, resolve } from 'path'
|
||||||
|
import { createAppConfig } from '@nextcloud/vite-config'
|
||||||
|
import { defineConfig } from 'vite'
|
||||||
|
|
||||||
|
const config = defineConfig({
|
||||||
|
build: {
|
||||||
|
sourcemap: false,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
export default createAppConfig(
|
||||||
|
{
|
||||||
|
main: resolve(join('src', 'main.ts')),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
createEmptyCSSEntryPoints: true,
|
||||||
|
thirdPartyLicense: false,
|
||||||
|
},
|
||||||
|
)
|
Loading…
Reference in New Issue
Block a user