Skip to content

Commit

Permalink
fix: Release
Browse files Browse the repository at this point in the history
Merge #67, #75, #68, #78, #79
  • Loading branch information
tancredi authored Dec 24, 2020
2 parents 606c8c8 + 7aa5929 commit 15d4944
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 20 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Enforce Unix newlines
* text=auto eol=lf
39 changes: 25 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
![Screenshot](assets/screenshot.png)

<blockquote align="center">
Easy-to-use, pre-configured cli tool to generate web-font icon kits from .svg files
Easy-to-use, pre-configured CLI tool to generate web-font icon kits from SVG files
</blockquote>

<p align="center">
<img src="https://github.com/tancredi/fantasticon/workflows/Test/badge.svg" alt="Test status" />
<img src="https://github.com/tancredi/fantasticon/workflows/Release/badge.svg" alt="Release status" />
<img src="https://github.com/tancredi/fantasticon/workflows/Test/badge.svg" alt="Test status">
<img src="https://github.com/tancredi/fantasticon/workflows/Release/badge.svg" alt="Release status">
</p>

### Intro
Expand All @@ -21,23 +21,23 @@ It also generates TypeScript types, JSON maps of the generated code-points, allo

### Install

```
```bash
npm install -g fantasticon
```

## Use

### Quick usage

```
```bash
fantasticon my-icons -o icon-dist
```

### Command-line

**Note:** Not all options can be specified through the command line - for `formatOptions`, `pathOptions` and `templates` use a [configuration file](#configuration-file) or the javaScript API.
**Note:** Not all options can be specified through the command line - for `formatOptions`, `pathOptions` and `templates` use a [configuration file](#configuration-file) or the JavaScript API.

```bash
```
Usage: fantasticon [options] [input-dir]
Options:
Expand All @@ -52,17 +52,17 @@ Options:
--normalize <number> normalize icons by scaling them to the height of the highest icon
-r, --round [bool] setup the SVG path rounding [10e12]
--selector <value> use a CSS selector instead of 'tag + prefix' (default: null)
-, --prefix <value> CSS class prefix (default: icon)
-p, --prefix <value> CSS class prefix (default: icon)
--tag <value> CSS base tag for icons (default: i)
-u, --fonts-url <value> public url to the fonts directory (used in the generated CSS)
-u, --fonts-url <value> public URL to the fonts directory (used in the generated CSS)
--debug display errors stack trace (default: false)
--silent run with no logs (default: false)
--help display help for command
```

### Configuration file

Some options (specifically, `formatOptions` and `pathOptions`) cannot be passed to the cli directly.
Some options (specifically, `formatOptions` and `pathOptions`) cannot be passed to the CLI directly.

To have more control and better readability, you can create a simple configuration file.

Expand All @@ -72,7 +72,7 @@ By default, `fantasticon` will look for one of following files in the working di
.fantasticonrc | fantasticonrc | .fantasticonrc.json | fantasticonrc.json | .fantasticonrc.js | fantasticonrc.js
```

You can specify a custom --config option with your configuration file path.
You can specify a custom `--config` option with your configuration file path.

Here's an example `.fantasticonrc.js`:

Expand All @@ -85,9 +85,14 @@ module.exports = {
fontsUrl: '/static/fonts',
formatOptions: {
// Pass options directly to `svgicons2svgfont`
svg: { metadata: { foo: 'bar' }, ascent: 0.5 },
svg: {
metadata: {
foo: 'bar'
},
ascent: 0.5
},
json: {
// render the JSON human readable with two spaces indent (default is none, so minified)
// render the JSON human readable with two spaces indentation (default is none, so minified)
indent: 2
},
ts: {
Expand All @@ -98,7 +103,9 @@ module.exports = {
}
},
// Use a custom Handlebars template
templates: { css: './my-custom-tp.css.hbs' },
templates: {
css: './my-custom-tp.css.hbs'
},
pathOptions: {
ts: './src/types/icon-types.ts',
json: './misc/icon-codepoints.json'
Expand Down Expand Up @@ -145,6 +152,10 @@ generateFonts({
}).then(results => console.log(results));
```

### Contribute

PRs are always welcome. If you need help questions, want to bounce ideas or just say hi, [join the Discord channel](https://discord.gg/BXAY3Kc3mp).

### License

Copyright (c) 2020 Tancredi Trugenberger. - Released under the [MIT license](https://github.com/tancredi/fantasticon/blob/master/LICENSE)
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"license": "MIT",
"scripts": {
"test": "jest",
"build": "rm -rf lib && tsc --project ./tsconfig.json",
"build": "rimraf lib && tsc --project ./tsconfig.json",
"watch": "tsc --project ./tsconfig.json --watch",
"lint": "prettier --check ."
},
Expand Down Expand Up @@ -60,6 +60,7 @@
"jest": "^26.6.3",
"mock-fs": "^4.13.0",
"prettier": "^2.2.1",
"rimraf": "^3.0.2",
"semantic-release": "^17.3.0",
"ts-jest": "^26.4.4",
"typescript": "^4.1.3"
Expand Down
2 changes: 1 addition & 1 deletion src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ const config = () => {

.option(
'-u, --fonts-url <value>',
'public url to the fonts directory (used in the generated CSS)'
'public URL to the fonts directory (used in the generated CSS)'
)

.option('--debug', 'display errors stack trace' + printDefaultValue(false))
Expand Down
2 changes: 1 addition & 1 deletion src/cli/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const getLogger = (debug = false, silent = false) => ({
},

start(loadedConfigPath: string = null) {
this.log(color.yellow(`Generating font kit..`));
this.log(color.yellow(`Generating font kit...`));

if (loadedConfigPath) {
this.log(
Expand Down
2 changes: 1 addition & 1 deletion src/utils/__tests__/assets.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { loadPaths, loadAssets, writeAssets } from '../assets';
import { writeFile } from '../../utils/fs-async';
import { writeFile } from '../fs-async';

const writeFileMock = (writeFile as any) as jest.Mock;

Expand Down
2 changes: 1 addition & 1 deletion src/utils/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import glob from 'glob';
import { promisify } from 'util';
import { resolve, relative, join } from 'path';
import { getIconId } from './icon-id';
import { writeFile } from '../utils/fs-async';
import { writeFile } from './fs-async';
import { RunnerOptions } from '../types/runner';
import { GeneratedAssets } from '../generators/generate-assets';

Expand Down
2 changes: 1 addition & 1 deletion src/utils/validation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { checkPath } from '../utils/fs-async';
import { checkPath } from './fs-async';

export const parseNumeric = (value: string) => {
const out = Number(value);
Expand Down

0 comments on commit 15d4944

Please sign in to comment.