Compare commits
17 Commits
v1.3.8
...
98cd7a5edb
| Author | SHA1 | Date | |
|---|---|---|---|
| 98cd7a5edb | |||
| 3ede53ae3b | |||
| aa7c6cf338 | |||
| 0075717a1f | |||
| 7c5af2f3ab | |||
| e667c7bf04 | |||
| 2e9aecdffe | |||
| 5304ed7047 | |||
| 56bd6f4e9f | |||
| cbef98a077 | |||
| ddca01e4e9 | |||
| 59ff941fda | |||
| 8881e9494c | |||
| 720748b73d | |||
| 7063796e28 | |||
| f349b7b2a3 | |||
| b59084dec6 |
@@ -62,17 +62,18 @@ jobs:
|
||||
- name: Build binaries
|
||||
run: bun run binaries
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
|
||||
- name: Publish to npm registry
|
||||
run: npm publish --access public
|
||||
- name: Configure npm registry auth
|
||||
run: |
|
||||
echo "registry=https://registry.npmjs.org" >> ~/.npmrc
|
||||
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" >> ~/.npmrc
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
- name: Publish to npm registry
|
||||
run: bun publish --access public
|
||||
env:
|
||||
BUN_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
- name: Create Gitea release and upload binaries
|
||||
run: |
|
||||
VERSION=${GITHUB_REF_NAME#v}
|
||||
|
||||
85
README.md
85
README.md
@@ -15,29 +15,29 @@ Download the binary for your platform from the releases page and run it directly
|
||||
|
||||
```bash
|
||||
# macOS (Apple Silicon)
|
||||
curl -L <release-url>/generate-clean-arch-macos-arm64 -o generate-clean-arch
|
||||
curl -L https://git.blassanto.me/blas/openapi-clean-arch-gen/releases/latest/download/generate-clean-arch-macos-arm64 -o generate-clean-arch
|
||||
chmod +x generate-clean-arch && ./generate-clean-arch -i swagger.yaml
|
||||
|
||||
# macOS (Intel)
|
||||
curl -L <release-url>/generate-clean-arch-macos-x64 -o generate-clean-arch
|
||||
curl -L https://git.blassanto.me/blas/openapi-clean-arch-gen/releases/latest/download/generate-clean-arch-macos-x64 -o generate-clean-arch
|
||||
chmod +x generate-clean-arch && ./generate-clean-arch -i swagger.yaml
|
||||
|
||||
# Linux x64
|
||||
curl -L <release-url>/generate-clean-arch-linux-x64 -o generate-clean-arch
|
||||
curl -L https://git.blassanto.me/blas/openapi-clean-arch-gen/releases/latest/download/generate-clean-arch-linux-x64 -o generate-clean-arch
|
||||
chmod +x generate-clean-arch && ./generate-clean-arch -i swagger.yaml
|
||||
|
||||
# Windows (PowerShell)
|
||||
curl -L <release-url>/generate-clean-arch-windows-x64.exe -o generate-clean-arch.exe
|
||||
curl -L https://git.blassanto.me/blas/openapi-clean-arch-gen/releases/latest/download/generate-clean-arch-windows-x64.exe -o generate-clean-arch.exe
|
||||
.\generate-clean-arch.exe -i swagger.yaml
|
||||
```
|
||||
|
||||
### Option 1: Install as a global CLI from the registry
|
||||
### Option 1: Install as a global CLI from npm
|
||||
|
||||
```bash
|
||||
bun add -g @blas/openapi-clean-arch-generator --registry https://git.blassanto.me/api/packages/blas/npm/
|
||||
bun add -g @0kmpo/openapi-clean-arch-generator
|
||||
```
|
||||
|
||||
Or configure the registry in your `.npmrc` / `bunfig.toml` and then run:
|
||||
Then run:
|
||||
|
||||
```bash
|
||||
generate-clean-arch -i swagger.yaml
|
||||
@@ -109,48 +109,54 @@ src/app/
|
||||
├── data/ # Data layer
|
||||
│ ├── dtos/ # Data Transfer Objects
|
||||
│ │ ├── node/
|
||||
│ │ │ └── node.dto.ts
|
||||
│ │ │ ├── node.dto.ts
|
||||
│ │ │ └── node.dto.mock.ts
|
||||
│ │ ├── order-type/
|
||||
│ │ │ └── order-type.dto.ts
|
||||
│ │ │ ├── order-type.dto.ts
|
||||
│ │ │ └── order-type.dto.mock.ts
|
||||
│ │ └── supply-mode/
|
||||
│ │ └── supply-mode.dto.ts
|
||||
│ │ ├── supply-mode.dto.ts
|
||||
│ │ └── supply-mode.dto.mock.ts
|
||||
│ ├── repositories/ # Repository implementations
|
||||
│ │ ├── node.repository.impl.ts
|
||||
│ │ ├── node.repository.impl.mock.ts
|
||||
│ │ ├── node.repository.impl.spec.ts
|
||||
│ │ ├── order-type.repository.impl.ts
|
||||
│ │ └── supply-mode.repository.impl.ts
|
||||
│ │ ├── order-type.repository.impl.mock.ts
|
||||
│ │ ├── order-type.repository.impl.spec.ts
|
||||
│ │ └── ...
|
||||
│ └── mappers/ # DTO → Entity transformers
|
||||
│ ├── node.mapper.ts
|
||||
│ ├── node.mapper.spec.ts
|
||||
│ ├── order-type.mapper.ts
|
||||
│ └── supply-mode.mapper.ts
|
||||
│ ├── order-type.mapper.spec.ts
|
||||
│ └── ...
|
||||
├── domain/ # Domain layer
|
||||
│ ├── repositories/ # Repository contracts
|
||||
│ │ ├── node.repository.contract.ts
|
||||
│ │ ├── order-type.repository.contract.ts
|
||||
│ │ └── supply-mode.repository.contract.ts
|
||||
│ │ └── ...
|
||||
│ └── use-cases/ # Use cases
|
||||
│ ├── node/
|
||||
│ │ ├── node.use-cases.contract.ts
|
||||
│ │ └── node.use-cases.impl.ts
|
||||
│ ├── order-type/
|
||||
│ │ ├── order-type.use-cases.contract.ts
|
||||
│ │ └── order-type.use-cases.impl.ts
|
||||
│ └── supply-mode/
|
||||
│ ├── supply-mode.use-cases.contract.ts
|
||||
│ └── supply-mode.use-cases.impl.ts
|
||||
│ │ ├── node.use-cases.impl.ts
|
||||
│ │ ├── node.use-cases.mock.ts
|
||||
│ │ └── node.use-cases.impl.spec.ts
|
||||
│ └── ...
|
||||
├── di/ # Dependency injection
|
||||
│ ├── repositories/ # Repository providers
|
||||
│ │ ├── node.repository.provider.ts
|
||||
│ │ ├── order-type.repository.provider.ts
|
||||
│ │ └── supply-mode.repository.provider.ts
|
||||
│ │ ├── node.repository.provider.mock.ts
|
||||
│ │ └── ...
|
||||
│ └── use-cases/ # Use case providers
|
||||
│ ├── node.use-cases.provider.ts
|
||||
│ ├── order-type.use-cases.provider.ts
|
||||
│ └── supply-mode.use-cases.provider.ts
|
||||
│ ├── node.use-cases.provider.mock.ts
|
||||
│ └── ...
|
||||
└── entities/ # Domain entities
|
||||
└── models/
|
||||
├── node.model.ts
|
||||
├── order-type.model.ts
|
||||
└── supply-mode.model.ts
|
||||
├── node.model.mock.ts
|
||||
├── node.model.spec.ts
|
||||
└── ...
|
||||
```
|
||||
|
||||
## 🔧 Template Customization
|
||||
@@ -160,14 +166,24 @@ Templates live in `templates/` and use [Mustache](https://mustache.github.io/) s
|
||||
| Template | Generates |
|
||||
|---|---|
|
||||
| `model.mustache` | DTOs |
|
||||
| `model.mock.mustache` | DTO mocks |
|
||||
| `dto.mock.mustache` | DTO mocks (alternative) |
|
||||
| `model-entity.mustache` | Domain entity models |
|
||||
| `model-entity.spec.mustache` | Entity model specs |
|
||||
| `mapper.mustache` | DTO → Entity mappers |
|
||||
| `mapper.spec.mustache` | Mapper specs |
|
||||
| `api.repository.contract.mustache` | Repository contracts |
|
||||
| `api.repository.impl.mustache` | Repository implementations |
|
||||
| `api.repository.impl.mock.mustache` | Repository mocks |
|
||||
| `api.repository.impl.spec.mustache` | Repository specs |
|
||||
| `api.use-cases.contract.mustache` | Use case contracts |
|
||||
| `api.use-cases.impl.mustache` | Use case implementations |
|
||||
| `api.use-cases.mock.mustache` | Use case mocks |
|
||||
| `api.use-cases.impl.spec.mustache` | Use case specs |
|
||||
| `repository.provider.mustache` | Repository DI providers |
|
||||
| `repository.provider.mock.mustache` | Repository provider mocks |
|
||||
| `use-cases.provider.mustache` | Use case DI providers |
|
||||
| `use-cases.provider.mock.mustache` | Use case provider mocks |
|
||||
|
||||
### Available Mustache variables
|
||||
|
||||
@@ -194,12 +210,23 @@ After each run a `generation-report.json` file is created:
|
||||
"timestamp": "2025-01-15T10:30:00.000Z",
|
||||
"tags": 3,
|
||||
"endpoints": 8,
|
||||
"tagDetails": [
|
||||
{ "name": "User", "description": "User operations", "endpoints": 3 },
|
||||
{ "name": "Product", "description": "Product operations", "endpoints": 2 }
|
||||
],
|
||||
"outputDirectory": "./src/app",
|
||||
"linting": {
|
||||
"prettier": { "ran": true, "filesFormatted": 42 },
|
||||
"eslint": { "ran": true, "filesFixed": 42 }
|
||||
},
|
||||
"structure": {
|
||||
"dtos": 15,
|
||||
"repositories": 9,
|
||||
"mappers": 3,
|
||||
"useCases": 6
|
||||
"mappers": 5,
|
||||
"useCases": 6,
|
||||
"providers": 12,
|
||||
"mocks": 18,
|
||||
"specs": 14
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
10
package.json
10
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0kmpo/openapi-clean-arch-generator",
|
||||
"version": "1.3.7",
|
||||
"version": "1.3.14",
|
||||
"description": "Angular Clean Architecture generator from OpenAPI/Swagger",
|
||||
"main": "dist/main.js",
|
||||
"bin": {
|
||||
@@ -39,6 +39,14 @@
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"dist/main.js",
|
||||
"dist/package.json",
|
||||
"dist/src/",
|
||||
"dist/templates/",
|
||||
"README.md",
|
||||
"LICENSE"
|
||||
],
|
||||
"dependencies": {
|
||||
"chalk": "^4.1.2",
|
||||
"commander": "^11.1.0",
|
||||
|
||||
Reference in New Issue
Block a user