Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: mono repo with fastify, and koa middleware libs #521

Open
wants to merge 123 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
f45a1c7
implement as standard express middleware
cdimascio Aug 14, 2020
1d5a8dd
conver to standard express middleware
cdimascio Aug 14, 2020
ca33058
require options only
cdimascio Aug 15, 2020
db1bee9
update codacy
cdimascio Aug 15, 2020
33c8642
update ncyrc
cdimascio Aug 15, 2020
b808b8d
update nyc
cdimascio Aug 15, 2020
4024311
update readme
cdimascio Aug 15, 2020
9300053
update README
cdimascio Aug 15, 2020
935f176
update README
cdimascio Aug 15, 2020
2aa903d
cleanup specs
cdimascio Aug 22, 2020
e1d7c7d
remove sync test
cdimascio Aug 22, 2020
6ba8c8e
lerna refactor
cdimascio Aug 30, 2020
4dfa71b
lerna refactor
cdimascio Aug 30, 2020
f6019ae
v4.0.0-alpha.2
cdimascio Aug 30, 2020
caf01b6
lerna + initial fastify plugin
cdimascio Aug 30, 2020
84eef30
ci
cdimascio Aug 30, 2020
170b69f
ci
cdimascio Aug 30, 2020
68be3c7
remove console.log
cdimascio Aug 30, 2020
3c0f624
es2020
cdimascio Aug 30, 2020
51e22bb
package locks
cdimascio Aug 30, 2020
da274bb
update travis
cdimascio Aug 30, 2020
9aca6c7
ts config
cdimascio Aug 30, 2020
478cb69
add package metadata
cdimascio Aug 30, 2020
76c3a52
add tags
cdimascio Aug 30, 2020
48e227f
add ts config
cdimascio Aug 30, 2020
7c17396
remove outdir
cdimascio Aug 30, 2020
1614fda
temp disable steps
cdimascio Aug 30, 2020
693c363
improve ci
cdimascio Aug 30, 2020
c1a71ef
update tsc
cdimascio Aug 30, 2020
ae672df
cd for coveralls
cdimascio Aug 30, 2020
cbfc7c0
lerna compile only
cdimascio Aug 30, 2020
3d214b5
update package.json
cdimascio Aug 30, 2020
1b93370
debug info
cdimascio Aug 30, 2020
af06c69
add dev deps
cdimascio Aug 30, 2020
0e94ac3
try composite
cdimascio Aug 30, 2020
28be2a0
debug info
cdimascio Aug 30, 2020
5cb1890
install dev deps
cdimascio Aug 30, 2020
1550319
update travis
cdimascio Aug 30, 2020
1ae39dd
update ci
cdimascio Aug 30, 2020
42237e8
experiment with ci
cdimascio Aug 30, 2020
e47ba72
experiment with ci
cdimascio Aug 30, 2020
79b41ba
experiment with ci
cdimascio Aug 30, 2020
9dcea8e
update package.json
cdimascio Aug 30, 2020
75edaee
update travis ci
cdimascio Aug 30, 2020
e063a18
install root deps
cdimascio Aug 30, 2020
5e2c2f8
types
cdimascio Sep 1, 2020
9962cd8
update deps
cdimascio Sep 1, 2020
1411740
fix types
cdimascio Sep 1, 2020
5d39410
integrate v4 updates
cdimascio Sep 6, 2020
414794c
v4.0.0-alpha.4
cdimascio Sep 6, 2020
8dbcc1c
improve operationHandler handling with connect middleware
cdimascio Sep 7, 2020
0404ca7
initial fastify plugin
cdimascio Sep 7, 2020
c64cf7c
feat: initial modularization
cdimascio Jan 16, 2021
c65c89e
fix: formatting
cdimascio Jan 16, 2021
624f34e
modular updates
cdimascio Jan 17, 2021
f7d642c
help vscode recognize mocha
cdimascio Jan 17, 2021
4e146ad
npm to lerna
cdimascio Jan 17, 2021
dc151ba
doc: update contributing
cdimascio Jan 17, 2021
c60cc8e
feat: update gitpod
cdimascio Jan 17, 2021
37d86a0
install lerna globally
cdimascio Jan 17, 2021
a15a35b
Merge branch 'master' into lerna
cdimascio Jan 17, 2021
60a28cb
chore: tsconfig
cdimascio Jan 17, 2021
216ebcd
ts config and type fixes
cdimascio Jan 17, 2021
edb0586
fix: vscode errors
cdimascio Jan 17, 2021
e39f1c0
Merge branch 'fastify' into lerna-fastify
cdimascio Jan 17, 2021
2f90173
fix: integrate fastify
cdimascio Jan 18, 2021
36f44cc
updates: ts updates
cdimascio Jan 18, 2021
33e531e
feat: add koa middleware
cdimascio Jan 18, 2021
6d19274
doc: update descriptions
cdimascio Jan 18, 2021
c7f667f
doc: update contributing
cdimascio Jan 18, 2021
fcab49e
update framework package name
cdimascio Jan 18, 2021
c2b6910
v4.11.0-beta.6
cdimascio Jan 18, 2021
c2923dd
cleanup
cdimascio Jan 18, 2021
6af0528
update ignores
cdimascio Jan 18, 2021
03bd92d
update config
cdimascio Jan 18, 2021
fbdeda6
doc: update README
cdimascio Jan 18, 2021
1440ac8
doc: update contributing
cdimascio Jan 18, 2021
4e08c83
rename openapi-framework to openapi-core
cdimascio Jan 18, 2021
bebd237
test: add deps
cdimascio Jan 18, 2021
f5d2b37
update evs
cdimascio Jan 18, 2021
cc8e162
add evs
cdimascio Jan 18, 2021
b97d03f
codacy token
cdimascio Jan 18, 2021
eef2108
update coverage
cdimascio Jan 18, 2021
ea9d3d9
add missing semi
cdimascio Jan 18, 2021
070f9fb
package cleanup
cdimascio Jan 18, 2021
bfab69f
license MIT
cdimascio Jan 18, 2021
5bbb02e
doc: update README
cdimascio Jan 18, 2021
de1a7ed
fix coverage
cdimascio Jan 18, 2021
7310655
coverage script
cdimascio Jan 18, 2021
cd623bc
update env vars
cdimascio Jan 18, 2021
cae54fc
report script
cdimascio Jan 18, 2021
dd6cba5
fix indent
cdimascio Jan 18, 2021
ee50f3b
update evs
cdimascio Jan 18, 2021
6e9cfe5
v4.12.0-beta.0
cdimascio Jan 18, 2021
7755006
load express for op handlers only
cdimascio Jan 18, 2021
3e4a06f
v4.12.0-beta.1
cdimascio Jan 18, 2021
8af7f32
Update README.md
cdimascio Jan 18, 2021
f97a0be
Update README.md
cdimascio Jan 18, 2021
85a522c
doc: update README
cdimascio Jan 18, 2021
e655bb8
doc: update README
cdimascio Jan 18, 2021
9dd33de
doc: update README
cdimascio Jan 18, 2021
fdc21f3
doc: update contributing
cdimascio Jan 18, 2021
b9b3046
doc: update README
cdimascio Jan 18, 2021
0e6a4a0
v4.12.0-beta.2
cdimascio Jan 18, 2021
457edb1
Update README.md
cdimascio Jan 19, 2021
c9354d2
Update README.md
cdimascio Jan 19, 2021
d45f060
Update README.md
cdimascio Jan 19, 2021
e119a3c
doc: update README
cdimascio Jan 19, 2021
97fb3fa
Merge branch 'lerna-fastify' of https://github.com/cdimascio/express-…
cdimascio Jan 19, 2021
79a6b43
doc: update README
cdimascio Jan 19, 2021
78e6d6f
logos
cdimascio Jan 19, 2021
040f2c5
doc: update README
cdimascio Jan 19, 2021
6664e50
Update README.md
cdimascio Jan 19, 2021
6a8349a
Update README.md
cdimascio Jan 19, 2021
7c0e3d6
koa form data support
cdimascio Jan 23, 2021
8370b49
v4.12.0-beta.3
cdimascio Jan 23, 2021
2c1cbf5
doc: update README
cdimascio Jan 23, 2021
a303ff9
doc: update README
cdimascio Jan 23, 2021
226da51
add bodyparse to koa example
cdimascio Jan 30, 2021
2f737ff
v4.12.0-beta.4
cdimascio Jan 30, 2021
1cccf3f
Update README.md
cdimascio Jan 30, 2021
022e173
updates
cdimascio Jan 30, 2021
e8134de
v4.12.0-beta.5
cdimascio Jan 30, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 5 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
.vscode
.idea
.DS_Store
/_old
!.vscode/launch.json
.vscode/settings.json
.idea
node_modules
*.orig
dist
/sample
/coverage
.coveralls.yml
.nyc_output
secrets.zip
jest
junk
/a_reference
/sample2
README.md.sav
ignore
3 changes: 2 additions & 1 deletion .gitpod.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
tasks:
- init: npm install
- init: npm install && npm install lerna -g
command: lerna bootstrap && lerna run compile
7 changes: 4 additions & 3 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"singleQuote": true,
"trailingComma": "all"
}
"singleQuote": true,
"trailingComma": "all"
}

