diff --git a/src/index.js b/lib/module.js similarity index 64% rename from src/index.js rename to lib/module.js index 13d28b17b..6819b30ed 100644 --- a/src/index.js +++ b/lib/module.js @@ -1,7 +1,7 @@ const { resolve } = require('path') const merge = require('lodash/merge') -export default function module (moduleOptions) { +module.exports = function (moduleOptions) { // Apply defaults const defaults = { login: { @@ -30,11 +30,11 @@ export default function module (moduleOptions) { const options = merge(defaults, moduleOptions, this.options.auth) // Plugin - this.addPlugin({ src: resolve(__dirname, '../templates/auth.plugin.js'), fileName: 'auth.plugin.js' }) + this.addPlugin({ src: resolve(__dirname, './templates/auth.plugin.js'), fileName: 'auth.plugin.js' }) // Middleware - this.addTemplate({ src: resolve(__dirname, '../templates/auth.middleware.js'), fileName: 'auth.middleware.js', options }) + this.addTemplate({ src: resolve(__dirname, './templates/auth.middleware.js'), fileName: 'auth.middleware.js', options }) // Store - this.addTemplate({ src: resolve(__dirname, '../templates/auth.store.js'), fileName: 'auth.store.js', options }) + this.addTemplate({ src: resolve(__dirname, './templates/auth.store.js'), fileName: 'auth.store.js', options }) } diff --git a/templates/auth.middleware.js b/lib/templates/auth.middleware.js similarity index 100% rename from templates/auth.middleware.js rename to lib/templates/auth.middleware.js diff --git a/templates/auth.plugin.js b/lib/templates/auth.plugin.js similarity index 100% rename from templates/auth.plugin.js rename to lib/templates/auth.plugin.js diff --git a/templates/auth.store.js b/lib/templates/auth.store.js similarity index 100% rename from templates/auth.store.js rename to lib/templates/auth.store.js diff --git a/package.json b/package.json index 125653545..3e8987b35 100644 --- a/package.json +++ b/package.json @@ -11,22 +11,19 @@ "name": "Herberts Cruz " } ], - "main": "dist/index.js", + "main": "lib/module.js", "repository": "https://github.com/nuxt-community/auth-module", "publishConfig": { "access": "public" }, "scripts": { - "build": "nuxt-module", - "watch": "nuxt-module --watch", "lint": "eslint lib src test", "lint-fix": "eslint --fix lib src test", - "test": "NODE_ENV=test npm run build && npm run lint && jest", - "release": "standard-version && git push --follow-tags && npm publish", - "prepare": "npm run build" + "test": "npm run lint && jest", + "release": "standard-version && git push --follow-tags && npm publish" }, "eslintIgnore": [ - "*.template.*" + "lib/templates" ], "files": [ "lib", diff --git a/test/fixture/nuxt.config.js b/test/fixture/nuxt.config.js index c15dfa88b..57ba1daeb 100644 --- a/test/fixture/nuxt.config.js +++ b/test/fixture/nuxt.config.js @@ -5,7 +5,7 @@ module.exports = { resourceHints: false }, modules: [ - ['~/../..', {}], + ['@@', {}], '@nuxtjs/axios' ] } diff --git a/yarn.lock b/yarn.lock index 651778b1c..07aecb610 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,15 +2,14 @@ # yarn lockfile v1 -"@nuxtjs/axios@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@nuxtjs/axios/-/axios-4.0.0.tgz#8d99d253671aa5a2042dcfada7f2f1343594c5ad" +"@nuxtjs/axios@^4.0.1": + version "4.4.0" + resolved "https://registry.yarnpkg.com/@nuxtjs/axios/-/axios-4.4.0.tgz#33f1b00a3d32978a51c370ec48fd7844c6b40f89" dependencies: axios "^0.16.2" chalk "^2.1.0" - debug "^3.0.1" - nuxt "^1.0.0-rc8" - whatwg-url "^6.1.0" + debug "^3.1.0" + whatwg-url "^6.3.0" "@nuxtjs/youch@3.0.2": version "3.0.2" @@ -1880,6 +1879,12 @@ debug@^3.0.1: dependencies: ms "2.0.0" +debug@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" + dependencies: + ms "2.0.0" + debug@~0.7.4: version "0.7.4" resolved "https://registry.yarnpkg.com/debug/-/debug-0.7.4.tgz#06e1ea8082c2cb14e39806e22e2f6f757f92af39" @@ -4495,7 +4500,7 @@ nuxt-module-builder@latest: rollup-plugin-node-resolve "^3.0.0" standard-version "^4.2.0" -nuxt@^1.0.0-rc6, nuxt@^1.0.0-rc8: +nuxt@^1.0.0-rc6: version "1.0.0-rc8" resolved "https://registry.yarnpkg.com/nuxt/-/nuxt-1.0.0-rc8.tgz#e073f1b0ce8938b4d0552b1ef68ea70a28d77945" dependencies: @@ -5517,6 +5522,10 @@ punycode@^1.2.4, punycode@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" +punycode@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.0.tgz#5f863edc89b96db09074bad7947bf09056ca4e7d" + q@^1.1.2, q@^1.4.1: version "1.5.0" resolved "https://registry.yarnpkg.com/q/-/q-1.5.0.tgz#dd01bac9d06d30e6f219aecb8253ee9ebdc308f1" @@ -6457,6 +6466,12 @@ tough-cookie@>=2.3.0, tough-cookie@^2.3.2, tough-cookie@~2.3.0: dependencies: punycode "^1.4.1" +tr46@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-1.0.1.tgz#a8b13fd6bfd2489519674ccde55ba3693b706d09" + dependencies: + punycode "^2.1.0" + tr46@~0.0.3: version "0.0.3" resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" @@ -6863,6 +6878,14 @@ whatwg-url@^6.1.0: tr46 "~0.0.3" webidl-conversions "^4.0.1" +whatwg-url@^6.3.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-6.3.0.tgz#597ee5488371abe7922c843397ddec1ae94c048d" + dependencies: + lodash.sortby "^4.7.0" + tr46 "^1.0.0" + webidl-conversions "^4.0.1" + whet.extend@~0.9.9: version "0.9.9" resolved "https://registry.yarnpkg.com/whet.extend/-/whet.extend-0.9.9.tgz#f877d5bf648c97e5aa542fadc16d6a259b9c11a1"