Skip to content

Commit

Permalink
Merge a72aa64 into 08e8bbe
Browse files Browse the repository at this point in the history
  • Loading branch information
9renpoto committed Dec 7, 2018
2 parents 08e8bbe + a72aa64 commit ca71c1e
Show file tree
Hide file tree
Showing 8 changed files with 3,258 additions and 2,830 deletions.
1 change: 0 additions & 1 deletion .babelrc
@@ -1,6 +1,5 @@
{
"presets": [
"@babel/preset-env",
"next/babel"
]
}
8 changes: 7 additions & 1 deletion .travis.yml
@@ -1,4 +1,10 @@
language: node_js
node_js:
- "lts/*"
- "6"
script: npm run testCI
env:
matrix:
- CMD=build
- CMD=lint
- CMD=testCI
script: npm run $CMD
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -19,7 +19,7 @@ npm install next-routes --save
Create `routes.js` inside your project:

```javascript
const routes = require('next-routes')
const routes = require('next-routes').default

// Name Page Pattern
module.exports = routes() // ---- ---- -----
Expand Down
6,043 changes: 3,230 additions & 2,813 deletions package-lock.json

Large diffs are not rendered by default.

19 changes: 9 additions & 10 deletions package.json
Expand Up @@ -38,25 +38,24 @@
"react": "^15.4.2 || ^16"
},
"devDependencies": {
"@babel/cli": "^7.0.0-beta.47",
"@babel/core": "^7.0.0-beta.47",
"@babel/preset-env": "^7.0.0-beta.47",
"@types/next": "^2.4.8",
"@babel/cli": "^7.1.5",
"@babel/core": "^7.1.6",
"@types/next": "^7.0.5",
"@types/node": "^10.1.2",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^8.2.1",
"babel-jest": "^22.4.3",
"concurrently": "^3.5.0",
"babel-eslint": "^10.0.1",
"babel-jest": "^23.6.0",
"concurrently": "^4.1.0",
"coveralls": "^3.0.0",
"del-cli": "^1.1.0",
"jest": "^22.4.3",
"next": "^6.0.0",
"jest": "^23.6.0",
"next": "^7.0.2",
"prop-types": "^15.6.0",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"react-test-renderer": "^16.0.0",
"standard": "^11.0.1",
"typescript": "^2.7.2"
"typescript": "^3.2.1"
},
"author": "fridays",
"license": "MIT",
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Expand Up @@ -4,9 +4,9 @@ import {parse} from 'url'
import NextLink from 'next/link'
import NextRouter from 'next/router'

module.exports = opts => new Routes(opts)
export default opts => new Routes(opts)

class Routes {
export class Routes {
constructor ({
Link = NextLink,
Router = NextRouter
Expand Down
9 changes: 8 additions & 1 deletion typings/next-routes.d.ts
Expand Up @@ -44,11 +44,18 @@ export interface Registry {
Router: Router;
}

export default class Routes implements Registry {
export class Routes implements Registry {
getRequestHandler(app: Server, custom?: HTTPHandler): HTTPHandler;
add(name: string, pattern?: string, page?: string): this;
add(pattern: string, page: string): this;
add(options: { name: string; pattern?: string; page?: string }): this;
Link: ComponentType<LinkProps>;
Router: Router;
}

export interface RoutesOptions {
Link: ComponentType<LinkProps>;
Router: Router;
}

export default function makeRoutesRegistry (options?: RoutesOptions): Routes;
2 changes: 1 addition & 1 deletion typings/tests/basic.ts
@@ -1,6 +1,6 @@
import * as http from "http";
import * as next from "next";
import Routes from "../..";
import { Routes } from "../..";

const routes = new Routes();

Expand Down

0 comments on commit ca71c1e

Please sign in to comment.