22 changes: 9 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,18 @@ node_js:
- '14'
- '12'
- '10'
before_install:
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then openssl aes-256-cbc -K $encrypted_deba340dfe89_key -iv $encrypted_deba340dfe89_iv
-in secrets.zip.enc -out secrets.zip -d; fi'
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then unzip secrets.zip; fi'
install:
- npm install
- npm install lerna -g
- lerna bootstrap
script:
- npm run compile
- npm run test:coverage
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then npm run coveralls; fi'
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then npm run codacy; fi'
- lerna run compile
- lerna run test:coverage
- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then lerna run coveralls; fi
- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then lerna run codacy; fi
env:
global:
- secure: x+Nxbq8RrOVJyQ7JWNRpXdBmp61rXPKulYPxUwGeIe/ZJwX1QHsy2HAAB2m7aRvAMBAqr2urBaIKgPBmBklyY0elRTD/chUdT5cJiPhMIxBghqkQ1NYqx/WzcCBUrZbRzoQcpAES7sJnUs0PMujKv3wMsujoFJ9b9Z+trHMqD0IztBlg45azAh4A6ApVcDB8j4L+g42kps6d4r5jUt2d4uW537PKXpsnWJMaaj2Pw7pxU2H5kBaeNGnvlK+w9k3porToop7OUG+HBTN2BjofdF1PSHm8fizzFL6/h2x39cLYMxFvHb7oVUKBiWQe8PBXD5+k/X0RgPJMZO9AggMHln5MIihTowGvuSLK/3d95ta/qXTmzG0Csv4J8xWD+koCJm0xpSzsrBSUOPt5ZKN71o0VmLmc7U4Z0aEplZyVcMdTbwA1XeoeXD4UU1fD7BlzYl4oOTB8HlucJILwAZFg0upPB33lQchAUIgoUCDxze3OoG3V1Odcw4u64bXlPrdqgCg8AQZgnrYP+EzKczjGd7pBQZRVx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RUAwyiPOgw5odDh2lHJGh9fllq9q1bsbiSxHchvUTF1nao=
branches:
only:
- /.*/
- "/.*/"
65 changes: 65 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Run Mocha Tests",
"cwd": "${workspaceFolder}/packages/express-openapi-validator",
"program": "node_modules/mocha/bin/_mocha",
"args": [
"-r",
"source-map-support/register",
"-r",
"ts-node/register",
"--timeout",
"999999",
"--colors",
"test/**/*.spec.ts"
],
"env": { "TS_NODE_FILES": "true" },
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"protocol": "inspector"
},
{
"type": "node",
"request": "launch",
"name": "Koa Mocha Tests",
"cwd": "${workspaceFolder}/packages/koa-openapi-validator",
"program": "node_modules/mocha/bin/_mocha",
"args": [
"-r",
"source-map-support/register",
"-r",
"ts-node/register",
"--timeout",
"999999",
"--colors",
"test/**/*.spec.ts"
],
"env": { "TS_NODE_FILES": "true" },
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"protocol": "inspector"
},
{
"name": "Node Attach",
"port": 9229,
"request": "attach",
"skipFiles": ["<node_internals>/**"],
"type": "pwa-node"
},
{
"name": "7-Fastify Attach",
"port": 9320,
"request": "attach",
"skipFiles": ["<node_internals>/**"],
"cwd": "${workspaceFolder}/packages/examples/7-fastify-standard",
"type": "pwa-node"
}
]
}
79 changes: 70 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Contributors are welcome!

