|
1 |
| -# Get Started |
2 |
| - |
3 |
| -There are two ways of using this reverse proxy: _as a library or as a CLI._ |
4 |
| - |
5 |
| -## Library |
6 |
| - |
7 |
| -Given the npm package is installed: |
8 |
| - |
9 |
| -```ts |
10 |
| -import type { TlsConfig } from '@stacksjs/rpx' |
11 |
| -import { startProxy } from '@stacksjs/rpx' |
12 |
| - |
13 |
| -export interface CleanupConfig { |
14 |
| - hosts: boolean // clean up /etc/hosts, defaults to false |
15 |
| - certs: boolean // clean up certificates, defaults to false |
16 |
| -} |
17 |
| - |
18 |
| -export interface ReverseProxyConfig { |
19 |
| - from: string // domain to proxy from, defaults to localhost:3000 |
20 |
| - to: string // domain to proxy to, defaults to stacks.localhost |
21 |
| - cleanUrls?: boolean // removes the .html extension from URLs, defaults to false |
22 |
| - https: boolean | TlsConfig // automatically uses https, defaults to true, also redirects http to https |
23 |
| - cleanup?: boolean | CleanupConfig // automatically cleans up /etc/hosts, defaults to false |
24 |
| - verbose: boolean // log verbose output, defaults to false |
25 |
| -} |
26 |
| - |
27 |
| -const config: ReverseProxyOptions = { |
28 |
| - from: 'localhost:3000', |
29 |
| - to: 'my-docs.localhost', |
30 |
| - cleanUrls: true, |
31 |
| - https: true, |
32 |
| - cleanup: false, |
33 |
| -} |
34 |
| - |
35 |
| -startProxy(config) |
36 |
| -``` |
37 |
| - |
38 |
| -In case you are trying to start multiple proxies, you may use this configuration: |
39 |
| - |
40 |
| -```ts |
41 |
| -// reverse-proxy.config.{ts,js} |
42 |
| -import type { ReverseProxyOptions } from '@stacksjs/rpx' |
43 |
| -import os from 'node:os' |
44 |
| -import path from 'node:path' |
45 |
| - |
46 |
| -const config: ReverseProxyOptions = { |
47 |
| - https: { // https: true -> also works with sensible defaults |
48 |
| - caCertPath: path.join(os.homedir(), '.stacks', 'ssl', `stacks.localhost.ca.crt`), |
49 |
| - certPath: path.join(os.homedir(), '.stacks', 'ssl', `stacks.localhost.crt`), |
50 |
| - keyPath: path.join(os.homedir(), '.stacks', 'ssl', `stacks.localhost.crt.key`), |
51 |
| - }, |
52 |
| - |
53 |
| - cleanup: { |
54 |
| - hosts: true, |
55 |
| - certs: false, |
56 |
| - }, |
57 |
| - |
58 |
| - proxies: [ |
59 |
| - { |
60 |
| - from: 'localhost:5173', |
61 |
| - to: 'my-app.localhost', |
62 |
| - cleanUrls: true, |
63 |
| - }, |
64 |
| - { |
65 |
| - from: 'localhost:5174', |
66 |
| - to: 'my-api.local', |
67 |
| - }, |
68 |
| - ], |
69 |
| - |
70 |
| - verbose: true, |
71 |
| -} |
72 |
| - |
73 |
| -export default config |
74 |
| -``` |
75 |
| - |
76 |
| -## CLI |
77 |
| - |
78 |
| -```bash |
79 |
| -rpx --from localhost:3000 --to my-project.localhost |
80 |
| -rpx --from localhost:8080 --to my-project.test --keyPath ./key.pem --certPath ./cert.pem |
81 |
| -rpx --help |
82 |
| -rpx --version |
83 |
| -``` |
84 |
| - |
85 |
| -## Testing |
86 |
| - |
87 |
| -```bash |
88 |
| -bun test |
89 |
| -``` |
90 |
| - |
91 | 1 | # Usage
|
92 | 2 |
|
93 | 3 | GitLint is designed to be simple to use while providing powerful validation capabilities. Here are the different ways you can use GitLint in your workflow.
|
@@ -115,11 +25,20 @@ echo "feat: add new feature" | gitlint
|
115 | 25 | GitLint supports several command-line options:
|
116 | 26 |
|
117 | 27 | ```bash
|
| 28 | +# Validate a commit message file |
| 29 | +gitlint .git/COMMIT_EDITMSG |
| 30 | + |
118 | 31 | # Enable verbose output
|
119 | 32 | gitlint --verbose
|
120 | 33 |
|
121 | 34 | # Use a custom configuration file
|
122 | 35 | gitlint --config path/to/gitlint.config.js
|
| 36 | + |
| 37 | +# Show version information |
| 38 | +gitlint --version |
| 39 | + |
| 40 | +# Display help information |
| 41 | +gitlint --help |
123 | 42 | ```
|
124 | 43 |
|
125 | 44 | ### Examples
|
@@ -182,6 +101,12 @@ GitLint uses the following exit codes:
|
182 | 101 | - `1`: Commit message has validation errors
|
183 | 102 | - `2`: An internal error occurred during validation
|
184 | 103 |
|
| 104 | +## Testing |
| 105 | + |
| 106 | +```bash |
| 107 | +bun test |
| 108 | +``` |
| 109 | + |
185 | 110 | ## Next Steps
|
186 | 111 |
|
187 | 112 | To customize GitLint's behavior for your project, check out the [Configuration](/config) guide.
|
0 commit comments