Skip to content

Commit 1d38b1f

Browse files
committed
Actions added.
1 parent a1f74af commit 1d38b1f

File tree

12 files changed

+2615
-67
lines changed

12 files changed

+2615
-67
lines changed

.babelrc

Lines changed: 0 additions & 7 deletions
This file was deleted.

.eslintrc.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"extends": [
3+
"eslint:recommended",
4+
"plugin:node/recommended"
5+
],
6+
"parserOptions": {
7+
// Only ESLint 6.2.0 and later support ES2020.
8+
"ecmaVersion": 2020
9+
},
10+
"env": {
11+
"node": true,
12+
"mocha": true
13+
},
14+
"rules": {
15+
"node/exports-style": ["error", "module.exports"],
16+
"node/file-extension-in-import": ["error", "always"],
17+
"node/prefer-global/buffer": ["error", "always"],
18+
"node/prefer-global/console": ["error", "always"],
19+
"node/prefer-global/process": ["error", "always"],
20+
"node/prefer-global/url-search-params": ["error", "always"],
21+
"node/prefer-global/url": ["error", "always"],
22+
"node/prefer-promises/dns": "error",
23+
"node/prefer-promises/fs": "error"
24+
}
25+
}

.github/workflows/build.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: build
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
10+
strategy:
11+
matrix:
12+
node-version: [8.x, 10.x, 12.x]
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Use Node.js ${{ matrix.node-version }}
17+
uses: actions/setup-node@v1
18+
with:
19+
node-version: ${{ matrix.node-version }}
20+
- run: npm install
21+
- run: npm run build --if-present
22+
- run: npm test
23+
env:
24+
CI: true

.github/workflows/publish.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: publish
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: actions/setup-node@v1
14+
with:
15+
node-version: 12
16+
- run: npm ci
17+
- run: npm test
18+
19+
publish-npm:
20+
needs: build
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v2
24+
- uses: actions/setup-node@v1
25+
with:
26+
node-version: 12
27+
registry-url: https://registry.npmjs.org/
28+
- run: npm ci
29+
- run: npm publish
30+
env:
31+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

.travis.yml

Lines changed: 0 additions & 4 deletions
This file was deleted.

README.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# http-auth-koa
22
[Koa framework](http://koajs.com/) integration with [http-auth](https://github.com/http-auth/http-auth) module.
33

4-
[![Build Status](https://api.travis-ci.org/http-auth/http-auth-koa.png)](https://travis-ci.org/http-auth/http-auth-koa)
4+
[![build](https://github.com/http-auth/http-auth-koa/workflows/build/badge.svg)](https://github.com/http-auth/http-auth-koa/actions?query=workflow%3Abuild)
55

66
## Installation
77

@@ -19,15 +19,16 @@ $ npm install http-auth-koa
1919
## Usage
2020
```javascript
2121
// Authentication module.
22-
import auth from 'http-auth'
23-
import koaAuth from 'http-auth-koa'
22+
const auth = require('http-auth');
23+
const koaAuth = require('http-auth-koa');
24+
2425
const basic = auth.basic({
25-
realm: "Simon Area.",
26-
file: __dirname + "/../data/users.htpasswd"
26+
realm: "Simon Area.",
27+
file: __dirname + "/../data/users.htpasswd"
2728
});
2829

2930
// Koa setup.
30-
import Koa from 'koa'
31+
const Koa = require('koa');
3132
const app = new Koa();
3233

3334
// Setup basic handler.
@@ -38,6 +39,12 @@ app.use(async (ctx, next) => {
3839

3940
// Setup auth.
4041
app.use(koaAuth(basic));
42+
43+
// Start server.
44+
app.listen(1337, function () {
45+
// Log URL.
46+
console.log("Server running at http://127.0.0.1:1337/");
47+
});
4148
```
4249

4350

@@ -58,15 +65,6 @@ You can find list of issues using **[this link](http://github.com/http-auth/http
5865
- **[Node.js](http://nodejs.org)** - Event-driven I/O server-side JavaScript environment based on V8.
5966
- **[npm](http://npmjs.org)** - Package manager. Installs, publishes and manages node programs.
6067

61-
## Development dependencies
62-
63-
- **[babel](https://babeljs.io/)** - compiler for writing next generation JavaScript.
64-
- **[mocha](https://mochajs.org/)** - simple, flexible, fun javascript test framework for node.js & the browser.
65-
- **[chai](http://chaijs.com/)** - BDD / TDD assertion framework for node.js and the browser that can be paired with any testing framework.
66-
- **[request](https://github.com/request/request/)** - Simplified HTTP request client.
67-
- **[koa](http://koajs.com/)** - next generation web framework for node.js.
68-
- **[http-auth](https://github.com/http-auth/http-auth)** - Node.js package for HTTP basic and digest access authentication.
69-
7068
## License
7169

7270
The MIT License (MIT)

examples/app.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
// Authentication module.
2-
import auth from 'http-auth'
3-
import koaAuth from '../src/index'
2+
const auth = require('http-auth');
3+
const koaAuth = require('../src/index');
4+
45
const basic = auth.basic({
56
realm: "Simon Area.",
67
file: __dirname + "/../data/users.htpasswd"
78
});
89

910
// Koa setup.
10-
import Koa from 'koa'
11+
const Koa = require('koa');
1112
const app = new Koa();
1213

1314
// Setup basic handler.

examples/index.js

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)