Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Commit

Permalink
fix(index): add missing slash to default distfolder path
Browse files Browse the repository at this point in the history
  • Loading branch information
celinekurpershoek committed Jan 16, 2020
1 parent c97b77b commit 75824f7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ Add `nuxt-twa-module` to `modules` section of `nuxt.config.js`.
/* optional */
/* overwrite default location for icon */
iconPath: '/static/icon.png'
/* Overwrite folder where to put .wellknown */
distFolder: '.nuxt/dist/client',
}],
]
}
Expand Down
16 changes: 8 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const fs = require('fs')
const rimraf = require('rimraf')
const consola = require('consola')
const ncp = require('ncp')
const tmp = require('tmp-promise')
const tmp = require('tmp-promise')
const asyncRimRaf = promisify(rimraf)
const asyncNcp = promisify(ncp)

Expand All @@ -13,7 +13,7 @@ const { generateAssetLinksFile } = require('./lib/generate-asset-links-file')

const moduleRoot = __dirname

module.exports = function nuxtTwa (options) {
module.exports = function nuxtTwa(options) {
const { rootDir } = this.nuxt.options
const pckg = require(rootDir + '/package.json')
const defaultOptions = {
Expand All @@ -22,26 +22,26 @@ module.exports = function nuxtTwa (options) {
versionCode: Number(String(pckg.version).replace(/\./g, '')),
versionName: pckg.version,
iconPath: '/static/icon.png',
distFolder: rootDir + '.nuxt/dist/client',
distFolder: rootDir + '/.nuxt/dist/client',
androidFolder: rootDir + '/android',
statusBarColor: options.statusBarColor || '#fff'
}

this.nuxt.hook('build:before', async () => {

options = {
...defaultOptions,
...options,
}

let tempDir
let tmpRes

try {
tmpRes = await tmp.dir()
tempDir = tmpRes.path + '/android'
} catch (err) {
throw('Temperary directory generation failed:', err)
throw ('Temperary directory generation failed:', err)
}

try {
Expand All @@ -63,7 +63,7 @@ module.exports = function nuxtTwa (options) {
await generateIcons(iconPath, androidIconsPath)
} catch (err) {
return consola.error('Generating icons failed', err)
}
}

try {
await asyncNcp(tempDir, options.androidFolder)
Expand Down

0 comments on commit 75824f7

Please sign in to comment.