Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: small improvements #256

Merged
merged 7 commits into from
Feb 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# EditorConfig helps maintain consistent coding styles between editors
root = true

# Default settings for all files (e.g. most common, best-practice standard across all filetypes)
[*]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we keep it similar to .prettierrc for tab size and tabs

{
	"useTabs": true,
	"semi": true,
	"tabWidth": 4,
	"trailingComma": "none",
	"printWidth": 100,
	"plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"],
	"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so indent_size=4 and indent with tabs instead of spaces

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is fine. I only specified two spaces instead of 4 spaces/tab because two spaces are more of the standard when it comes to modern JavaScript and Svelte. I had checked with GPT. However, I know everyone has their own preference, and because you are the code owner I will get this changed. Just wanted to make a best-practice/standardized suggestion, 😉 ...but I have no desire to raise argument over this. 😂 If you don't think this standard is a good change, I think the real win here is implementing an EditorConfig file to help others more quickly align to project standards in their own IDEs.

I can get this change made to reflect your settings in Prettier if that's ultimately what you would like. Are you expecting only .js, .tx, and Svelte file types updated to tabs?

Copy link
Collaborator Author

@kaffolder7 kaffolder7 Feb 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rajnandan1 Here's what I'm proposing for best-practice and standardized approach. I can easily update .prettierrc to match:

Filetype Indent Size Indent Style Notes
* 4 tab Catch-all for files not overridden in other rules below
*.svelte 4 tab rajnandan1's preference

Standard/best-practice and more-widely adopted is actually: 2 spaces
*.{js,ts,tsx,cjs,mjs} 4 tab rajnandan1's preference

Standard/best-practice and more-widely adopted is actually: 2 spaces
*.json,.prettierrc 2 spaces per JSON (RFC 8259) specification
*.{yaml,yml} 2 spaces per latest YAML 1.2 (2009) specification
*.md 4 tab rajnandan1's preference

Standard/best-practice and more-widely adopted is actually: 2 or 4 spaces
Dockerfile 4 tab -

Could you please confirm if this is ok? Or if you would like any of these adjusted further? The "Indent Size" and "Indent Style" columns are currently the values I will plan on implementing, unless you are comfortable with my suggestions in the "Notes" column. 😊

Copy link
Owner

@rajnandan1 rajnandan1 Feb 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel you are correct and we can keep it 2 in .editorconfig which should be fine.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge? if there is nothing else?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rajnandan1 Yes, you may merge. I just pushed the updates. .prettierrc and .editorconfig are now better-aligned w/ best-practice/most-widely adopted indentation sizes and formats. 😊

charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2

# Svelte files
[*.svelte]
indent_style = space
indent_size = 2
trim_trailing_whitespace = false

# JavaScript and TypeScript
[*.{js,ts,tsx,cjs,mjs}]
indent_style = space
indent_size = 2

# JSON files (package.json, config files, etc.) - per JSON (RFC 8259) specification
[*.json,.prettierrc]
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = false

# YAML files (e.g., GitHub Actions, Lint configs) - per YAML 1.2 (2009) specification
[*.{yaml,yml}]
indent_style = space
indent_size = 2

# Markdown files
[*.md]
indent_style = space
indent_size = 4
trim_trailing_whitespace = false

# Dockerfile
[Dockerfile*]
indent_style = tab
indent_size = 4
insert_final_newline = false

# Ignore binary files
[*.{png,jpg,jpeg,gif,ico,svg,woff,woff2,eot,ttf,otf}]
charset = unset
trim_trailing_whitespace = false
insert_final_newline = false
76 changes: 69 additions & 7 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,71 @@
{
"useTabs": true,
"semi": true,
"tabWidth": 4,
"trailingComma": "none",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
"useTabs": false,
"semi": true,
"tabWidth": 2,
"trailingComma": "none",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"],
"overrides": [
{
"files": "*.svelte",
"options": {
"parser": "svelte",
"useTabs": false,
"semi": false,
"tabWidth": 2,
"trailingComma": "none",
"printWidth": 100
}
},
{
"files": ["*.js", "*.ts", "*.tsx", "*.cjs", "*.mjs"],
"options": {
"useTabs": false,
"semi": true,
"tabWidth": 2,
"trailingComma": "all",
"printWidth": 80
}
},
{
"files": ["*.json", ".prettierrc"],
"options": {
"useTabs": false,
"semi": false,
"tabWidth": 2,
"trailingComma": "none",
"printWidth": 100
}
},
{
"files": ["*.yaml", "*.yml"],
"options": {
"useTabs": false,
"semi": false,
"tabWidth": 2,
"trailingComma": "none",
"printWidth": 80
}
},
{
"files": "*.md",
"options": {
"useTabs": false,
"semi": false,
"tabWidth": 4,
"trailingComma": "none",
"printWidth": 100
}
},
{
"files": "Dockerfile",
"options": {
"useTabs": true,
"tabWidth": 4,
"semi": false,
"trailingComma": "none",
"printWidth": 120
}
}
]
}
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
<a href="https://github.com/ivbeg/awesome-status-pages"><img src="https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg" alt="Awesome status page" /></a>
<a href="https://hub.docker.com/r/rajnandan1/kener"><img src="https://img.shields.io/docker/pulls/rajnandan1/kener" alt="Docker Kener" /></a>
</p>

