mirror of
https://github.com/revanced/revanced-static-api.git
synced 2025-04-29 22:24:37 +02:00
feat: Rename types
key to generators
This commit is contained in:
parent
046fb6991a
commit
75eccddc5b
@ -7,7 +7,7 @@ Repository to host a static API using GitHub workflows.
|
|||||||
When CI is ran, static files are generated and commited to the `gh-pages` branch.
|
When CI is ran, static files are generated and commited to the `gh-pages` branch.
|
||||||
The file `generator.py` provides a list of static file generator classes. Each class has a name.
|
The file `generator.py` provides a list of static file generator classes. Each class has a name.
|
||||||
The configuration file `config.json` is read which contains the configuration for the API.
|
The configuration file `config.json` is read which contains the configuration for the API.
|
||||||
By specifying the name of the generator in the `types` array of the configuration, the corresponding generator will be used. The current object of the configuration is passed to the generator.
|
By specifying the name of the generator in the `generators` array of the configuration, the corresponding generator will be used. The current object of the configuration is passed to the generator.
|
||||||
|
|
||||||
The following API configuration generates the `contributor` and `release` API for selected repositories:
|
The following API configuration generates the `contributor` and `release` API for selected repositories:
|
||||||
|
|
||||||
@ -15,7 +15,7 @@ The following API configuration generates the `contributor` and `release` API fo
|
|||||||
{
|
{
|
||||||
"api": [
|
"api": [
|
||||||
{
|
{
|
||||||
"types": ["release", "contributor"],
|
"generators": ["release", "contributor"],
|
||||||
"repositories": ["user/repo"]
|
"repositories": ["user/repo"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"api": [
|
"api": [
|
||||||
{
|
{
|
||||||
"types": [
|
"generators": [
|
||||||
"release+contributor"
|
"release+contributor"
|
||||||
],
|
],
|
||||||
"repositories": [
|
"repositories": [
|
||||||
@ -9,7 +9,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"types": [
|
"generators": [
|
||||||
"social"
|
"social"
|
||||||
],
|
],
|
||||||
"socials": {
|
"socials": {
|
||||||
@ -17,13 +17,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"types": [
|
"generators": [
|
||||||
"team"
|
"team"
|
||||||
],
|
],
|
||||||
"organization": "yourorg"
|
"organization": "yourorg"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"types": [
|
"generators": [
|
||||||
"donation"
|
"donation"
|
||||||
],
|
],
|
||||||
"links": {
|
"links": {
|
||||||
|
8
main.py
8
main.py
@ -9,8 +9,8 @@ apis = config["api"]
|
|||||||
api_provider = DefaultApiProvider()
|
api_provider = DefaultApiProvider()
|
||||||
|
|
||||||
for api in apis:
|
for api in apis:
|
||||||
for type in api["types"]:
|
for generator_name in api["generators"]:
|
||||||
api_type = api_provider.get(type)
|
generator = api_provider.get(generator_name)
|
||||||
if api_type is None:
|
if generator is None:
|
||||||
continue
|
continue
|
||||||
api_type.generate(api, output)
|
generator.generate(api, output)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user