Skip to content

Commit

Permalink
fix: fix route generation when in combination with other modules
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrea Faggin committed Sep 20, 2019
1 parent 492d547 commit 03ca25c
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 3 deletions.
15 changes: 15 additions & 0 deletions example/nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,21 @@ module.exports = {
resourceHints: false
},
modules: [
[ 'nuxt-i18n', {
locales: [ 'en', 'fr' ],
defaultLocale: 'en',
vueI18n: {
fallbackLocale: 'en',
messages: {
en: {
welcome: 'Welcome'
},
fr: {
welcome: 'Bienvenue'
}
}
}
} ],
{ handler: require('../') }
],
amp: {
Expand Down
2 changes: 1 addition & 1 deletion lib/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module.exports = function (moduleOptions) {
registerValidator.call(this, options)
}

processRoutes()
processRoutes.call(this)
}

function processRoutes () {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"amphtml-validator": "^1.0.23",
"chalk": "^2.4.2",
"consola": "^2.10.1",
"nuxt-i18n": "^6.2.1",
"qs": "^6.8.0"
},
"devDependencies": {
Expand Down
6 changes: 5 additions & 1 deletion test/module.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ describe('Render home page', () => {
test('Valid amphtml link', () => {
expect(info.amphtml).toEqual(`http://localhost:${port}/amp/`)
})

test('Shouldn\'t have canonical link', () => {
expect(info.canonical).toBeNull()
})
})

describe('Render AMP version of home page', () => {
Expand All @@ -67,7 +71,7 @@ describe('Render AMP version of home page', () => {
source = await response.text()
})

test("Souldn't have amphtml link", () => {
test("Shouldn't have amphtml link", () => {
expect(info.amphtml).toBeNull()
})

Expand Down
44 changes: 43 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1119,6 +1119,14 @@
"@types/istanbul-reports" "^1.1.1"
"@types/yargs" "^13.0.0"

"@kazupon/vue-i18n-loader@^0.4.0":
version "0.4.1"
resolved "https://registry.yarnpkg.com/@kazupon/vue-i18n-loader/-/vue-i18n-loader-0.4.1.tgz#71730a821ff15754eb004629d673b47f8d80fdd1"
integrity sha512-hVznmhnyoUKozGY7pwq/UtPL76UDzb+aiN2YksZZIzCY/MkEqih0MSyEmTGw7+HVWzJRPAlDyoRNR4tWKmkCRw==
dependencies:
js-yaml "^3.13.1"
json5 "^2.1.0"

"@marionebl/sander@^0.6.0":
version "0.6.1"
resolved "https://registry.yarnpkg.com/@marionebl/sander/-/sander-0.6.1.tgz#1958965874f24bc51be48875feb50d642fc41f7b"
Expand Down Expand Up @@ -3201,7 +3209,7 @@ cookie-signature@1.0.6:
resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c"
integrity sha1-4wOogrNCzD7oylE6eZmXNNqzriw=

cookie@0.4.0:
cookie@0.4.0, cookie@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.0.tgz#beb437e7022b3b6d49019d088665303ebe9c14ba"
integrity sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==
Expand Down Expand Up @@ -5685,6 +5693,11 @@ is-glob@^4.0.0, is-glob@^4.0.1:
dependencies:
is-extglob "^2.1.1"

is-https@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/is-https/-/is-https-1.0.0.tgz#9c1dde000dc7e7288edb983bef379e498e7cb1bf"
integrity sha512-1adLLwZT9XEXjzhQhZxd75uxf0l+xI9uTSFaZeSESjL3E1eXSPpO+u5RcgqtzeZ1KCaNvtEwZSTO2P4U5erVqQ==

is-number@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195"
Expand Down Expand Up @@ -6251,6 +6264,11 @@ jest@^24.9.0:
import-local "^2.0.0"
jest-cli "^24.9.0"

js-cookie@^2.2.0:
version "2.2.1"
resolved "https://registry.yarnpkg.com/js-cookie/-/js-cookie-2.2.1.tgz#69e106dc5d5806894562902aa5baec3744e9b2b8"
integrity sha512-HvdH2LzI/EAZcUwA8+0nKNtWHqS+ZmijLA30RwZA0bo7ToCckjK5MkGhjED9KoRcXO6BaGI3I9UIzSA1FKFPOQ==

js-levenshtein@^1.1.3:
version "1.1.6"
resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.6.tgz#c6cee58eb3550372df8deb85fad5ce66ce01d59d"
Expand Down Expand Up @@ -7326,6 +7344,20 @@ nuxt-edge@^2.10.0-26147535.e9c4bcfe:
"@nuxt/opencollective" "^0.3.0"
"@nuxt/webpack-edge" "2.10.0-26147535.e9c4bcfe"

nuxt-i18n@^6.2.1:
version "6.2.1"
resolved "https://registry.yarnpkg.com/nuxt-i18n/-/nuxt-i18n-6.2.1.tgz#c8148d45543a05837a2edbf199d9e6826ba80ccd"
integrity sha512-kpreVj4/VaagGsW9wVRTnNGBbiR/jWyOwJ1PiFd+GNAGGK4jmuQmugniB3/s4Z8yJH9xp5tZRZc3XJK/lz839Q==
dependencies:
"@babel/parser" "^7.5.5"
"@babel/traverse" "^7.5.5"
"@kazupon/vue-i18n-loader" "^0.4.0"
cookie "^0.4.0"
is-https "^1.0.0"
js-cookie "^2.2.0"
vue-i18n "^8.12.0"
vue-i18n-extensions "^0.2.1"

nwsapi@^2.0.7:
version "2.1.4"
resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.1.4.tgz#e006a878db23636f8e8a67d33ca0e4edf61a842f"
Expand Down Expand Up @@ -10512,6 +10544,16 @@ vue-hot-reload-api@^2.3.0:
resolved "https://registry.yarnpkg.com/vue-hot-reload-api/-/vue-hot-reload-api-2.3.3.tgz#2756f46cb3258054c5f4723de8ae7e87302a1ccf"
integrity sha512-KmvZVtmM26BQOMK1rwUZsrqxEGeKiYSZGA7SNWE6uExx8UX/cj9hq2MRV/wWC3Cq6AoeDGk57rL9YMFRel/q+g==

vue-i18n-extensions@^0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/vue-i18n-extensions/-/vue-i18n-extensions-0.2.1.tgz#86ebea45a1f9c9594cd124f264e107aea193d7dd"
integrity sha512-xBrItI7bEwBnG7eAlnyUARP41JYYn2+ABMR8q1Yh5FM9hHCbs4XPZwG+4+FPeIZ6b5gYk4YUP//m+fWiuU9z9A==

vue-i18n@^8.12.0:
version "8.14.1"
resolved "https://registry.yarnpkg.com/vue-i18n/-/vue-i18n-8.14.1.tgz#0ca0a2742c14e0144481655157fffcc7cc313e50"
integrity sha512-uHzw5GTFyf/TmjJXveSl3L4CG61KI4lvhKOQvx8W4Y8P2LZ3v3l/qw4KRs1C6pWyjkfY9p0rezYNFO5YzMEQ8A==

vue-loader@^15.7.1:
version "15.7.1"
resolved "https://registry.yarnpkg.com/vue-loader/-/vue-loader-15.7.1.tgz#6ccacd4122aa80f69baaac08ff295a62e3aefcfd"
Expand Down

0 comments on commit 03ca25c

Please # to comment.