Skip to content

Commit b7d826a

Browse files
committed
feat: init
0 parents  commit b7d826a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+9100
-0
lines changed

.c8rc.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"reporter": ["text", "json-summary"],
3+
"all": true,
4+
"include": ["src", "commands", "index.ts", "configure.ts"]
5+
}

.editorconfig

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# http://editorconfig.org
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[*.json]
12+
insert_final_newline = ignore
13+
14+
[**.min.js]
15+
indent_style = ignore
16+
insert_final_newline = ignore
17+
18+
[MakeFile]
19+
indent_style = space
20+
21+
[*.md]
22+
trim_trailing_whitespace = false

.gitignore

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
node_modules
2+
coverage
3+
.DS_STORE
4+
.nyc_output
5+
.idea
6+
.vscode/
7+
*.sublime-project
8+
*.sublime-workspace
9+
*.log
10+
build
11+
dist
12+
yarn.lock
13+
shrinkwrap.yaml
14+
package-lock.json
15+
.env
16+
tests/tmp

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ignore-workspace-root-check=true

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2025-present, Outloud
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

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<div align="center">
2+
<br/>
3+
4+
# @outloud/adonis-openapi
5+
Generate OpenAPI compliant specifications powered by openapi-metadata for you Adonis Application.
6+
7+
Inspired by [FriendsOfAdonis](https://github.com/FriendsOfAdonis/FriendsOfAdonis).
8+
9+
<br/>
10+
</div>
11+
12+
<div align="center">
13+
14+
<!-- badges -->
15+
16+
</div>
17+
18+
19+
## License
20+
21+
[MIT licensed](LICENSE.md).

bin/test.ts

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { assert } from '@japa/assert'
2+
import { fileSystem } from '@japa/file-system'
3+
import { configure, processCLIArgs, run } from '@japa/runner'
4+
import { BASE_URL } from '../tests/helpers.js'
5+
6+
processCLIArgs(process.argv.splice(2))
7+
8+
configure({
9+
files: ['tests/**/*.spec.ts'],
10+
plugins: [assert(), fileSystem({ basePath: BASE_URL })],
11+
})
12+
13+
run()

configure.ts

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
|--------------------------------------------------------------------------
3+
| Configure hook
4+
|--------------------------------------------------------------------------
5+
|
6+
| The configure hook is called when someone runs "node ace configure <package>"
7+
| command. You are free to perform any operations inside this function to
8+
| configure the package.
9+
|
10+
| To make things easier, you have access to the underlying "ConfigureCommand"
11+
| instance and you can use codemods to modify the source files.
12+
|
13+
*/
14+
15+
import type ConfigureCommand from '@adonisjs/core/commands/configure'
16+
import { stubsRoot } from './stubs/main.js'
17+
18+
export async function configure(command: ConfigureCommand) {
19+
const codemods = await command.createCodemods()
20+
21+
await codemods.updateRcFile((rcFile) => {
22+
rcFile.addProvider('@outloud/adonis-openapi/provider')
23+
})
24+
25+
await codemods.makeUsingStub(stubsRoot, 'config/openapi.stub', {})
26+
}

eslint.config.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { createConfig } from '@outloud/eslint-config-adonisjs'
2+
3+
export default createConfig()
4+
.append({
5+
rules: {
6+
'@typescript-eslint/no-unsafe-function-type': 'off',
7+
},
8+
})

index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { configure } from './configure.js'
2+
export { defineConfig } from './src/config.js'

package.json

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
{
2+
"name": "@outloud/adonis-openapi",
3+
"description": "Generate OpenAPI specifications on Adonis",
4+
"version": "0.3.7",
5+
"engines": {
6+
"node": ">=20.6.0"
7+
},
8+
"type": "module",
9+
"files": [
10+
"build"
11+
],
12+
"exports": {
13+
".": "./build/index.js",
14+
"./commands": "./build/commands/main.js",
15+
"./provider": "./build/providers/openapi.provider.js",
16+
"./services/main": "./build/services/main.js",
17+
"./types": "./build/src/types.js",
18+
"./decorators": "./build/src/decorators.js"
19+
},
20+
"scripts": {
21+
"clean": "del-cli build",
22+
"copy:templates": "copyfiles \"stubs/**/*.stub\" build",
23+
"index:commands": "adonis-kit index build/commands",
24+
"typecheck": "tsc --noEmit",
25+
"lint": "eslint .",
26+
"format": "prettier --write .",
27+
"quick:test": "node --import=./tsnode.esm.js --enable-source-maps bin/test.ts",
28+
"test": "c8 pnpm quick:test",
29+
"prebuild": "pnpm clean",
30+
"build": "tsc -p tsconfig.build.json && pnpm copy:templates && pnpm index:commands",
31+
"dev": "tsc --watch",
32+
"version": "pnpm build"
33+
},
34+
"keywords": [
35+
"adonis",
36+
"adonisjs",
37+
"openapi",
38+
"oapi",
39+
"api",
40+
"typescript"
41+
],
42+
"license": "MIT",
43+
"devDependencies": {
44+
"@adonisjs/assembler": "^7.8.2",
45+
"@adonisjs/core": "^6.17.0",
46+
"@adonisjs/lucid": "^21.6.0",
47+
"@adonisjs/tsconfig": "^1.4.0",
48+
"@japa/assert": "^4.0.0",
49+
"@japa/expect-type": "^2.0.2",
50+
"@japa/file-system": "^2.3.1",
51+
"@japa/plugin-adonisjs": "^3.0.1",
52+
"@japa/runner": "^3.1.4",
53+
"@outloud/eslint-config-adonisjs": "^1.1.7",
54+
"@swc/core": "1.10.3",
55+
"@types/luxon": "^3.4.2",
56+
"@types/node": "^22.10.2",
57+
"@types/sinon": "^17.0.3",
58+
"@vinejs/vine": "^3.0.0",
59+
"c8": "^10.1.3",
60+
"copyfiles": "^2.4.1",
61+
"del-cli": "^6.0.0",
62+
"eslint": "^9.22.0",
63+
"luxon": "^3.5.0",
64+
"openapi-types": "^12.1.3",
65+
"prettier": "^3.4.2",
66+
"reflect-metadata": "^0.2.2",
67+
"ts-node": "^10.9.2",
68+
"typescript": "^5.7.2"
69+
},
70+
"peerDependencies": {
71+
"@adonisjs/core": "^6.2.0",
72+
"@adonisjs/lucid": "^21.2.0",
73+
"@vinejs/vine": "^3.0.0",
74+
"luxon": "^3.5.0"
75+
},
76+
"dependencies": {
77+
"openapi-metadata": "^0.1.1"
78+
},
79+
"publishConfig": {
80+
"access": "public",
81+
"tag": "latest"
82+
},
83+
"c8": {
84+
"reporter": [
85+
"text",
86+
"html"
87+
],
88+
"exclude": [
89+
"tests/**"
90+
]
91+
}
92+
}

playground/.editorconfig

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# http://editorconfig.org
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[*.json]
12+
insert_final_newline = unset
13+
14+
[**.min.js]
15+
indent_style = unset
16+
insert_final_newline = unset
17+
18+
[MakeFile]
19+
indent_style = space
20+
21+
[*.md]
22+
trim_trailing_whitespace = false

playground/.env.example

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
TZ=UTC
2+
PORT=3333
3+
HOST=localhost
4+
LOG_LEVEL=info
5+
APP_KEY=
6+
NODE_ENV=development
7+
SESSION_DRIVER=cookie

playground/.gitignore

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Dependencies and AdonisJS build
2+
node_modules
3+
build
4+
tmp
5+
6+
# Secrets
7+
.env
8+
.env.local
9+
.env.production.local
10+
.env.development.local
11+
12+
# Frontend assets compiled code
13+
public/assets
14+
15+
# Build tools specific
16+
npm-debug.log
17+
yarn-error.log
18+
19+
# Editors specific
20+
.fleet
21+
.idea
22+
.vscode
23+
24+
# Platform specific
25+
.DS_Store

playground/ace.js

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
|--------------------------------------------------------------------------
3+
| JavaScript entrypoint for running ace commands
4+
|--------------------------------------------------------------------------
5+
|
6+
| DO NOT MODIFY THIS FILE AS IT WILL BE OVERRIDDEN DURING THE BUILD
7+
| PROCESS.
8+
|
9+
| See docs.adonisjs.com/guides/typescript-build-process#creating-production-build
10+
|
11+
| Since, we cannot run TypeScript source code using "node" binary, we need
12+
| a JavaScript entrypoint to run ace commands.
13+
|
14+
| This file registers the "ts-node/esm" hook with the Node.js module system
15+
| and then imports the "bin/console.ts" file.
16+
|
17+
*/
18+
19+
/**
20+
* Register hook to process TypeScript files using ts-node
21+
*/
22+
import 'ts-node-maintained/register/esm'
23+
24+
/**
25+
* Import ace console entrypoint
26+
*/
27+
await import('./bin/console.js')

0 commit comments

Comments
 (0)