<p align="center">
<a href="https://github.com/rajnandan1/kener/actions/workflows/publishImage.yml"><img alt="GitHub Workflow Status" src="https://img.shields.io/github/actions/workflow/status/rajnandan1/kener/publishImage.yml" /></a>
<a href="https://github.com/rajnandan1/kener/commit/HEAD"><img src="https://img.shields.io/github/last-commit/rajnandan1/kener/main" alt="" /></a>
<a href="https://github.com/rajnandan1/kener/issues"><img alt="GitHub issues" src="https://img.shields.io/github/issues/rajnandan1/kener.svg" /></a>
</p>

<p align="center">
<picture>
Expand Down
6 changes: 3 additions & 3 deletions docs/customize-site.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ i18n:
vi: "Tiếng Việt"
pattern: "squares"
font:
cssSrc: "https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&display=swap"
cssSrc: "https://fonts.bunny.net/css?family=lato:100,100i,300,300i,400,400i,700,700i,900,900i&display=swap"
family: '"Lato", sans-serif'
analytics:
- id: "G-QsFT"
Expand Down Expand Up @@ -315,11 +315,11 @@ You can set the background pattern of the site. It can be `squares`, `dots`, `no

## font

You can set the font of the site. You can use google fonts or any other font.
You can set the font of the site. You can use google fonts, [bunny fonts](https://fonts.bunny.net/) (which is a fully GDPR-compliant, zero-tracking/no-logging CDN font service), or any other font.

```yaml
font:
cssSrc: "https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&display=swap"
cssSrc: "https://fonts.bunny.net/css?family=lato:100,100i,300,300i,400,400i,700,700i,900,900i&display=swap"
family: '"Lato", sans-serif'
```

Expand Down
2 changes: 1 addition & 1 deletion docs/theme.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ You can change the colors of UP/DEGRADED/DOWN states of the monitor. You show ha

## Font

You can change the font of the status page. You can choose from a list of google fonts.
You can change the font of the status page. You can choose from a list of google, or [bunny fonts](https://fonts.bunny.net/) (which is a fully GDPR-compliant, zero-tracking/no-logging CDN font service).

### Font URL

Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/manage/themeInfo.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
DEGRADED: "#e6ca61"
},
fontJ: {
cssSrc: "https://fonts.googleapis.com/css2?family=Albert+Sans:ital,wght@0,100..900;1,100..900&display=swap",
cssSrc: "https://fonts.bunny.net/css?family=albert-sans:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i&display=swap",
family: "Albert Sans"
},
colors: "",
Expand Down Expand Up @@ -334,7 +334,7 @@
class="mt-2"
type="text"
id="cssSrc"
placeholder="https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&display=swap"
placeholder="https://fonts.bunny.net/css?family=lato:100,100i,300,300i,400,400i,700,700i,900,900i&display=swap"
/>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/lib/server/db/seedSiteData.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const seedSiteData = {
}
],
nav: [
{ name: "Documentation", url: "/docs/home", iconURL: "" },
{ name: "Documentation", url: "https://kener.ing/docs/home", iconURL: "" },
{ name: "Github", iconURL: "", url: "https://github.com/rajnandan1/kener" },
{ name: "Login", iconURL: "", url: "/manage/signin" }
],
Expand Down Expand Up @@ -81,7 +81,7 @@ const seedSiteData = {
DEGRADED: "#e6ca61"
},
font: {
cssSrc: "https://fonts.googleapis.com/css2?family=Albert+Sans:ital,wght@0,100..900;1,100..900&display=swap",
cssSrc: "https://fonts.bunny.net/css?family=albert-sans:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i&display=swap",
family: "Albert Sans"
},
categories: [{ name: "Home", description: "Monitors for Home Page" }],
Expand Down