@nuxtjs/router
Advanced tools
Comparing version 1.2.1 to 1.3.0
@@ -5,2 +5,17 @@ # Change Log | ||
<a name="1.3.0"></a> | ||
# [1.3.0](https://github.com/nuxt-community/router-module/compare/v1.2.1...v1.3.0) (2019-02-13) | ||
### Bug Fixes | ||
* **module:** add hook `build:before` when disabled `keepDefaultRouter` ([58109e4](https://github.com/nuxt-community/router-module/commit/58109e4)) | ||
### Features | ||
* **module:** import router on plugin, inject defaultRouter if enabled ([ec998ad](https://github.com/nuxt-community/router-module/commit/ec998ad)) | ||
<a name="1.2.1"></a> | ||
@@ -7,0 +22,0 @@ ## [1.2.1](https://github.com/nuxt-community/router-module/compare/v1.1.0...v1.2.1) (2019-02-11) |
@@ -1,2 +0,2 @@ | ||
const { resolve } = require('path') | ||
const { relative, resolve } = require('path') | ||
const { existsSync } = require('fs') | ||
@@ -26,6 +26,10 @@ const consola = require('consola') | ||
// Add router file path as the main template for routing | ||
this.addTemplate({ | ||
// Add plugin to import router file path as the main template for routing | ||
this.addPlugin({ | ||
src: resolve(__dirname, 'plugin.js'), | ||
fileName: 'router.js', | ||
src: routerFilePath | ||
options: { | ||
routerFilePath: relative(this.options.buildDir, routerFilePath).replace(/\/+/g, '/'), | ||
keepDefaultRouter: options.keepDefaultRouter | ||
} | ||
}) | ||
@@ -35,7 +39,7 @@ | ||
if (!options.keepDefaultRouter) { | ||
this.nuxt.options.build.createRoutes = () => { | ||
return [] | ||
} | ||
return | ||
return this.nuxt.hook('build:before', () => { | ||
this.nuxt.options.build.createRoutes = () => { | ||
return [] | ||
} | ||
}) | ||
} | ||
@@ -42,0 +46,0 @@ |
{ | ||
"name": "@nuxtjs/router", | ||
"version": "1.2.1", | ||
"description": "Nuxt module to use router.js instead of pages/ directory", | ||
"version": "1.3.0", | ||
"description": "Nuxt module to use router.js instead of pages/ directory.", | ||
"license": "MIT", | ||
@@ -24,3 +24,3 @@ "contributors": [ | ||
"dependencies": { | ||
"consola": "^2.4.0" | ||
"consola": "^2.4.1" | ||
}, | ||
@@ -44,2 +44,3 @@ "devDependencies": { | ||
"eslint-plugin-vue": "latest", | ||
"get-port": "latest", | ||
"husky": "latest", | ||
@@ -46,0 +47,0 @@ "jest": "latest", |
@@ -10,3 +10,3 @@ # Nuxt Router Module | ||
> Nuxt module to use router.js instead of pages/ directory | ||
> Nuxt module to use router.js instead of pages/ directory. | ||
@@ -55,2 +55,22 @@ [📖 **Release Notes**](https://github.com/nuxt-community/router-module/releases) | ||
## Options | ||
### `path` | ||
- Default: `srcDir` | ||
Location of you route file. | ||
### `fileName` | ||
- Default: `router.js` | ||
Name of you route file. | ||
### `keepDefaultRouter` | ||
- Default: `false` | ||
Can access the default router. | ||
## Usage | ||
@@ -94,5 +114,3 @@ | ||
```js | ||
import { createRouter as createDefaultRouter } from './defaultRouter' | ||
export function createRouter(ssrContext) { | ||
export function createRouter(ssrContext, createDefaultRouter) { | ||
const defaultRouter = createDefaultRouter(ssrContext) | ||
@@ -111,6 +129,2 @@ return new Router({ | ||
### Customize Routes Directory or Filename | ||
If you use the module with fileName `{fileName: 'my-router.js'}` and/or `{path: 'custom-dir'}` you can customize the location of you route files. | ||
## License | ||
@@ -125,11 +139,16 @@ | ||
[npm-version-href]: https://npmjs.com/package/@nuxtjs/router | ||
[npm-downloads-src]: https://img.shields.io/npm/v/@nuxtjs/router/latest.svg?style=flat-square | ||
[npm-downloads-href]: https://npmjs.com/package/@nuxtjs/router | ||
[circle-ci-src]: https://img.shields.io/circleci/project/github/nuxt-community/router-module.svg?style=flat-square | ||
[circle-ci-href]: https://circleci.com/gh/nuxt-community/router-module | ||
[codecov-src]: https://img.shields.io/codecov/c/github/nuxt-community/router-module.svg?style=flat-square | ||
[codecov-href]: https://codecov.io/gh/nuxt-community/router-module | ||
[david-dm-src]: https://david-dm.org/nuxt-community/router-module/status.svg?style=flat-square | ||
[david-dm-href]: https://david-dm.org/nuxt-community/router-module | ||
[standard-js-src]: https://img.shields.io/badge/code_style-standard-brightgreen.svg?style=flat-square | ||
[standard-js-href]: https://standardjs.com |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9648
6
61
150
23
Updatedconsola@^2.4.1