Skip to content

Commit

Permalink
Add README and CHANGELOG file
Browse files Browse the repository at this point in the history
  • Loading branch information
jjzcru committed Jan 5, 2020
1 parent fd254b8 commit 6c5e7ff
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 2 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Changelog

All notable changes to this project will be documented in this file.

## [0.1.0] - 2020-01-05

### Added
- First release of the project
- CHANGELOG.md file
- README.md file

[0.1.0]: https://github.com/jjzcru/swagger-ui-loader/releases/tag/v0.1.0
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
## Installation

### Npm
```console
npm install swagger-ui-loader --save-dev
```

### Yarn
```console
yarn add swagger-ui-loader --dev
```

## Usage
Add a run script that executes `swagger-ui-loader`. Your `package.json` should look similar to this. Now just run `npm run swagger`.

```json
{
"name": "i-am-your-package🤖",
"scripts": {
"swagger": "swagger-ui-loader"
},
"devDependencies": {
"swagger-ui-loader": "^0.1.0"
}
}
```

Be default it will search for `swagger.json`, `swagger.yml` or `swagger.yaml` on the root directory of the project and it will run a server on port `5466`.

You can add a property `swagger` to `package.json` with the following properties:

- `file`: The path on which the file with the swagger data is located.
- `port`: The port on which you want the server to run.

The `package.json` will look like this with those properties.
```json
{
"name": "i-am-your-package🤖",
"scripts": {
"swagger": "swagger-ui-loader"
},
"swagger": {
"file": "./docs/swagger.yml",
"port": 8888,
},
"devDependencies": {
"swagger-ui-loader": "^0.1.0"
}
}
```

If you run `npm run swagger` it will search for the `swagger.yml` inside the `docs` directory and the server will run on port `8888`.
4 changes: 2 additions & 2 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ function getTargetFile() {
ext: ext
}
default:
throwError(`File extension '${ext}' is not valid`)
throwError(`File extension '${ext}' is not valid`);
}

throwError(`Swagger configuration file '${filePath}' do not exist`)
throwError(`Swagger configuration file '${filePath}' do not exist`);
}

// I search for 'swagger.yml', 'swagger.yaml' or 'swagger.json' as default value
Expand Down

0 comments on commit 6c5e7ff

Please sign in to comment.