Skip to content

Commit 4408d79

Browse files
Initial commit
0 parents  commit 4408d79

33 files changed

+5603
-0
lines changed

.eslintrc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"parser": "@typescript-eslint/parser",
3+
"parserOptions": {
4+
"project": ["./tsconfig.json"]
5+
},
6+
"extends": [
7+
"@omer-x/eslint-config",
8+
"@omer-x/eslint-config/typescript"
9+
],
10+
"rules": {
11+
}
12+
}

.github/workflows/npm-publish.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Publish Package to npm
2+
on:
3+
release:
4+
types: [published]
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
# Setup .npmrc file to publish to npm
11+
- uses: actions/setup-node@v4
12+
with:
13+
node-version: '20.x'
14+
registry-url: 'https://registry.npmjs.org'
15+
- run: npm ci
16+
# - run: npm test
17+
- run: npm run build
18+
- run: npm publish
19+
env:
20+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Omer Mecitoglu
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# OpenAPI Interface Generator
2+
3+
Provides an npm command to generate TypeScript code for services defined in a source JSON file.
4+
5+
## Installation
6+
7+
```bash
8+
npm install @omer-x/ts-openapi-interface-generator
9+
```
10+
11+
## Usage
12+
13+
1. Ensure you have a `source.json` file in the root directory of your project with the following structure:
14+
15+
```json
16+
{
17+
"services": [
18+
{
19+
"name": "ExampleService",
20+
"url": "https://example.com/api",
21+
"specs": "/swagger"
22+
}
23+
]
24+
}
25+
```
26+
27+
2. Run the following command to generate code for each service defined in `source.json`:
28+
29+
```bash
30+
npx generate-service-interfaces
31+
```
32+
33+
This will generate code in the `src` folder for each service.
34+
35+
## Configuration
36+
37+
You can customize the source JSON file by specifying additional properties for each service:
38+
39+
- `name`: The name of the service.
40+
- `url`: The URL of the service.
41+
- `specs` (optional): The path to the OpenAPI specifications. Default value is "/swagger".
42+
43+
## License
44+
45+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

global.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare module "*.hbs" {
2+
const content: string;
3+
export default content;
4+
}

0 commit comments

Comments
 (0)