Skip to content

Commit 6cb8c49

Browse files
authored
Feat/decap (#45)
* Add decap configuration * Refactor snippet-intro.mdx to emphasize DRY principle in documentation
1 parent aa5dea5 commit 6cb8c49

File tree

14 files changed

+637
-0
lines changed

14 files changed

+637
-0
lines changed
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Process Connection Changes
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- 'store/connections/*.yml'
8+
workflow_dispatch: # Para testar manualmente
9+
10+
jobs:
11+
process-connections:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
with:
18+
token: ${{ secrets.GITHUB_TOKEN }}
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: '18'
24+
25+
- name: Install dependencies
26+
run: |
27+
npm install -g js-yaml mustache
28+
29+
- name: Process connection files
30+
run: |
31+
# Criar script para processar as conexões
32+
cat << 'EOF' > process_connections.js
33+
const fs = require('fs');
34+
const yaml = require('js-yaml');
35+
const mustache = require('mustache');
36+
const path = require('path');
37+
38+
// Ler template
39+
const template = fs.readFileSync('templates/connection-template.mdx', 'utf8');
40+
41+
// Processar todos os YAMLs
42+
const connectionsDir = 'store/connections';
43+
const outputDir = 'connections';
44+
const connections = [];
45+
46+
// Garantir que o diretório de saída existe
47+
if (!fs.existsSync(outputDir)) {
48+
fs.mkdirSync(outputDir, { recursive: true });
49+
}
50+
51+
// Ler todos os arquivos YAML
52+
const files = fs.readdirSync(connectionsDir).filter(file => file.endsWith('.yml'));
53+
54+
files.forEach(file => {
55+
try {
56+
const filePath = path.join(connectionsDir, file);
57+
const yamlContent = fs.readFileSync(filePath, 'utf8');
58+
const connection = yaml.load(yamlContent);
59+
60+
// Adicionar à lista de conexões
61+
connections.push(connection);
62+
63+
// Gerar MDX usando template
64+
const mdxContent = mustache.render(template, connection);
65+
const outputFile = path.join(outputDir, `${connection.id}.mdx`);
66+
fs.writeFileSync(outputFile, mdxContent);
67+
68+
console.log(`Generated: ${outputFile}`);
69+
} catch (error) {
70+
console.error(`Error processing ${file}:`, error);
71+
}
72+
});
73+
74+
// Atualizar JSON consolidado
75+
const jsonOutput = {
76+
connections: connections
77+
};
78+
79+
fs.writeFileSync('store/connections.json', JSON.stringify(jsonOutput, null, 2));
80+
console.log('Updated store/connections.json');
81+
82+
EOF
83+
84+
node process_connections.js
85+
86+
- name: Commit and push changes
87+
run: |
88+
git config --local user.email "[email protected]"
89+
git config --local user.name "GitHub Action"
90+
git add connections/*.mdx store/connections.json
91+
git diff --staged --quiet || git commit -m "Auto-generate connection docs from YAML [skip ci]"
92+
git push

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
*.DS_Store
2+
3+
/node_modules

admin/config.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
backend:
2+
name: git-gateway
3+
branch: main
4+
5+
media_folder: "images/uploads"
6+
public_folder: "/images/uploads"
7+
8+
collections:
9+
- name: "connections"
10+
label: "Connections"
11+
folder: "store/connections"
12+
create: true
13+
slug: "{{id}}"
14+
extension: "yml"
15+
format: "yaml"
16+
fields:
17+
- { label: "ID", name: "id", widget: "string", hint: "Identificador único (ex: mongodb, postgresql)" }
18+
- { label: "Nome", name: "name", widget: "string" }
19+
- { label: "Descrição", name: "description", widget: "text" }
20+
- {
21+
label: "Categoria",
22+
name: "category",
23+
widget: "select",
24+
options: ["databases", "container-platforms", "developer-consoles", "infrastructure-access", "network-services"]
25+
}
26+
- {
27+
label: "Tags",
28+
name: "tags",
29+
widget: "list",
30+
allow_add: true,
31+
collapsed: false,
32+
field: { label: "Tag", name: "tag", widget: "string" }
33+
}
34+
- { label: "Novo", name: "isNew", widget: "boolean", default: false }
35+
- {
36+
label: "Connection String",
37+
name: "connectionString",
38+
widget: "text",
39+
hint: "Exemplo de string de conexão com placeholders"
40+
}
41+
- {
42+
label: "Métodos de Conexão",
43+
name: "methods",
44+
widget: "list",
45+
allow_add: true,
46+
collapsed: false,
47+
field: { label: "Método", name: "method", widget: "string" }
48+
}
49+
- {
50+
label: "Comando de Setup",
51+
name: "setupCommand",
52+
widget: "text",
53+
hint: "Comando CLI para configurar a conexão"
54+
}
55+
- {
56+
label: "Requisitos",
57+
name: "requirements",
58+
widget: "list",
59+
allow_add: true,
60+
collapsed: false,
61+
field: { label: "Requisito", name: "requirement", widget: "string" }
62+
}

admin/index.html

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<meta charset="utf-8" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<meta name="robots" content="noindex" />
8+
<title>Hoop.dev Documentation - Content Management</title>
9+
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
10+
</head>
11+
12+
<body>
13+
<!-- Include the script that builds the page and powers Decap CMS -->
14+
<script src="https://unpkg.com/decap-cms@^3.0.0/dist/decap-cms.js"></script>
15+
16+
<!-- Custom initialization if needed -->
17+
<script>
18+
// Initialize Decap CMS
19+
if (typeof CMS !== 'undefined') {
20+
CMS.init();
21+
22+
// Add any custom configurations here
23+
console.log('Decap CMS initialized for Hoop.dev Documentation');
24+
}
25+
</script>
26+
</body>
27+
28+
</html>

connections/mongodb.mdx

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
title: "MongoDB"
3+
description: "Banco de dados NoSQL orientado a documentos"
4+
category: "databases"
5+
---
6+
7+
import Prerequisites from '/snippets/QuickstartsPrerequisites.mdx';
8+
9+
<Prerequisites />
10+
11+
12+
## Visão Geral
13+
14+
Banco de dados NoSQL orientado a documentos
15+
16+
## Categoria
17+
**databases**
18+
19+
## Tags
20+
- nosql
21+
- document
22+
- cloud
23+
24+
## Características
25+
26+
### Métodos de Conexão Suportados
27+
- Web App
28+
### Métodos de Conexão Suportados
29+
- CLI
30+
### Métodos de Conexão Suportados
31+
- Runbooks
32+
### Métodos de Conexão Suportados
33+
- Desktop App
34+
35+
## Configuração
36+
37+
### String de Conexão
38+
```
39+
mongodb:&#x2F;&#x2F;username:password@host:port&#x2F;database
40+
```
41+
42+
### Comando de Setup
43+
```bash
44+
hoop admin add resource-name --type mongodb --agent &lt;agent-name&gt; -e CONNECTION_STRING&#x3D;&#39;mongodb:&#x2F;&#x2F;user:pass@host:27017&#x2F;dbname&#39;
45+
```
46+
47+
## Requisitos
48+
49+
- MongoDB Server 4.0+
50+
- Credenciais de usuário
51+
- Conectividade de rede
52+
53+
## Próximos Passos
54+
55+
Após configurar esta conexão, você poderá:
56+
- Acessar via Web App do Hoop.dev
57+
- Utilizar o CLI para automações
58+
- Configurar políticas de acesso
59+
- Implementar mascaramento de dados (se aplicável)
60+
61+
Para mais informações sobre como usar esta conexão, consulte nossa [documentação completa](/) ou entre em contato com nossa equipe de suporte.

connections/postgresql.mdx

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
title: "PostgreSQL"
3+
description: "Banco de dados relacional open-source avançado"
4+
category: "databases"
5+
---
6+
7+
import Prerequisites from '/snippets/QuickstartsPrerequisites.mdx';
8+
9+
<Prerequisites />
10+
11+
12+
## Visão Geral
13+
14+
Banco de dados relacional open-source avançado
15+
16+
## Categoria
17+
**databases**
18+
19+
## Tags
20+
- sql
21+
- relational
22+
- open-source
23+
24+
## Características
25+
26+
### Métodos de Conexão Suportados
27+
- Web App
28+
### Métodos de Conexão Suportados
29+
- CLI
30+
### Métodos de Conexão Suportados
31+
- Runbooks
32+
33+
## Configuração
34+
35+
### String de Conexão
36+
```
37+
postgresql:&#x2F;&#x2F;username:password@host:port&#x2F;database
38+
```
39+
40+
### Comando de Setup
41+
```bash
42+
hoop admin add resource-name --type postgresql --agent &lt;agent-name&gt; -e CONNECTION_STRING&#x3D;&#39;postgresql:&#x2F;&#x2F;user:pass@localhost:5432&#x2F;database&#39;
43+
```
44+
45+
## Requisitos
46+
47+
- PostgreSQL Server 12+
48+
- Usuário com privilégios adequados
49+
- Porta 5432 acessível
50+
51+
## Próximos Passos
52+
53+
Após configurar esta conexão, você poderá:
54+
- Acessar via Web App do Hoop.dev
55+
- Utilizar o CLI para automações
56+
- Configurar políticas de acesso
57+
- Implementar mascaramento de dados (se aplicável)
58+
59+
Para mais informações sobre como usar esta conexão, consulte nossa [documentação completa](/) ou entre em contato com nossa equipe de suporte.

connections/redis.mdx

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
title: "Redis"
3+
description: "Banco de dados em memória de alta performance para cache e armazenamento de dados"
4+
category: "databases"
5+
---
6+
7+
import Prerequisites from '/snippets/QuickstartsPrerequisites.mdx';
8+
9+
<Prerequisites />
10+
11+
<Info>
12+
Esta é uma nova conexão disponível na plataforma Hoop.dev!
13+
</Info>
14+
15+
## Visão Geral
16+
17+
Banco de dados em memória de alta performance para cache e armazenamento de dados
18+
19+
## Categoria
20+
**databases**
21+
22+
## Tags
23+
- cache
24+
- in-memory
25+
- key-value
26+
- nosql
27+
28+
## Características
29+
30+
### Métodos de Conexão Suportados
31+
- Web App
32+
### Métodos de Conexão Suportados
33+
- CLI
34+
### Métodos de Conexão Suportados
35+
- Runbooks
36+
37+
## Configuração
38+
39+
### String de Conexão
40+
```
41+
redis:&#x2F;&#x2F;username:password@host:port&#x2F;database
42+
```
43+
44+
### Comando de Setup
45+
```bash
46+
hoop admin add resource-name --type redis --agent &lt;agent-name&gt; -e CONNECTION_STRING&#x3D;&#39;redis:&#x2F;&#x2F;user:pass@localhost:6379&#x2F;0&#39;
47+
```
48+
49+
## Requisitos
50+
51+
- Redis Server 6.0+
52+
- Credenciais de acesso (se habilitado AUTH)
53+
- Porta 6379 acessível
54+
- Conectividade de rede
55+
56+
## Próximos Passos
57+
58+
Após configurar esta conexão, você poderá:
59+
- Acessar via Web App do Hoop.dev
60+
- Utilizar o CLI para automações
61+
- Configurar políticas de acesso
62+
- Implementar mascaramento de dados (se aplicável)
63+
64+
Para mais informações sobre como usar esta conexão, consulte nossa [documentação completa](/) ou entre em contato com nossa equipe de suporte.

0 commit comments

Comments
 (0)