Skip to content

Commit

Permalink
Move repository list to Cloudflare worker (hacs#148)
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus committed Mar 9, 2021
1 parent f359aa6 commit d770c84
Show file tree
Hide file tree
Showing 16 changed files with 253 additions and 171 deletions.
10 changes: 9 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,19 @@
"context": "..",
"postStartCommand": "make init",
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
"terminal.integrated.shell.linux": "/bin/bash",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": false,
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": false,

}
},
"appPort": ["3000:3000"],
"postCreateCommand": "make init",
"extensions": [
"dbaeumer.vscode-eslint"
]
}
}
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"singleQuote": true,
"semi": false,
"trailingComma": "all",
"tabWidth": 2,
"printWidth": 100
}
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ start: ## Start the documentation server
yarn start;

bootstrap: ## Run yarn
yarn global add prettier;
yarn;

build: ## Build the documentation
Expand Down
6 changes: 0 additions & 6 deletions documentation/default_repositories.md

This file was deleted.

2 changes: 1 addition & 1 deletion documentation/faq/custom_repositories.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Custom Repositories
description: "Custom repositories in HACS"
---

[HACS already has a lot of repositories by default](https://hacs.xyz/docs/default_repositories)
[HACS already has a lot of repositories by default](https://hacs.xyz/default_repositories)

But there are a number of different reasons why a developer might not want to publish their repository to HACS, for these situations you can in many cases add it to HACS as a custom repository.

Expand Down
4 changes: 2 additions & 2 deletions documentation/faq/initial_startup.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ description: "Initial startup"
---
HACS does not ship with any knowledge about the repositories it is supposed to show.

Since there is no central "HACS server", every installation of HACS fetches this information from GitHub, it has to get the information about all [default repositories](/docs/default_repositories)
Since there is no central "HACS server", every installation of HACS fetches this information from GitHub, it has to get the information about all [default repositories](/default_repositories)

To get the information that is needed to show a representation of the repository in HACS, HACS uses the [GitHub API](https://docs.github.com/en/rest), this API is [rate limited](https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting) and when you hit that rate limit HACS will pause any communitation to the GitHub API until the rate limit reset (can take up to one hour).

:::info
For new installation of HACS with the current amount of default repositories you will hit that rate limit on the initial startup after installing HACS.
Because of this HACS will be in a "Starting up" state until it's done fetching the information for all [default repositories](/docs/default_repositories)
Because of this HACS will be in a "Starting up" state until it's done fetching the information for all [default repositories](/default_repositories)

Which in return will cause the initial startup of HACS to take over 1 hour to finish.
:::
12 changes: 6 additions & 6 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ module.exports = {
apiKey: 'ae98e104dc1572a7e897b97951c756a5',
indexName: 'hacs',
},
image: "img/hacs-logo.png",
description: "HACS gives you a powerful UI to handle downloads of all your custom needs.",
image: 'img/hacs-logo.png',
description: 'HACS gives you a powerful UI to handle downloads of all your custom needs.',
navbar: {
title: 'HACS',
items: [
{ to: 'docs/installation/prerequisites', label: 'Installation', position: 'left' },
{ to: 'docs/configuration/start', label: 'Configuration', position: 'left' },
{ to: 'docs/basic/getting_started', label: 'Usage', position: 'left' },
{ to: 'docs/community_guides', label: 'Guides', position: 'left' },
{ to: 'docs/default_repositories', label: 'Repositories', position: 'left' },
{ to: 'default_repositories', label: 'Repositories', position: 'left' },
{ to: 'docs/developer/start', label: 'Developer docs', position: 'right' },
{ to: 'docs/faq/what', label: 'FAQ', position: 'right' },
{ to: 'help', label: 'Help', position: 'right' },
Expand All @@ -44,7 +44,7 @@ module.exports = {
footer: {
links: [
{
title: "Resources",
title: 'Resources',
items: [
{
label: 'GitHub',
Expand All @@ -65,7 +65,7 @@ module.exports = {
],
},
{
title: "Deploys by Netlify!",
title: 'Deploys by Netlify!',
items: [
{
html: `
Expand Down Expand Up @@ -98,4 +98,4 @@ module.exports = {
},
],
],
};
}
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "hacs",
"version": "0.0.0",
"private": true,
"main": "worker.js",
"scripts": {
"start": "docusaurus start --host 0.0.0.0",
"build": "docusaurus build",
Expand All @@ -12,10 +13,11 @@
"@docusaurus/preset-classic": "^2.0.0-alpha.70",
"@docusaurus/utils": "^2.0.0-alpha.70",
"classnames": "^2.2.6",
"selfsigned": "^1.10.8",
"node-forge": "^0.10.0",
"react": "^17.0.1",
"react-async": "^10.0.1",
"react-dom": "^17.0.1",
"node-forge": "^0.10.0"
"selfsigned": "^1.10.8"
},
"browserslist": {
"production": [
Expand Down
7 changes: 0 additions & 7 deletions script/build

This file was deleted.

32 changes: 0 additions & 32 deletions script/generate_default_repositories.py

This file was deleted.

112 changes: 50 additions & 62 deletions sidebars.js
Original file line number Diff line number Diff line change
@@ -1,78 +1,66 @@
module.exports = {
usage: {
Basic: [
"basic/getting_started",
"basic/updates",
"basic/existing_elements",
"basic/sensor",
"basic/events",
"basic/automation",
"basic/theming",
"basic/logs",
'basic/getting_started',
'basic/updates',
'basic/existing_elements',
'basic/sensor',
'basic/events',
'basic/automation',
'basic/theming',
'basic/logs',
],
Navigation: ["navigation/overview", "navigation/stores"],
Navigation: ['navigation/overview', 'navigation/stores'],
Categories: [
"categories/integrations",
"categories/plugins",
"categories/appdaemon_apps",
"categories/netdaemon_apps",
"categories/python_scripts",
"categories/themes",
'categories/integrations',
'categories/plugins',
'categories/appdaemon_apps',
'categories/netdaemon_apps',
'categories/python_scripts',
'categories/themes',
],
},
installation: {
Installation: [
"installation/prerequisites",
"installation/installation",
],
Configuration: [
"configuration/start",
"configuration/basic",
"configuration/options",
],
"Legacy Configuration (YAML)": [
"configuration/legacy",
"configuration/pat"
],
Remove: [
"installation/remove",
],
Installation: ['installation/prerequisites', 'installation/installation'],
Configuration: ['configuration/start', 'configuration/basic', 'configuration/options'],
'Legacy Configuration (YAML)': ['configuration/legacy', 'configuration/pat'],
Remove: ['installation/remove'],
},
"developer documentation": {
"HACS Development": [
"developer/start",
"developer/devcontainer",
"developer/translation",
"developer/documentation",
"developer/backend",
"developer/frontend",
"developer/maintainer",
'developer documentation': {
'HACS Development': [
'developer/start',
'developer/devcontainer',
'developer/translation',
'developer/documentation',
'developer/backend',
'developer/frontend',
'developer/maintainer',
],
"Publish to HACS": [
"publish/start",
"publish/appdaemon",
"publish/integration",
"publish/netdaemon",
"publish/plugin",
"publish/python_script",
"publish/theme",
"publish/include",
"publish/action",
"publish/remove",
'Publish to HACS': [
'publish/start',
'publish/appdaemon',
'publish/integration',
'publish/netdaemon',
'publish/plugin',
'publish/python_script',
'publish/theme',
'publish/include',
'publish/action',
'publish/remove',
],
},
FAQ: {
FAQ: [
"faq/what",
"faq/highlights",
"faq/hassio_only",
"faq/addons",
"faq/installation",
"faq/upgrade",
"faq/initial_startup",
"faq/status_not_loaded",
"faq/custom_repositories",
"faq/limitations",
'faq/what',
'faq/highlights',
'faq/hassio_only',
'faq/addons',
'faq/installation',
'faq/upgrade',
'faq/initial_startup',
'faq/status_not_loaded',
'faq/custom_repositories',
'faq/limitations',
],
},
};
}
Loading

0 comments on commit d770c84

Please sign in to comment.