glob_export 0.1.3

  • Readme
  • Changelog
  • Installing
  • 50

glob_export #

A builder package for automatically exporting Dart files in a project based on globs.

Usage #

The builder looks for files with the .glex extension and processes them similarly to gitignore files, except backwards:

  • Globs directly listed in the file are included.
  • Globs preceded with ! are excluded.
    • Exclusions take precedence over inclusions.
  • Lines preceded with # are treated as comments and ignored.

Make sure you have this package and build_runner as dev dependencies, then run

  • pub run build_runner build or pub run build_runner watch for a standalone package or command-line application
  • flutter packages pub run build_runner build or flutter packages pub run build_runner watch for a Flutter project
  • webdev build or webdev serve for a web project

The output file has the extension .g.dart and simply exports all included files.

Example #

A common use case would be an everything.glex file in the lib folder of an application package:


And if you want to exclude generated files:


Then, from a Dart file in lib:

import 'everything.g.dart';

// Some code that uses other code from elsewhere in your package

Known issues #

  • There are no tests. No unit tests. No integration tests. No tests, whatsoever. Where would one even begin writing tests for a builder? (That was a serious question. I have no idea how to automatically test this.)
  • Currently, the package will happily export Dart files with part of directives, which is not allowed because they aren't standalone libraries. Unfortunately, the method on BuildStep for determining whether or not a file is a library is broken and always returns false. Or more technically a Future that completes with false. Whatever. The point is, it doesn't work and it's dumb.

0.1.3 #

  • Improved compatibility with json_serializable
    • This is getting kind of stupid
  • Removed a print statement intended for debugging

0.1.2 #

  • Improved compatibility with angular
  • Also improved compatibility with the concept of actually working, finally
  • Added BROKEN tags to other versions in CHANGELOG to indicate that they do not, in fact, work

0.1.1 BROKEN #

  • Relaxed version constraints of dependencies for compatibility with angular 5.2.0

0.1.0 BROKEN #

  • Basic functionality with gitignore-style syntax

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  glob_export: ^0.1.3

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:glob_export/builder.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Feb 27, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5

Maintenance suggestions

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

Common filename patterns include main.dart, example.dart, and glob_export.dart. Packages with multiple examples should provide example/

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.0 <3.0.0
build ^1.1.0 1.2.2
code_builder ^3.2.0 3.2.1
dart_style ^1.2.0 1.3.3
glob ^1.1.0 1.2.0
path ^1.6.0 1.6.4
Transitive dependencies
_fe_analyzer_shared 1.0.3
analyzer 0.39.4
args 1.5.2
async 2.4.0
built_collection 4.3.2
built_value 7.0.9
charcode 1.1.3
collection 1.14.12
convert 2.1.1
crypto 2.1.4
csslib 0.16.1
fixnum 0.10.11
html 0.14.0+3
js 0.6.1+1
logging 0.11.4
matcher 0.12.6
meta 1.1.8
node_interop 1.0.3
node_io 1.0.1+2
package_config 1.9.1
pub_semver 1.4.3
quiver 2.1.2+1
source_span 1.6.0
stack_trace 1.9.3
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
watcher 0.9.7+13
yaml 2.2.0
Dev dependencies
build_runner ^1.3.1
pedantic ^1.0.0 1.9.0
test ^1.0.0