Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

export 'package:github/src/const/language_color.dart'; #232

Merged
merged 3 commits into from
Oct 7, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/src/common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ export 'package:github/src/common/util/oauth2.dart';
export 'package:github/src/common/util/pagination.dart';
export 'package:github/src/common/util/service.dart';
export 'package:github/src/common/util/utils.dart';
export 'package:github/src/const/language_color.dart';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note, but now that this file is being exported, the language color map is now considered part of the public API and should be non-breaking in future changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes!

export 'package:github/src/const/token_env_keys.dart';
82 changes: 51 additions & 31 deletions lib/src/const/language_color.dart

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

6 changes: 4 additions & 2 deletions tool/language_color_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,19 @@ const _path = './lib/src/const/language_color.dart';
const _url = 'https://raw.githubusercontent.com/'
'github/linguist/master/lib/linguist/languages.yml';

Future main() async {
Future<void> main() async {
final response = await http.Client().get(_url);

final yaml = loadYaml(response.body) as YamlMap;

final stringBuffer = StringBuffer()
..writeln('// GENERATED CODE - DO NOT MODIFY BY HAND')
..writeln('// VERSION OF ${DateTime.now().toIso8601String()}')
..writeln()
..writeln('const languagesColor = <String, String>{');
..writeln('const kGitHubLanguageColors = <String, String>{');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's keep the name the same as above whatever we end up deciding

Suggested change
..writeln('const kGitHubLanguageColors = <String, String>{');
..writeln('const languageColors = <String, String>{');

Copy link
Contributor Author

@LefebvreIlyas LefebvreIlyas Oct 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


final map = yaml.value as YamlMap;

final languages = map.keys.cast<String>().toList(growable: false)..sort();

for (var language in languages) {
Expand Down