-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e5a4b4e
Showing
21 changed files
with
22,702 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# http://editorconfig.org | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.json] | ||
insert_final_newline = ignore | ||
|
||
[**.min.js] | ||
indent_style = ignore | ||
insert_final_newline = ignore | ||
|
||
[MakeFile] | ||
indent_style = space | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
## Git Commit Message Convention | ||
|
||
> This is adapted from [Angular's commit convention](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular). | ||
Using conventional commit messages, we can automate the process of generating the CHANGELOG file. All commits messages will automatically be validated against the following regex. | ||
|
||
``` js | ||
/^(revert: )?(feat|fix|docs|style|refactor|perf|test|workflow|ci|chore|types|build|improvement)((.+))?: .{1,50}/ | ||
``` | ||
|
||
## Commit Message Format | ||
A commit message consists of a **header**, **body** and **footer**. The header has a **type**, **scope** and **subject**: | ||
|
||
> The **scope** is optional | ||
``` | ||
feat(router): add support for prefix | ||
Prefix makes it easier to append a path to a group of routes | ||
``` | ||
|
||
1. `feat` is type. | ||
2. `router` is scope and is optional | ||
3. `add support for prefix` is the subject | ||
4. The **body** is followed by a blank line. | ||
5. The optional **footer** can be added after the body, followed by a blank line. | ||
|
||
## Types | ||
Only one type can be used at a time and only following types are allowed. | ||
|
||
- feat | ||
- fix | ||
- docs | ||
- style | ||
- refactor | ||
- perf | ||
- test | ||
- workflow | ||
- ci | ||
- chore | ||
- types | ||
- build | ||
|
||
If a type is `feat`, `fix` or `perf`, then the commit will appear in the CHANGELOG.md file. However if there is any BREAKING CHANGE, the commit will always appear in the changelog. | ||
|
||
### Revert | ||
If the commit reverts a previous commit, it should begin with `revert:`, followed by the header of the reverted commit. In the body it should say: `This reverts commit <hash>`., where the hash is the SHA of the commit being reverted. | ||
|
||
## Scope | ||
The scope could be anything specifying place of the commit change. For example: `router`, `view`, `querybuilder`, `database`, `model` and so on. | ||
|
||
## Subject | ||
The subject contains succinct description of the change: | ||
|
||
- use the imperative, present tense: "change" not "changed" nor "changes". | ||
- don't capitalize first letter | ||
- no dot (.) at the end | ||
|
||
## Body | ||
|
||
Just as in the **subject**, use the imperative, present tense: "change" not "changed" nor "changes". | ||
The body should include the motivation for the change and contrast this with previous behavior. | ||
|
||
## Footer | ||
|
||
The footer should contain any information about **Breaking Changes** and is also the place to | ||
reference GitHub issues that this commit **Closes**. | ||
|
||
**Breaking Changes** should start with the word `BREAKING CHANGE:` with a space or two newlines. The rest of the commit message is then used for this. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Contributing | ||
|
||
We love pull requests. And following this guidelines will make your pull request easier to merge | ||
|
||
## Prerequisites | ||
|
||
- Install [EditorConfig](http://editorconfig.org/) plugin for your code editor to make sure it uses correct settings. | ||
- Fork the repository and clone your fork. | ||
- Install dependencies: `npm install`. | ||
|
||
## Coding style | ||
|
||
We make use of [standard](https://standardjs.com/) to lint our code. Standard does not need a config file and comes with set of non-configurable rules. | ||
|
||
## Development work-flow | ||
|
||
Always make sure to lint and test your code before pushing it to the GitHub. | ||
|
||
```bash | ||
npm test | ||
``` | ||
|
||
Just lint the code | ||
|
||
```bash | ||
npm run lint | ||
``` | ||
|
||
**Make sure you add sufficient tests for the change**. | ||
|
||
## Other notes | ||
|
||
- Do not change version number inside the `package.json` file. | ||
- Do not update `CHANGELOG.md` file. | ||
|
||
## Need help? | ||
|
||
Feel free to ask. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!-- CLICK "Preview" FOR INSTRUCTIONS IN A MORE READABLE FORMAT --> | ||
|
||
## Prerequisites | ||
|
||
We do our best to reply to all the issues on time. If you will follow the given guidelines, the turn around time will be faster. | ||
|
||
- Ensure the issue isn't already reported. | ||
- Ensure you are reporting the bug in the correct repo. | ||
|
||
*Delete the above section and the instructions in the sections below before submitting* | ||
|
||
## Description | ||
|
||
If this is a feature request, explain why it should be added. Specific use-cases are best. | ||
|
||
For bug reports, please provide as much *relevant* info as possible. | ||
|
||
## Package version | ||
<!-- YOUR ANSWER --> | ||
|
||
## Error Message & Stack Trace | ||
|
||
## Relevant Information |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!-- CLICK "Preview" FOR INSTRUCTIONS IN A MORE READABLE FORMAT --> | ||
|
||
## Proposed changes | ||
|
||
Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue. | ||
|
||
## Types of changes | ||
|
||
What types of changes does your code introduce? | ||
|
||
_Put an `x` in the boxes that apply_ | ||
|
||
- [ ] Bugfix (non-breaking change which fixes an issue) | ||
- [ ] New feature (non-breaking change which adds functionality) | ||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) | ||
|
||
## Checklist | ||
|
||
_Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code._ | ||
|
||
- [ ] I have read the [CONTRIBUTING](https://github.com/Xstoudi/adonis-geolite2/blob/master/.github/CONTRIBUTING.md) doc | ||
- [ ] Lint and unit tests pass locally with my changes | ||
- [ ] I have added tests that prove my fix is effective or that my feature works. | ||
- [ ] I have added necessary documentation (if appropriate) | ||
|
||
## Further comments | ||
|
||
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Number of days of inactivity before an issue becomes stale | ||
daysUntilStale: 60 | ||
|
||
# Number of days of inactivity before a stale issue is closed | ||
daysUntilClose: 7 | ||
|
||
# Issues with these labels will never be considered stale | ||
exemptLabels: | ||
- "Type: Security" | ||
|
||
# Label to use when marking an issue as stale | ||
staleLabel: "Status: Abandoned" | ||
|
||
# Comment to post when marking an issue as stale. Set to `false` to disable | ||
markComment: > | ||
This issue has been automatically marked as stale because it has not had | ||
recent activity. It will be closed if no further activity occurs. Thank you | ||
for your contributions. | ||
# Comment to post when closing a stale issue. Set to `false` to disable | ||
closeComment: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: test | ||
on: | ||
- push | ||
- pull_request | ||
jobs: | ||
linux: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: | ||
- 16.13.1 | ||
- 17.x | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Install | ||
run: npm install | ||
- name: Run tests | ||
run: npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
node_modules | ||
coverage | ||
test/__app | ||
.DS_STORE | ||
.nyc_output | ||
.idea | ||
.vscode/ | ||
*.sublime-project | ||
*.sublime-workspace | ||
*.log | ||
build | ||
dist | ||
shrinkwrap.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
HUSKY_GIT_PARAMS=$1 node ./node_modules/@adonisjs/mrm-preset/validate-commit/conventional/validate.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
build | ||
docs | ||
*.md | ||
config.json | ||
.eslintrc.json | ||
package.json | ||
*.html | ||
*.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# The MIT License | ||
|
||
Copyright 2023 Xavier Stouder, contributors | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# adonis-geolite2 | ||
> Tagline | ||
[![github-actions-image]][github-actions-url] [![npm-image]][npm-url] [![license-image]][license-url] [![typescript-image]][typescript-url] | ||
|
||
A short brief | ||
|
||
## Installation | ||
|
||
## Usage | ||
|
||
[github-actions-image]: https://github.com/adonis-geolite2/actions/workflows/test.yml | ||
[github-actions-url]: https://img.shields.io/github/workflow/status/adonis-geolite2/test?style=for-the-badge "github-actions" | ||
|
||
[npm-image]: https://img.shields.io/npm/v/adonis-geolite2.svg?style=for-the-badge&logo=npm | ||
[npm-url]: https://npmjs.org/package/adonis-geolite2 "npm" | ||
|
||
[license-image]: https://img.shields.io/npm/l/adonis-geolite2?color=blueviolet&style=for-the-badge | ||
[license-url]: LICENSE.md "license" | ||
|
||
[typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript | ||
[typescript-url]: "typescript" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
declare module '@ioc:Adonis/Core/HttpContext' { | ||
import { Geolite2Contract } from '@ioc:StouderIO/Geolite2' | ||
|
||
interface HttpContextContract { | ||
geolite2: Geolite2Contract | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
declare module '@ioc:StouderIO/Geolite2' { | ||
import { AsnResponse, CityResponse, CountryResponse, Reader } from 'maxmind' | ||
|
||
export interface Geolite2ManagerContract { | ||
init(): Promise<void> | ||
close(): void | ||
|
||
getCountryReader(): Reader<CountryResponse> | ||
getCityReader(): Reader<CityResponse> | ||
getAsnReader(): Reader<AsnResponse> | ||
} | ||
|
||
export interface Geolite2Contract { | ||
country(ip?: string): CountryResponse | null | ||
city(ip?: string): CityResponse | null | ||
asn(ip?: string): AsnResponse | null | ||
} | ||
|
||
const Geolite2Manager: Geolite2ManagerContract | ||
export default Geolite2Manager | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/// <reference path="./context.ts" /> | ||
/// <reference path="./geolite2.ts" /> |
Oops, something went wrong.