@hous3-digital/vesta-sdk 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +111 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/package.json +52 -0
package/README.md
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# SDK (Pacote) — Desenvolvimento e Uso
|
|
2
|
+
|
|
3
|
+
Este `README` descreve o **pacote SDK** que vive em `app/`: como configurar, desenvolver, testar e consumir.
|
|
4
|
+
|
|
5
|
+
Para documentação do repositório/template (fluxo de contribuição e CI/CD), veja `../README.md`.
|
|
6
|
+
|
|
7
|
+
## 1) Configuração inicial do pacote
|
|
8
|
+
|
|
9
|
+
1. Renomeie `package.json.example` para `package.json`.
|
|
10
|
+
2. Ajuste os campos principais:
|
|
11
|
+
- `name` no escopo da organização (ex.: `@hous3-digital/nome-do-pacote`)
|
|
12
|
+
- `description`
|
|
13
|
+
- `repository`, `author`, `bugs`, `homepage`
|
|
14
|
+
|
|
15
|
+
## 2) Estrutura do pacote
|
|
16
|
+
|
|
17
|
+
```text
|
|
18
|
+
app/
|
|
19
|
+
├── src/
|
|
20
|
+
│ └── index.ts # API pública do pacote
|
|
21
|
+
├── __test__/
|
|
22
|
+
│ └── index.test.ts # Testes unitários
|
|
23
|
+
├── jest.config.js
|
|
24
|
+
├── tsconfig.json
|
|
25
|
+
├── tsconfig.eslint.json
|
|
26
|
+
├── eslint.config.mjs
|
|
27
|
+
└── package.json
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## 3) Desenvolvimento local
|
|
31
|
+
|
|
32
|
+
### Scripts
|
|
33
|
+
|
|
34
|
+
- `yarn build`: compila TypeScript para `dist/`
|
|
35
|
+
- `yarn test`: executa testes
|
|
36
|
+
- `yarn test:watch`: testes em modo watch
|
|
37
|
+
- `yarn test:coverage`: cobertura de testes
|
|
38
|
+
- `yarn lint`: valida lint
|
|
39
|
+
- `yarn lint:fix`: corrige lint automaticamente
|
|
40
|
+
|
|
41
|
+
### Fluxo recomendado
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
yarn
|
|
45
|
+
yarn lint
|
|
46
|
+
yarn build
|
|
47
|
+
yarn test
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## 4) Como um dev externo instala e usa o SDK
|
|
51
|
+
|
|
52
|
+
### Pré-requisitos
|
|
53
|
+
|
|
54
|
+
- Node.js 22+
|
|
55
|
+
- npm ou yarn
|
|
56
|
+
- Token GitHub com `read:packages`
|
|
57
|
+
|
|
58
|
+
### Autenticação para GitHub Packages
|
|
59
|
+
|
|
60
|
+
No projeto consumidor, crie `.npmrc`:
|
|
61
|
+
|
|
62
|
+
```ini
|
|
63
|
+
@hous3-digital:registry=https://npm.pkg.github.com
|
|
64
|
+
//npm.pkg.github.com/:_authToken=SEU_GITHUB_TOKEN
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Instalação
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
npm install @hous3-digital/nome-do-pacote
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
ou
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
yarn add @hous3-digital/nome-do-pacote
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Primeiro uso
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
import { suaFuncao } from '@hous3-digital/nome-do-pacote';
|
|
83
|
+
|
|
84
|
+
const resultado = suaFuncao();
|
|
85
|
+
console.log(resultado);
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## 5) Publicação do pacote
|
|
89
|
+
|
|
90
|
+
A publicação acontece via pipeline do repositório (não manualmente no dev local):
|
|
91
|
+
|
|
92
|
+
1. Merge em `staging` gera pre-release.
|
|
93
|
+
2. Promoção de release para `main` dispara release final.
|
|
94
|
+
3. Publicação no GitHub Packages (e opcionalmente npmjs.com).
|
|
95
|
+
|
|
96
|
+
## 6) Troubleshooting rápido
|
|
97
|
+
|
|
98
|
+
### Testes falhando
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
yarn
|
|
102
|
+
yarn build
|
|
103
|
+
yarn test
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Erros de lint
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
yarn lint
|
|
110
|
+
yarn lint:fix
|
|
111
|
+
```
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,wBAAgB,UAAU,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAKhD"}
|
package/dist/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hous3-digital/vesta-sdk",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "SKD Vesta para integração com a API da Vesta",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"test": "jest",
|
|
10
|
+
"test:watch": "jest --watch",
|
|
11
|
+
"test:coverage": "jest --coverage",
|
|
12
|
+
"lint": "eslint src __test__ --ext .ts",
|
|
13
|
+
"lint:fix": "eslint src __test__ --ext .ts --fix"
|
|
14
|
+
},
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/hous3-digital/vesta-sdk.git"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [],
|
|
20
|
+
"author": "Hous3 Digital",
|
|
21
|
+
"license": "ISC",
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/hous3-digital/vesta-sdk/issues"
|
|
24
|
+
},
|
|
25
|
+
"homepage": "https://github.com/hous3-digital/vesta-sdk#readme",
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@eslint/eslintrc": "^3.3.5",
|
|
28
|
+
"@eslint/js": "^10.0.1",
|
|
29
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
30
|
+
"@semantic-release/commit-analyzer": "^13.0.1",
|
|
31
|
+
"@semantic-release/git": "^10.0.1",
|
|
32
|
+
"@semantic-release/github": "^12.0.6",
|
|
33
|
+
"@semantic-release/npm": "^13.1.5",
|
|
34
|
+
"@semantic-release/release-notes-generator": "^14.1.0",
|
|
35
|
+
"@types/jest": "^30.0.0",
|
|
36
|
+
"@typescript-eslint/eslint-plugin": "^8.59.2",
|
|
37
|
+
"@typescript-eslint/parser": "^8.59.2",
|
|
38
|
+
"eslint": "^10.3.0",
|
|
39
|
+
"globals": "^17.6.0",
|
|
40
|
+
"jest": "^29.7.0",
|
|
41
|
+
"ts-jest": "^29.1.0",
|
|
42
|
+
"typescript": "^6.0.3"
|
|
43
|
+
},
|
|
44
|
+
"files": [
|
|
45
|
+
"dist"
|
|
46
|
+
],
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"registry": "https://npm.pkg.github.com/",
|
|
49
|
+
"access": "restricted"
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {}
|
|
52
|
+
}
|