Socket
Socket
Sign inDemoInstall

google-font-installer

Package Overview
Dependencies
28
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.8 to 1.0.9

44

cli.js

@@ -10,2 +10,3 @@ #!/usr/bin/env node

var pjson = require('./package.json');
var ncp = require("copy-paste");

@@ -50,2 +51,15 @@ program

program
.command('copy <family...>')
.option('-v, --variants <variants...>', 'Specify variants/weights to copy clipboard, seperated with comma (and no spaces)')
.description('Copy stylesheet link')
.action(function(family, options){
var searchedTerm = family.join(" ");
var variants = options.variants ? options.variants.split(',') : false;
fontList.on('success', function(){
copyFont(searchedTerm, variants);
})
});
program
.version(pjson.version);

@@ -108,2 +122,24 @@

function copyFont(searchedTerm, variants) {
fontList.getFontByName(searchedTerm, function(err, filteredList){
if (err){
printError(err);
return;
}
if (filteredList.data.length === 1) {
var list = filteredList.getFirst();
var cssUrl = variants ? list.cssUrl + ':' + variants.join(',') : list.cssUrl;
ncp.copy(cssUrl, function () {
console.log('"%s" font url has been copied to your clipboard.'.green, searchedTerm);
});
} else {
console.log('Copy failed: unable to find font family "%s". \n'.bold.red, searchedTerm);
searchFont(searchedTerm);
}
})
}
function printFontList(err, list, message){

@@ -116,5 +152,5 @@ if (err) {

} else {
message = message || 'Search reuslts for:'
message = message || 'Search results for:'
if (list._filterTerm)
console.log('%s "%s"\n'.green, message, list._filterTerm.bold.blue);
console.log('%s "%s"\n'.green, message, (list._filterTerm || '').bold.blue);
list.data.forEach(function(el){

@@ -134,3 +170,3 @@ console.log(" * %s".bold.blue, el.family);

result.forEach(function(el){
console.log('%s variant %s downloaded in %s'.green, el.family.bold, el.variant.bold, el.path.underline);
console.log('%s variant %s downloaded in %s'.green, (el.family || '??').bold, (el.variant || '??').bold, (el.path || '??').underline);
})

@@ -141,4 +177,4 @@ console.log('');

function printError(err) {
console.log(err.message.bold.red);
console.log((err.message || err.stack || 'Error, please try again!').bold.red);
process.exit(1);
}

3

package.json
{
"name": "google-font-installer",
"version": "1.0.8",
"version": "1.0.9",
"description": "Download and install Google Web Fonts on your local machine",

@@ -29,2 +29,3 @@ "author": "Lorenzo Zottar <lordgiotto@gmail.com>",

"commander": "^2.9.0",
"copy-paste": "^1.3.0",
"file-type": "^3.6.0",

@@ -31,0 +32,0 @@ "mv": "^2.1.1",

@@ -11,6 +11,6 @@ Google Font Installer

<br>
![how gfi works](https://raw.githubusercontent.com/lordgiotto/google-font-installer/master/gfi.gif)
<br>
### Table of content

@@ -22,2 +22,3 @@

- [Install a font](#install-a-font)
- [Copy font CSS URL](#copy-font-css-url)
- [Examples](#cli-examples)

@@ -80,9 +81,17 @@ - [APIs](#apis)

### Copy font CSS url
```
$ gfi copy [family_name] [-v|--variants comma_separeted_variants]
```
If **family_name** will match more than one family, nothing will be copied: a list of alternatives will help you better specify the font family name.
<a id="cli-examples"></a>
### Examples
Search the _source_ keyword:
**Search the _source_ keyword**
```
$ gfi search source
Search reuslts for: "source"
Search results for: "source"

@@ -102,3 +111,4 @@ * Source Code Pro

```
Download Source Sans Pro 600 and 700italic:
**Download Source Sans Pro 600 and 700italic**
```

@@ -110,3 +120,4 @@ $ gfi download source sans pro -v 600,700italic

```
Install Lato 100
**Install Lato 100**
```

@@ -118,2 +129,12 @@ $ gfi install lato -v 100

```
**Copy font url for Work Sans variants 200, normal and 600**
```
$ gfi copy work sans -v 200,400,600
"work sans" font url has been copied to your clipboard.
```
(*https://fonts.googleapis.com/css?family=Work+Sans:200,400,600* will be available in your clipboard)
# APIs

@@ -120,0 +141,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with โšก๏ธ by Socket Inc