@nuxtjs/manifest
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -6,2 +6,13 @@ # Change Log | ||
<a name="1.1.0"></a> | ||
# [1.1.0](https://github.com/nuxt/modules/compare/@nuxtjs/manifest@1.0.1...@nuxtjs/manifest@1.1.0) (2017-05-30) | ||
### Features | ||
* **manifest:** Use loading as theme color as default ([cae4329](https://github.com/nuxt/modules/commit/cae4329)) | ||
<a name="1.0.1"></a> | ||
@@ -8,0 +19,0 @@ ## [1.0.1](https://github.com/nuxt/modules/compare/@nuxtjs/manifest@1.0.0...@nuxtjs/manifest@1.0.1) (2017-05-29) |
22
index.js
@@ -1,4 +0,5 @@ | ||
const fs = require('fs') | ||
const fs = require('fs-extra') | ||
const path = require('path') | ||
const _ = require('lodash') | ||
const hash = require('hash-sum') | ||
@@ -20,3 +21,3 @@ // https://developer.mozilla.org/en-US/docs/Web/Manifest | ||
src: 'icon.png', | ||
sizes: '192x192', | ||
sizes: '512x512', | ||
type: 'image/png' | ||
@@ -28,10 +29,11 @@ } | ||
background_color: '#ffffff', | ||
theme_color: '#3f51b5' | ||
theme_color: (this.options.loading && this.options.loading.color) || '#3f51b5' | ||
} | ||
// Write manifest.json | ||
// TODO: write into .nuxt/dist instead | ||
const manifest = _.defaultsDeep({}, this.options.manifest, defaults) | ||
const manifestFileName = 'manifest.json' | ||
const manifestFilePath = path.resolve(this.options.rootDir, 'static', manifestFileName) | ||
const manifestFileName = `manifest.${hash(manifest)}.json` | ||
const distDir = 'static' //this.options.dev ? 'static' : '.nuxt/dist' | ||
const manifestFilePath = path.resolve(this.options.rootDir, distDir, manifestFileName) | ||
fs.ensureDirSync(path.resolve(this.options.rootDir, distDir)) | ||
fs.writeFileSync(manifestFilePath, JSON.stringify(manifest), 'utf8') | ||
@@ -41,3 +43,4 @@ | ||
if (!_.find(this.options.head.link, {rel: 'manifest'})) { | ||
this.options.head.link.push({rel: 'manifest', href: '/' + manifestFileName}) | ||
const manifestURL = `/${manifestFileName}` //(this.options.dev ? '/' : this.options.build.publicPath ) + manifestFileName | ||
this.options.head.link.push({rel: 'manifest', href: manifestURL}) | ||
} | ||
@@ -59,4 +62,9 @@ | ||
} | ||
// Add theme-color meta | ||
if (manifest.description && !_.find(this.options.head.meta, {name: 'theme-color'})) { | ||
this.options.head.meta.push({name: 'theme-color', content: manifest.theme_color}) | ||
} | ||
} | ||
module.exports.meta = require('./package.json') |
{ | ||
"name": "@nuxtjs/manifest", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"license": "MIT", | ||
@@ -12,4 +12,6 @@ "main": "index.js", | ||
"dependencies": { | ||
"fs-extra": "^3.0.1", | ||
"hash-sum": "^1.0.2", | ||
"lodash": "^4.17.4" | ||
} | ||
} |
@@ -27,1 +27,2 @@ # Manifest | ||
``` | ||
- Add `static/manifest.*.json` to `.gitignore` file. |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
4431
56
28
3
+ Addedfs-extra@^3.0.1
+ Addedhash-sum@^1.0.2
+ Addedfs-extra@3.0.1(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedhash-sum@1.0.2(transitive)
+ Addedjsonfile@3.0.1(transitive)
+ Addeduniversalify@0.1.2(transitive)