Skip to content

Commit

Permalink
refactor: use google-fonts-helper
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardogobbosouza committed Jul 17, 2020
1 parent 7bb6756 commit a8ed6ca
Show file tree
Hide file tree
Showing 4 changed files with 287 additions and 517 deletions.
292 changes: 0 additions & 292 deletions lib/google-fonts.js

This file was deleted.

8 changes: 5 additions & 3 deletions lib/module.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { resolve } = require('path')
const GoogleFontsHelper = require('./google-fonts')
const GoogleFontsHelper = require('google-fonts-helper')
const logger = require('./logger')

module.exports = function (moduleOptions) {
Expand Down Expand Up @@ -34,7 +34,9 @@ module.exports = function (moduleOptions) {
.filter(link => GoogleFontsHelper.isValidURL(link.href))
.map(link => GoogleFontsHelper.parse(link.href))

googleFontsHelper.merge(fontsParsed)
if (fontsParsed.length) {
googleFontsHelper.merge(...fontsParsed)
}

// construct google fonts url
const url = googleFontsHelper.constructURL()
Expand Down Expand Up @@ -66,7 +68,7 @@ module.exports = function (moduleOptions) {
if (options.inject) {
this.options.css.push(resolve(outputDir, options.stylePath))
}
} catch (e) {
} catch (e) { /* istanbul ignore next */
logger.error(e)
}

Expand Down
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,23 @@
"lib"
],
"scripts": {
"dev": "nuxt example",
"dev": "nuxt test/fixture/basic",
"lint": "eslint --ext .js,.vue .",
"release": "yarn test && standard-version && git push --follow-tags && npm publish",
"test": "yarn lint && jest"
},
"dependencies": {
"consola": "^2.14.0",
"deepmerge": "^4.2.2",
"fs-extra": "^9.0.1",
"got": "^11.5.0"
"google-fonts-helper": "^1.0.1"
},
"devDependencies": {
"@babel/runtime-corejs2": "^7.10.4",
"@babel/runtime-corejs2": "latest",
"@commitlint/cli": "latest",
"@commitlint/config-conventional": "latest",
"@nuxtjs/eslint-config": "latest",
"@nuxtjs/module-test-utils": "latest",
"core-js": "2",
"del": "latest",
"eslint": "latest",
"husky": "latest",
"jest": "latest",
Expand Down
Loading

0 comments on commit a8ed6ca

Please sign in to comment.