Skip to content

Commit

Permalink
Bump 3.0.0, resolve ScerIO#11, resolve ScerIO#16
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeShkurko committed Oct 23, 2021
1 parent 210d4a9 commit 695c5e2
Show file tree
Hide file tree
Showing 11 changed files with 325 additions and 32 deletions.
83 changes: 75 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,82 @@
node_modules/*
dist/*
map/*
package-lock.json
package.json
yarn.lock
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/
pubspec.lock
build/

# Android related
**/android/**/gradle-wrapper.jar
**/android/.gradle
**/android/captures/
**/android/gradlew
**/android/gradlew.bat
**/android/local.properties
**/android/**/GeneratedPluginRegistrant.java

# iOS/XCode related
**/ios/**/*.mode1v3
**/ios/**/*.mode2v3
**/ios/**/*.moved-aside
**/ios/**/*.pbxuser
**/ios/**/*.perspectivev3
**/ios/**/*sync/
**/ios/**/.sconsign.dblite
**/ios/**/.tags*
**/ios/**/.vagrant/
**/ios/**/DerivedData/
**/ios/**/Icon?
**/ios/**/Pods/
**/ios/**/.symlinks/
**/ios/**/profile
**/ios/**/xcuserdata
**/ios/.generated/
**/ios/Flutter/App.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Flutter.podspec
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/app.flx
**/ios/Flutter/app.zip
**/ios/Flutter/flutter_assets/
**/ios/Flutter/flutter_export_environment.sh
**/ios/ServiceDefinitions.json
**/ios/Runner/GeneratedPluginRegistrant.*

# Exceptions to above rules.
!**/ios/**/default.mode1v3
!**/ios/**/default.mode2v3
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3

# Project
node_modules/*
dist/*
map/*
package-lock.json
package.json
yarn.lock
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## 3.0.0

* Replaced [icon-font-generator] with [fantasticon] [pull#14](https://github.com/rbcprolabs/icon_font_generator/pull/14)
* Attribute ascent replaced by descent
* Attribute mono removed
* Attribute yarn added
* Added const in dart class template [issue#16](https://github.com/rbcprolabs/icon_font_generator/issues/16)
* Upgrade dependencies

## 2.0.0

* Null-safety
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ $ pub global activate icon_font_generator
- `--out-flutter` * - Output flutter icon class (to file, for example: lib/icons.dart)
- `--class-name` * - The class name is also the font name used in pubspec.yaml (as font name)
- `--height` - Fixed font height value, defaults: 512
- `--ascent` - Offset applied to the baseline, defaults: 240
- `--descent` - Offset applied to the baseline, defaults: 240
- `--package` - Name of package for generated icon data ([See more](https://api.flutter.dev/flutter/widgets/IconData/fontPackage.html))
- `--indent` - Indent for generating dart file, for example: ' ', default: ' '
- `--mono` - Make font monospace, default: true
- `--normalize` - Normalize icons sizes, default: false
- `--yarn` - Usage yarn instead npm, default: false

## Example
File structure:
Expand Down Expand Up @@ -80,7 +80,7 @@ class _UiIconsData extends IconData {
@immutable
class UiIcons {
UiIcons._();
const UiIcons._();
static const IconData account = _UiIconsData(0xe000);
static const IconData arrowLeft = _UiIconsData(0xe001);
Expand Down
23 changes: 14 additions & 9 deletions bin/icon_font_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ class GenerateCommand extends Command {
'normalize',
help: 'Normalize icons sizes',
defaultsTo: false,
)
..addFlag(
'yarn',
help: 'Use yarn instead npm',
defaultsTo: false,
);
}

Expand Down Expand Up @@ -97,10 +102,8 @@ class GenerateCommand extends Command {
Directory.fromUri(genRootDir.uri.resolve('temp_icons'));
final tempOutDirectory =
Directory.fromUri(genRootDir.uri.resolve('temp_font'));
final iconsMap = File.fromUri(genRootDir.uri.resolve(path.join(
tempOutDirectory.path,
'ui_icons.json'
)));
final iconsMap = File.fromUri(genRootDir.uri
.resolve(path.join(tempOutDirectory.path, 'ui_icons.json')));
if (tempSourceDirectory.existsSync()) {
await tempSourceDirectory.delete(recursive: true);
}
Expand All @@ -111,17 +114,19 @@ class GenerateCommand extends Command {
await iconsMap.delete();
}

stdout.writeln('Installing npm dependencies...');

final nodeInstallDependencies = await Process.start(
'npm',
['install'],
(argResults!['yarn'] as bool) ? 'yarn' : 'npm',
['install', '--no-fund'],
workingDirectory: genRootDir.path,
runInShell: true,
);
await stdout.addStream(nodeInstallDependencies.stdout);

// icon-font-generator requires package: `ttf2woff2`
// we do not need him and requires a python
final String gypErr = 'gyp ERR!';
final gypErr = 'gyp ERR!';
await stderr.addStream(nodeInstallDependencies.stderr
.where((bytes) => !utf8.decode(bytes).contains(gypErr)));

Expand All @@ -148,8 +153,6 @@ class GenerateCommand extends Command {
),
[
path.absolute(tempSourceDirectory.path),
'--asset-types',
'json',
'--font-height',
argResults!['height'],
'--descent',
Expand All @@ -160,6 +163,8 @@ class GenerateCommand extends Command {
path.basenameWithoutExtension(argResults!['out-font']),
'--output',
path.absolute(tempOutDirectory.path),
'--asset-types',
'json',
'--font-types',
'ttf',
],
Expand Down
Binary file modified example/lib/icon_font/ui_icons.ttf
Binary file not shown.
11 changes: 5 additions & 6 deletions example/lib/widgets/icons.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

174 changes: 174 additions & 0 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.0"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.8.1"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
console:
dependency: transitive
description:
name: console
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.0"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
flutter:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
icon_font_generator:
dependency: "direct dev"
description:
path: ".."
relative: true
source: path
version: "3.0.0"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.10"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
recase:
dependency: transitive
description:
name: recase
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
sky_engine:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
source_span:
dependency: transitive
description:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.0"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.2"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
sdks:
dart: ">=2.12.0 <3.0.0"
2 changes: 1 addition & 1 deletion lib/generate_flutter_class.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:convert';
import 'dart:io';
import 'package:meta/meta.dart';

import 'package:icon_font_generator/templates/flutter_icons.dart' as template;
import 'package:recase/recase.dart';

Expand Down
Loading

0 comments on commit 695c5e2

Please sign in to comment.