See something that needs fixing? Got an idea for a new feature? Contribute a [Pull Request](#Create-a-Pull-Request)!

## Background

This project is set up as a mono-repo. We use `lerna` to manage dependencies. Thus, after the initial `npm install` (to get lerna), you will use `lerna bootstrap` in place of `npm install`. This will ensure all local package / dependies are compiled/transpiled.

## Easy path to contribution
Click the Gitpod badge to setup a ready to code dev env in the cloud.

Expand All @@ -20,23 +24,73 @@ Click the Gitpod badge to setup a ready to code dev env in the cloud.
git clone <forked-repo>
```

2. Install the dependencies
2. Install the dependencies for each package in the mono repo

```shell
# install lerna and common deps
npm install

# run lerna bootstrap to install module dependencies
# note: use lerna bootstrap, rather than npm install
lerna bootstrap && lerna run compile
```

_**Tip:**_ Run `lerna clean && lerna bootstrap && lerna run compile` to reset the project, e.g. clean, install, and compile all packages.

3. Navigate to the package dir you'd like to modify

**Packages:**
- [express-openapi-validator](/packages/express-openapi-validator) - the express middleware
- [koa-openapi-validator](/packages/koa-openapi-validator) - the koa middleware
- [fastify-openapi-validator](/packages/fastify-openapi-validator) - the fastify middleware
- [openapi-core](/packages/openapi-core) - core schema load and preprocess logic


```shell
# From the project directory, run
npm i
# for example, navigate the express validator package
cd packages/express-openapi-validator
```
3a. Compile sources for each package in the mono repo

```shell
lerna run compile
```

3b. Compile sources a single package

```shell
cd packages express-openapi-validator
npm run compile
```

Be [Create a Pull Request](#create-a-pull-request) once you've written you code.
4. Be [Create a Pull Request](#create-a-pull-request) once you've written you code.

## Run the tests

3. Run the tests
1a. Run all tests in the mono repo

```shell
# compile any changes
lerna run compile
lerna run test
```

1b. Run tests in one package

Run tests in the current package:

```shell
npm test
lerna run test --scope express-openapi-validator
# or if in the package directory, you can run
npm run test
```

## Debug

If you are using VSCode, see the debugger. There are configurations:
- Run Mocha Tests - allows to step through Mocha tests
- 7-Fastify Attach - allows to start the fastify example and step through code

## Develop

- Write code
Expand All @@ -58,11 +112,18 @@ Be [Create a Pull Request](#create-a-pull-request) once you've written you code.
6. From the Github UI, Click Create pull request to open a new pull request
7. Detailed steps with example here:

## Project structure
## Package
Only maintainers have permissions to perform the publish actions:

`src` contains the source code
`test` contains the tests
prerelease
```shell
lerna publish prerelease --dist-tag beta --preid beta
```

release
```shell
lerna publish patch # minor
```
## Need help?

Reach out on [gitter](https://gitter.im/cdimascio-oss/community).
Expand Down
Binary file added assets/fastify-openapi-validator-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/koa-openapi-validator-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading