-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add check to determine user has either free or pro version installe…
…d. Add error / notice in console. - Update README with new installation requirements (defining a specific package) - Add upgrade guide for 1.x -> 2.0 users - Update changelog
- Loading branch information
1 parent
11a7fbe
commit 2656c38
Showing
6 changed files
with
37 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Upgrading Versions | ||
|
||
## 1.x to 2.0 | ||
Version 2.0 of fontawesome-subset removes the required dependency for `@fortawesome/fontawesome-free`. | ||
|
||
### Pro Users | ||
For Pro users, this release should be backwards compatible since we're only removing the required dependency for the free version. | ||
|
||
### Free Users | ||
For Free users, this means you'll have to manually specify / save the dependency, as noted in the updated readme. | ||
```sh | ||
npm install --save-dev @fortawesome/fontawesome-free | ||
``` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
* Author: Logan Graham <[email protected]> | ||
*/ | ||
|
||
import { readFileSync, existsSync, writeFileSync } from "fs"; | ||
import { existsSync, readFileSync, writeFileSync } from "fs"; | ||
import { resolve } from "path"; | ||
import { sync as makeDirSync } from "mkdirp"; | ||
import { FontAwesomeOptions, Subset, SubsetOption } from "./types"; | ||
|
@@ -62,6 +62,12 @@ function fontawesomeSubset(subset: SubsetOption, outputDir: string, options: Fon | |
}; | ||
const fontTypes = Object.keys(fontMap); | ||
|
||
// Check to see if the user has either free, or pro installed. | ||
if (!(existsSync("node_modules/@fortawesome/fontawesome-free") || existsSync("node_modules/@fortawesome/fontawesome-pro"))) { | ||
console.error("Unable to find either the Free or Pro FontAwesome files in node_modules folder. Double-check that you have your preferred fontawesome package as a dependency in `package.json` and rerun the installation."); | ||
return; | ||
} | ||
|
||
// If 'subset' is set to array, turn into object defaulted for 'solid' use (fontawesome free) | ||
if (Array.isArray(subset)) { | ||
subset = { solid: subset }; | ||
|
@@ -84,7 +90,7 @@ function fontawesomeSubset(subset: SubsetOption, outputDir: string, options: Fon | |
const svgFilePath = `node_modules/@fortawesome/fontawesome-${options.package}/webfonts/${svgFileName}.svg`; | ||
|
||
if (!existsSync(svgFilePath)) { | ||
console.error("Unable to find SVG file. Could be missing fontawesome dependencies. Make sure you have your preferred FontAwesome package in package.json and try running `npm install` or changing the font style."); | ||
console.warn(`Unable to find SVG font file for requested font style '${fontFamily}'. Skipping.`); | ||
continue; | ||
} | ||
|
||
|