Permalink
Browse files

fix(manifest): sanetize options

  • Loading branch information...
pi0 committed Jun 4, 2017
1 parent c2cabb6 commit b8497a09b11cc57d9583216f446d34605b8cf70e
Showing with 5 additions and 6 deletions.
  1. +5 −6 modules/manifest/index.js
@@ -6,10 +6,8 @@ const hash = require('hash-sum')
const fixUrl = url => url.replace(/(?!^)\/\//g, '/').replace(':/', '://')// // ~> /
module.exports = function nuxtManifest(options) {
this.options.manifest = options || this.options.manifest || {}
const routerBase = this.options.router.base
const defaultName = this.options.manifest.name || process.env.npm_package_name
const defaultName = options.name || this.options.manifest.name || process.env.npm_package_name
const defaultShortName = process.env.npm_package_name || defaultName
const defaults = {
@@ -18,7 +16,7 @@ module.exports = function nuxtManifest(options) {
description: defaultName,
icons: [
{
src: fixUrl(`${routerBase}/icon.png`),
src: fixUrl(`${routerBase}icon.png`),
sizes: '512x512',
type: 'image/png'
}
@@ -31,8 +29,9 @@ module.exports = function nuxtManifest(options) {
}
// Write manifest.json
const manifest = _.defaultsDeep({}, this.options.manifest, defaults)
const manifestFileName = 'manifest.json' //`manifest.${hash(manifest)}.json`
const manifest = _.defaultsDeep({}, options, this.options.manifest, defaults)
delete manifest.src
const manifestFileName = `manifest.${hash(manifest)}.json`
const distDir = 'static'
const manifestFilePath = path.resolve(this.options.rootDir, distDir, manifestFileName)
console.log(manifestFilePath)

0 comments on commit b8497a0

Please sign in to comment.