Conventions & code formating

This commit is contained in:
iPurpl3x
2021-12-21 17:44:27 +01:00
parent fcd833a248
commit 590d0084c5
11 changed files with 383 additions and 198 deletions

16
.editorconfig Normal file
View File

@@ -0,0 +1,16 @@
root = true
[*]
charset = utf-8
end_of_line = lf
max_line_length = 100
insert_final_newline = true
trim_trailing_whitespace = true
quote_type = single
indent_style = tab
indent_size = 4
[*.{json,yml,yaml}]
indent_style = space
indent_size = 2
insert_final_newline = false

156
.gitignore vendored
View File

@@ -1,5 +1,5 @@
# Created by https://www.toptal.com/developers/gitignore/api/vim,yarn,node,linux,macos,windows,visualstudiocode,composer
# Edit at https://www.toptal.com/developers/gitignore?templates=vim,yarn,node,linux,macos,windows,visualstudiocode,composer
# Created by https://www.toptal.com/developers/gitignore/api/vim,yarn,node,macos,linux,windows,composer,visualstudiocode,jetbrains
# Edit at https://www.toptal.com/developers/gitignore?templates=vim,yarn,node,macos,linux,windows,composer,visualstudiocode,jetbrains
### Composer ###
composer.phar
@@ -7,7 +7,110 @@ composer.phar
# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
# composer.lock
composer.lock
### JetBrains ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### JetBrains Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr
# Sonarlint plugin
# https://plugins.jetbrains.com/plugin/7973-sonarlint
.idea/**/sonarlint/
# SonarQube Plugin
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
.idea/**/sonarIssues.xml
# Markdown Navigator plugin
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
.idea/**/markdown-navigator.xml
.idea/**/markdown-navigator-enh.xml
.idea/**/markdown-navigator/
# Cache file creation bug
# See https://youtrack.jetbrains.com/issue/JBR-2257
.idea/$CACHE_FILE$
# CodeStream plugin
# https://plugins.jetbrains.com/plugin/12206-codestream
.idea/codestream.xml
### Linux ###
*~
@@ -33,6 +136,7 @@ composer.phar
# Icon must end with two \r
Icon
# Thumbnails
._*
@@ -61,6 +165,9 @@ yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Lock file => as we don't use npm, but yarn.
package-lock.json
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
@@ -108,6 +215,9 @@ typings/
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
@@ -126,16 +236,26 @@ typings/
# dotenv environment variables file
.env
.env.test
.env*.local
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
# Nuxt.js build / generate output
.nuxt
#dist
# dist
# Storybook build outputs
.out
.storybook-out
storybook-static
# rollup.js default build output
# dist/
# Gatsby files
.cache/
@@ -161,6 +281,10 @@ typings/
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# Temporary folders
tmp/
temp/
### Vim ###
# Swap
[._]*.s[a-v][a-z]
@@ -183,15 +307,14 @@ tags
### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide
### Windows ###
# Windows thumbnail cache files
@@ -222,16 +345,17 @@ $RECYCLE.BIN/
### yarn ###
# https://yarnpkg.com/advanced/qa#which-files-should-be-gitignored
# .yarn/unplugged and .yarn/build-state.yml should likely always be ignored since
# they typically hold machine-specific build artifacts. Ignoring them might however
# prevent Zero-Installs from working (to prevent this, set enableScripts to false).
.yarn/unplugged
.yarn/build-state.yml
.yarn/*
!.yarn/releases
!.yarn/plugins
!.yarn/sdks
!.yarn/versions
# .yarn/cache and .pnp.* may be safely ignored, but you'll need to run yarn install
# to regenerate them between each branch switch.
# Uncomment the following lines if you're not using Zero-Installs:
# .yarn/cache
# if you are NOT using Zero-installs, then:
# comment the following lines
!.yarn/cache
# and uncomment the following lines
# .pnp.*
# End of https://www.toptal.com/developers/gitignore/api/vim,yarn,node,linux,macos,windows,visualstudiocode,composer
# End of https://www.toptal.com/developers/gitignore/api/vim,yarn,node,macos,linux,windows,composer,visualstudiocode,jetbrains

19
.prettierrc Normal file
View File

@@ -0,0 +1,19 @@
bracketSameLine: true
jsxBracketSameLine: true
jsxSingleQuote: true
printWidth: 100
proseWrap: "always"
semi: true
singleQuote: true
tabWidth: 4
trailingComma: "all"
useTabs: true
overrides:
- files:
- "*.json"
- "*.yml"
- "*.yaml"
options:
useTabs: false
tabWidth: 2

View File

@@ -1,7 +1,16 @@
MIT License Copyright (c) 2021 Glowing Blue AG
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:
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 (including the next paragraph) shall be included in all copies or substantial portions of the Software.
The above copyright notice and this permission notice (including the next paragraph) 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.
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.

View File

@@ -1,6 +1,8 @@
# ⚡️ Redis Setup
[![MIT license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/glowingblue/flarum-ext-redis-setup/blob/master/LICENSE.md) [![Latest Stable Version](https://img.shields.io/packagist/v/glowingblue/redis-setup.svg)](https://packagist.org/packages/glowingblue/redis-setup) [![Total Downloads](https://img.shields.io/packagist/dt/glowingblue/redis-setup.svg)](https://packagist.org/packages/glowingblue/redis-setup)
[![MIT license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/glowingblue/flarum-ext-redis-setup/blob/master/LICENSE.md)
[![Latest Stable Version](https://img.shields.io/packagist/v/glowingblue/redis-setup.svg)](https://packagist.org/packages/glowingblue/redis-setup)
[![Total Downloads](https://img.shields.io/packagist/dt/glowingblue/redis-setup.svg)](https://packagist.org/packages/glowingblue/redis-setup)
A [Flarum](http://flarum.org) extension.
@@ -10,7 +12,8 @@ Makes it easy to enable/disable Redis features:
- Queue
- Sessions
If you are using a local redis setup, you will likely be able to simply use the defaults provided. Any of these can be overridden using environment variables as follows:
If you are using a local redis setup, you will likely be able to simply use the defaults provided.
Any of these can be overridden using environment variables as follows:
```ini
REDIS_HOST='127.0.0.1 # Optional, else uses default

View File

@@ -1,8 +1,12 @@
{
"name": "glowingblue/redis-setup",
"name": "glowingblue/redis-setup-inactive",
"description": "Makes it easy to enable/disable Redis features: Cache, Queue & Sessions",
"keywords": [
"flarum", "redis", "cache", "queue", "session"
"flarum",
"redis",
"cache",
"queue",
"session"
],
"type": "flarum-extension",
"license": "MIT",

View File

@@ -17,9 +17,9 @@ use GlowingBlue\RedisSetup\Provider\QueueProvider;
return [
(new Extend\Frontend('admin'))
->js(__DIR__.'/js/dist/admin.js'),
->js(__DIR__ . '/js/dist/admin.js'),
new Extend\Locales(__DIR__.'/resources/locale'),
new Extend\Locales(__DIR__ . '/resources/locale'),
new GBExtend\EnableRedis(),

View File

@@ -1,3 +1,12 @@
/*
* This file is part of glowingblue/redis-setup.
*
* Copyright (c) 2021 Ian Morland.
*
* For the full copyright and license information, please view the LICENSE.md
* file that was distributed with this source code.
*/
import app from 'flarum/admin/app';
import { extend } from 'flarum/common/extend';
import StatusWidget from 'flarum/admin/components/StatusWidget';
@@ -14,7 +23,7 @@ app.initializers.add('glowingblue-redis-setup', () => {
setting: 'glowingblue-redis.redisSessions',
type: 'boolean',
label: app.translator.trans(
'glowingblue-redis-setup.admin.settings.enable_redis_sessions'
'glowingblue-redis-setup.admin.settings.enable_redis_sessions',
),
})
.registerSetting({

View File

@@ -2,5 +2,6 @@ glowingblue-redis-setup:
admin:
settings:
enable_cache: Enable Redis cache
enable_redis_sessions: Enable Redis sessions (all users will be logged out after changing this setting)
enable_redis_sessions:
Enable Redis sessions (all users will be logged out after changing this setting)
enable_queue: Enable Redis queue