galbe 0.6.0 → 0.6.1
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/.github/ISSUE_TEMPLATE/bug_report.md +35 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +23 -0
- package/.github/workflows/deploy_website.yml +1 -1
- package/README.md +2 -0
- package/bin/cli.ts +2 -0
- package/bin/commands/info.ts +29 -0
- package/docs/CONTRIBUTING.md +105 -0
- package/docs/cli.md +19 -15
- package/package.json +1 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Create a report to help us improve
|
|
4
|
+
title: '[bug] '
|
|
5
|
+
labels: bug
|
|
6
|
+
assignees: ''
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
**Describe the bug**
|
|
10
|
+
|
|
11
|
+
<!-- A clear and concise description of what the bug is. -->
|
|
12
|
+
|
|
13
|
+
**Steps To Reproduce**
|
|
14
|
+
|
|
15
|
+
<!-- Steps to reproduce the behavior -->
|
|
16
|
+
|
|
17
|
+
**Expected behavior**
|
|
18
|
+
|
|
19
|
+
<!-- A clear and concise description of what you expected to happen. -->
|
|
20
|
+
|
|
21
|
+
**Screenshots**
|
|
22
|
+
|
|
23
|
+
<!-- If applicable, add screenshots to help explain your problem. -->
|
|
24
|
+
|
|
25
|
+
**Environment (please complete the following information):**
|
|
26
|
+
|
|
27
|
+
<!-- To help us diagnose the issue, please navigate to the root of your project in your terminal and execute "bunx galbe info". Then paste the output bellow -->
|
|
28
|
+
|
|
29
|
+
```txt
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Additional context**
|
|
34
|
+
|
|
35
|
+
<!-- Add any other context about the problem here. -->
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Suggest an idea for this project
|
|
4
|
+
title: '[feat] '
|
|
5
|
+
labels: enhancement
|
|
6
|
+
assignees: ''
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
**Is your feature request related to a problem? Please describe.**
|
|
10
|
+
|
|
11
|
+
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
|
|
12
|
+
|
|
13
|
+
**Describe the solution you'd like**
|
|
14
|
+
|
|
15
|
+
<!-- A clear and concise description of what you want to happen. -->
|
|
16
|
+
|
|
17
|
+
**Describe alternatives you've considered**
|
|
18
|
+
|
|
19
|
+
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
|
|
20
|
+
|
|
21
|
+
**Additional context**
|
|
22
|
+
|
|
23
|
+
<!-- Add any other context or screenshots about the feature request here. -->
|
|
@@ -16,5 +16,5 @@ jobs:
|
|
|
16
16
|
-H "Accept: application/vnd.github+json" \
|
|
17
17
|
-H "Authorization: Bearer ${{ secrets.GH_WEBSITE_TOKEN }}" \
|
|
18
18
|
-H "X-GitHub-Api-Version: 2022-11-28" \
|
|
19
|
-
https://api.github.com/repos/pierre-cm/galbe-website/actions/workflows/
|
|
19
|
+
https://api.github.com/repos/pierre-cm/galbe-website/actions/workflows/static.yml/dispatches \
|
|
20
20
|
-d '{"ref":"main"}'
|
package/README.md
CHANGED
package/bin/cli.ts
CHANGED
|
@@ -7,11 +7,13 @@ import { pckg } from './util'
|
|
|
7
7
|
import dev from './commands/dev'
|
|
8
8
|
import build from './commands/build'
|
|
9
9
|
import generate from './commands/generate'
|
|
10
|
+
import info from './commands/info'
|
|
10
11
|
|
|
11
12
|
program.name('galbe').description(pckg.description).version(pckg.version)
|
|
12
13
|
|
|
13
14
|
dev(program.command('dev'))
|
|
14
15
|
build(program.command('build'))
|
|
15
16
|
generate(program.command('generate'))
|
|
17
|
+
info(program.command('info'))
|
|
16
18
|
|
|
17
19
|
program.parse()
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import os from 'os'
|
|
2
|
+
import { Command } from 'commander'
|
|
3
|
+
|
|
4
|
+
export default async (cmd: Command) => {
|
|
5
|
+
cmd.description('print informations about the current os, bun and galbe version').action(async () => {
|
|
6
|
+
const osName = os.type()
|
|
7
|
+
const osArch = os.arch()
|
|
8
|
+
const osVersion = os.release()
|
|
9
|
+
|
|
10
|
+
const bunVersion = Bun.version
|
|
11
|
+
const bunRevision = Bun.revision
|
|
12
|
+
|
|
13
|
+
let localPckg: any = {}
|
|
14
|
+
try {
|
|
15
|
+
localPckg = await Bun.file('./node_modules/galbe/package.json').json()
|
|
16
|
+
} catch (err) {}
|
|
17
|
+
const galbeVersion = localPckg?.version || 'not found'
|
|
18
|
+
|
|
19
|
+
console.log('OS')
|
|
20
|
+
console.log(` name: ${osName}`)
|
|
21
|
+
console.log(` arch: ${osArch}`)
|
|
22
|
+
console.log(` version: ${osVersion}`)
|
|
23
|
+
console.log('Bun')
|
|
24
|
+
console.log(` version: ${bunVersion}`)
|
|
25
|
+
console.log(` revision: ${bunRevision}`)
|
|
26
|
+
console.log('Galbe')
|
|
27
|
+
console.log(` version: ${galbeVersion}`)
|
|
28
|
+
})
|
|
29
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Contributing to Galbe
|
|
2
|
+
|
|
3
|
+
First off, thank you for considering contributing to our project! We appreciate your time and effort and want to make this as easy and transparent as possible for everyone.
|
|
4
|
+
|
|
5
|
+
## Create an Issue
|
|
6
|
+
|
|
7
|
+
If you encounter a bug, want to propose a new feature, or something that could be improved, please create an issue. Here's how:
|
|
8
|
+
|
|
9
|
+
1. **Check Existing Issues**: Before creating a new issue, please search the [existing issues](https://github.com/pierre-cm/galbe/issues) to see if someone else has already reported the same problem or suggested the same feature.
|
|
10
|
+
|
|
11
|
+
2. **Open a New Issue**: If your issue is new, [open a new issue](https://github.com/pierre-cm/galbe/issues/new/choose) and provide the following details:
|
|
12
|
+
|
|
13
|
+
- **Title**: A concise summary of the issue.
|
|
14
|
+
- **Description**: A detailed description of the problem or suggestion. Include steps to reproduce the issue if applicable.
|
|
15
|
+
- **Screenshots**: If possible, include screenshots or other visual aids that help explain the issue.
|
|
16
|
+
- **Environment**: Mention the environment in which you encountered the issue (e.g., OS, Bun version).
|
|
17
|
+
- **Labels**: Assign appropriate labels (e.g., bug, enhancement) to help categorize your issue.
|
|
18
|
+
|
|
19
|
+
3. **Follow Up**: Once your issue is submitted, be ready to provide additional information if requested. We'll do our best to address the issue promptly.
|
|
20
|
+
|
|
21
|
+
## Create a Pull Request
|
|
22
|
+
|
|
23
|
+
### 1. Fork the Repository
|
|
24
|
+
|
|
25
|
+
If you haven't already, [fork Galbe's repository on GitHub](https://github.com/pierre-cm/galbe/fork). This will create a copy of this repository under your GitHub account.
|
|
26
|
+
|
|
27
|
+
### 2. Clone Your Fork
|
|
28
|
+
|
|
29
|
+
Clone the forked repository to your local machine:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
git clone https://github.com/<your-username>/galbe.git
|
|
33
|
+
cd galbe
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### 3. Create a New Branch
|
|
37
|
+
|
|
38
|
+
Before making any changes, create a new branch for your work. Branches help keep your changes separate from the main branch and make it easier to review and merge:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
git checkout -b feature/your-feature-name
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Use a descriptive name for your branch to indicate what you are working on.
|
|
45
|
+
|
|
46
|
+
### 4. Make Your Changes
|
|
47
|
+
|
|
48
|
+
Make the necessary changes in your branch. Be sure to follow the project's coding style and best practices.
|
|
49
|
+
|
|
50
|
+
### 5. Commit Your Changes
|
|
51
|
+
|
|
52
|
+
Once you’ve made your changes, commit them with a clear and descriptive message:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
git add .
|
|
56
|
+
git commit -m "Add feature X to do Y"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 6. Push to Your Fork
|
|
60
|
+
|
|
61
|
+
Push your changes to your forked repository on GitHub:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
git push origin feature/your-feature-name
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 7. Create a Pull Request
|
|
68
|
+
|
|
69
|
+
Once your changes are pushed to GitHub, you can create a pull request. Go to the [original repository](https://github.com/pierre-cm/galbe) on GitHub, and you should see an option to create a pull request from your branch.
|
|
70
|
+
|
|
71
|
+
- Make sure to provide a detailed description of your changes and why they are necessary.
|
|
72
|
+
- Link any related issues if applicable.
|
|
73
|
+
- If your pull request is still a work in progress, mark it as a draft to let others know that you are not yet ready for a review.
|
|
74
|
+
|
|
75
|
+
### 8. Respond to Feedback
|
|
76
|
+
|
|
77
|
+
Once your pull request is submitted, it will be reviewed by the project maintainers. They may ask for changes or provide feedback. Please be responsive and make the necessary adjustments.
|
|
78
|
+
|
|
79
|
+
### Coding Standards
|
|
80
|
+
|
|
81
|
+
Please follow these coding standards to ensure consistency across the project:
|
|
82
|
+
|
|
83
|
+
- **Code Style**: Follow the [style guide]().
|
|
84
|
+
- **Commit Messages**: Use clear and descriptive commit messages.
|
|
85
|
+
- **Documentation**: Update documentation where applicable. This includes comments in the code and other documentation files under the `docs` directory.
|
|
86
|
+
|
|
87
|
+
## Code of Conduct
|
|
88
|
+
|
|
89
|
+
We are committed to creating a welcoming and inclusive environment for everyone. To ensure this, all contributors are expected to adhere to the following guidelines:
|
|
90
|
+
|
|
91
|
+
1. **Be Respectful**: Treat everyone with respect. Disagreements are inevitable, but it's important to remain courteous and constructive. Personal attacks, harassment, or offensive comments will not be tolerated.
|
|
92
|
+
|
|
93
|
+
2. **Collaborate Openly**: Collaboration is key to the success of the project. Be open to feedback and suggestions from others. Constructive criticism should be welcomed and given in a positive manner.
|
|
94
|
+
|
|
95
|
+
3. **Resolve Disagreements Constructively**: If you find yourself in a disagreement, seek to resolve it in a way that is constructive and respectful. If necessary, involve a project maintainer to help mediate.
|
|
96
|
+
|
|
97
|
+
4. **Report Issues**: If you witness or experience any behavior that violates this Code of Conduct, please report it immediately to the project maintainers. We take all reports seriously and will address them promptly.
|
|
98
|
+
|
|
99
|
+
By participating in this project, you agree to abide by this Code of Conduct.
|
|
100
|
+
|
|
101
|
+
## Getting Help
|
|
102
|
+
|
|
103
|
+
If you have any questions or need help, feel free to open an issue or contact one of the maintainers.
|
|
104
|
+
|
|
105
|
+
Thank you for your contribution!
|
package/docs/cli.md
CHANGED
|
@@ -12,7 +12,7 @@ Install it globally using the following command:
|
|
|
12
12
|
$ bun install -g galbe
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Or run it with `bunx`:
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
18
|
$ bunx galbe
|
|
@@ -38,16 +38,19 @@ Start a dev server running your Galbe application.
|
|
|
38
38
|
|
|
39
39
|
#### Example
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
// index.js
|
|
41
|
+
index.js
|
|
43
42
|
|
|
43
|
+
```js
|
|
44
44
|
import { Galbe } from 'galbe'
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
const g = new Galbe()
|
|
47
|
+
g.get('example', () => '')
|
|
48
|
+
|
|
49
|
+
export default g
|
|
47
50
|
```
|
|
48
51
|
|
|
49
52
|
```bash
|
|
50
|
-
$ galbe dev index.js -p 7357
|
|
53
|
+
$ galbe dev index.js -p 7357 -w
|
|
51
54
|
```
|
|
52
55
|
|
|
53
56
|
## build
|
|
@@ -66,13 +69,13 @@ Bundle your Galbe application.
|
|
|
66
69
|
| ----- | --------- | ------------------------------ | -------- |
|
|
67
70
|
| -o | --out | output directory | dist/app |
|
|
68
71
|
| -C | --compile | create a standalone executable | false |
|
|
69
|
-
| -c | --config | bun config (js or ts) |
|
|
72
|
+
| -c | --config | bun config (js or ts) | |
|
|
70
73
|
|
|
71
74
|
#### Example
|
|
72
75
|
|
|
73
|
-
|
|
74
|
-
// index.js
|
|
76
|
+
index.js
|
|
75
77
|
|
|
78
|
+
```js
|
|
76
79
|
import { Galbe } from 'galbe'
|
|
77
80
|
|
|
78
81
|
export default new Galbe()
|
|
@@ -105,7 +108,7 @@ Generate a client for your Galbe application.
|
|
|
105
108
|
|
|
106
109
|
#### Examples
|
|
107
110
|
|
|
108
|
-
Let's setup a new Galbe project:
|
|
111
|
+
Let's first setup a new Galbe project:
|
|
109
112
|
|
|
110
113
|
```bash
|
|
111
114
|
$ bun create galbe galbe-example -t hello -l ts
|
|
@@ -128,9 +131,9 @@ $ galbe generate client index.ts
|
|
|
128
131
|
This will generate a `dist/client.ts` client lib by default.
|
|
129
132
|
You can import it and use it like in the following example:
|
|
130
133
|
|
|
131
|
-
|
|
132
|
-
// client_example.ts
|
|
134
|
+
client_example.ts
|
|
133
135
|
|
|
136
|
+
```ts
|
|
134
137
|
import HelloClient from './dist/client'
|
|
135
138
|
|
|
136
139
|
const client = new HelloClient({ server: { url: 'http://localhost:3000' } })
|
|
@@ -191,8 +194,9 @@ $ ./dist/cli hello Pierre -a 29
|
|
|
191
194
|
Hello Pierre! You're 29 y.o.
|
|
192
195
|
```
|
|
193
196
|
|
|
194
|
-
> [!
|
|
195
|
-
>
|
|
197
|
+
> [!IMPORTANT]
|
|
198
|
+
> A `GCLI_SERVER_URL` environment variable must be defined. It should indicates the url of the Galbe server you want to target.
|
|
199
|
+
> In that specific case `http://localhost:3000`.
|
|
196
200
|
|
|
197
201
|
### spec
|
|
198
202
|
|
|
@@ -209,7 +213,7 @@ Generate the spec of your Galbe application.
|
|
|
209
213
|
| Short | Long | Descritpion | Default |
|
|
210
214
|
| ----- | -------- | ------------------------------------------------ | ----------------------- |
|
|
211
215
|
| -t | --target | spec target [openapi:3.0:json, openapi:3.0:yaml] | openapi:3.0:yaml |
|
|
212
|
-
| -b | --base | base spec file |
|
|
216
|
+
| -b | --base | base spec file | |
|
|
213
217
|
| -o | --out | output file | spec/api.(yaml \| json) |
|
|
214
218
|
|
|
215
219
|
#### Example
|
|
@@ -302,7 +306,7 @@ This should generate the code of our application in the `src` directory by defau
|
|
|
302
306
|
To test that the code was successfully generated, you can run:
|
|
303
307
|
|
|
304
308
|
```bash
|
|
305
|
-
$
|
|
309
|
+
$ galbe dev index.ts
|
|
306
310
|
🏗️ Constructing routes
|
|
307
311
|
|
|
308
312
|
src/routes/pet.route.ts
|
package/package.json
CHANGED