diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7f1e5e2..6029c7c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,8 +1,10 @@ # Contributing <p align="center"> - <a href="#best-practices">Best practices</a> · - <a href="#pull-request-process">Pull request process</a> +<a href="#best-practices">Best practices</a> · +<a href="#quickstart">Quickstart</a> · +<a href="#pull-request-process">Pull request process</a> · +<a href="#code-of-conduct">Code of conduct</a> </p> First of all, thanks for taking the time to contribute! @@ -27,6 +29,50 @@ project. We encourage you to follow them and help us create a better product! 23-add-new-provider). - Create commit messages following [conventional commit](https://conventionalcommits.org) specification. +## Quickstart + +### Dependencies + +To install dependencies, after cloning the repository, run: + +```bash +npm ci +``` + +### Build + +To build the application, run: + +```bash +npm run build +``` + +### Usage + +To execute the application run: + +```bash +npm start -- -i example.yaml +``` + +### Clean + +To clean output & build path run: + +```bash +npm run clean +``` + +You can find all the options in our [README](./README.md) file + +### Putting all together + +When you are developing a new feature you must clean output & build path, rebuild the app and execute it. So this is a good command to _remember_: + +```bash +npm run clean && npm start -- -i input/file.yaml +``` + ## Pull request process 1. Ensure any install or build dependencies are solved before doing a build. diff --git a/README.md b/README.md index b89eb77..ba6bf07 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ <p align="center"> <a href="#-summary">Summary</a> · <a href="#-getting-started">Getting started</a> · +<a href="#-contributing">Contributing</a> · <a href="#-support">Support</a> · <a href="#license">License</a> </p> @@ -23,22 +24,30 @@ This generator requires the Node version >=17.7.1 to run properly -### How to install +### 🧑🏻💻 Usage + +You can install it: ```bash npm i @sngular/openapi-nodejs-cli --global ``` -### 🧑🏻💻 Usage +and use as: ```bash -npx openapi-nodejs-cli -i input/schema.yaml +openapi-nodejs-cli -i input/schema.yaml +``` + +or use directly: + +```bash +npx i @sngular/openapi-nodejs-cli -i input/schema.yaml ``` You can retrieve an option list with this command: ```bash -npx openapi-nodejs-cli --help +openapi-nodejs-cli --help ``` ```bash @@ -55,13 +64,17 @@ Options: -h, --help shows this help ``` +## 🤝 Contributing + +If you want to collaborate with the project, please read our [CONTRIBUTING.md](./CONTRIBUTING.md) where you can find our guidelines + ## 🧰 Support We’ll be glad to talk and discuss how `openapi-nodejs-cli` can help you 😊 Reach us through [GitHub issues](https://github.com/sngular/openapi-nodejs-cli/issues), [email](mailto:info@sngular.com) or [Twitter](https://twitter.com/sngular). -## License +## 🔐 License This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at [https://mozilla.org/MPL/2.0/](https://mozilla.org/MPL/2.0/). [](https://github.com/sngular/openapi-nodejs-cli/blob/main/LICENSE) diff --git a/example.yaml b/example.yaml new file mode 100644 index 0000000..dd88679 --- /dev/null +++ b/example.yaml @@ -0,0 +1,24 @@ +openapi: 3.1.0 +info: + title: Sample API + description: Optional multiline or single-line description in [CommonMark](http://commonmark.org/help/) or HTML. + version: 0.1.9 +servers: + - url: http://api.example.com/v1 + description: Optional server description, e.g. Main (production) server + - url: http://staging-api.example.com + description: Optional server description, e.g. Internal staging server for testing +paths: + /users: + get: + summary: Returns a list of users. + description: Optional extended description in CommonMark or HTML. + responses: + '200': # status code + description: A JSON array of user names + content: + application/json: + schema: + type: array + items: + type: string diff --git a/package.json b/package.json index d15c842..a3c5cbe 100644 --- a/package.json +++ b/package.json @@ -24,8 +24,8 @@ "scripts": { "test": "jest", "coverage": "jest --coverage", - "clean": "rm -rf output", "build": "tsc", + "build:clean": "tsc --build --clean", "postprepare": "npm run build", "prestart": "npm run build", "start": "node .", @@ -36,7 +36,8 @@ "format:eslint": "npm run lint:eslint -- --fix", "format:prettier": "prettier --write .", "prepare": "husky install", - "release": "npx semantic-release" + "release": "npx semantic-release", + "clean": "rm -rf output outputTest && npm run build:clean" }, "repository": { "type": "git",