mason library
A Dart template generator which helps teams generate files quickly and consistently.
Get started at https://github.com/felangel/mason 🧱
Classes
- AnsiCode
- Standard ANSI escape code for customizing terminal text output.
- AnsiCodeType
- The type of code represented by AnsiCode.
- Brick
- Metadata for a brick template including the name and location.
- BrickEnvironment
- An object representing the environment for a given brick.
- BrickLocation
- Contains metadata for the location of a reusable brick template.
- BricksJson
- A local cache for mason bricks.
- BrickVariableProperties
- An object representing a brick variable.
- BrickYaml
- Mason configuration yaml file which contains metadata used when interacting with the Mason CLI.
- CachedBrick
- A cached brick is an object which includes a resolved brick (strict location) and the local path of the brick.
- DirectoryGeneratorTarget
- A GeneratorTarget based on a provided Directory.
- ExitCode
- Exit code constants.
- GeneratedFile
-
A file generated by a
Generator
which includes the file path and status. - GeneratorHooks
-
Scripts that run automatically whenever a particular event occurs
in a
Generator
. - GeneratorTarget
-
A target for a
Generator
. This class knows how to create files given a path and contents. - GitPath
- Path to templates in git.
- HookContext
- A reference to core mason APIs to be used within hooks.
- Logger
-
A basic Logger which wraps
stdio
and applies various styles. - LogTheme
- A theme object which contains styles for all log message types.
- MasonBundle
- A bundled version of a mason template.
- MasonBundledFile
- A bundled file which is included as part of a a MasonBundle.
- MasonGenerator
-
A MasonGenerator which extends
Generator
and exposes the ability to create aGenerator
from a Brick. - MasonLockJson
- Mason lock file which contains locked brick locations.
- MasonYaml
- Mason configuration yaml file which contains metadata used when interacting with the Mason CLI.
- Progress
- A class that can be used to display progress information to the user.
- ProgressAnimation
- An object which contains configuration for the animation of a Progress instance.
- ProgressOptions
- An object containing configuration for a Progress instance.
- TemplateFile
-
This class represents a file in a generator template.
The contents should be text and may contain mustache
variables that can be substituted (
{{myVar}}
). - Version
- A parsed semantic version number.
- VersionConstraint
- A VersionConstraint is a predicate that can determine whether a given version is valid or not.
- VersionRange
- Constrains versions to a fall within a given range.
- Yaml
- Yaml Utilities
Enums
- BrickVariableType
- The type of brick variable.
- FileConflictResolution
- File conflict resolution strategies used during the generation process.
- GeneratedFileStatus
- The status of a generated file.
- Level
- Indicates the desired logging level.
- OverwriteRule
- The overwrite rule when generating code and a conflict occurs.
Extensions
- RenderTemplate on String
-
Given a
String
with mustache templates, and a Map of String key / value pairs, substitute all instances of{{key}}
forvalue
. - StringCaseExtensions on String
- Built-in String casing extensions.
Constants
- backgroundBlack → const AnsiCode
- backgroundBlue → const AnsiCode
-
backgroundColors
→ const List<
AnsiCode> - All of the AnsiCode values that represent AnsiCodeType.background.
- backgroundCyan → const AnsiCode
- backgroundDarkGray → const AnsiCode
- backgroundDefault → const AnsiCode
- backgroundGreen → const AnsiCode
- backgroundLightBlue → const AnsiCode
- backgroundLightCyan → const AnsiCode
- backgroundLightGray → const AnsiCode
- backgroundLightGreen → const AnsiCode
- backgroundLightMagenta → const AnsiCode
- backgroundLightRed → const AnsiCode
- backgroundLightYellow → const AnsiCode
- backgroundMagenta → const AnsiCode
- backgroundRed → const AnsiCode
- backgroundWhite → const AnsiCode
- backgroundYellow → const AnsiCode
- black → const AnsiCode
- blue → const AnsiCode
- cyan → const AnsiCode
- darkGray → const AnsiCode
- defaultForeground → const AnsiCode
-
foregroundColors
→ const List<
AnsiCode> - All of the AnsiCode values that represent AnsiCodeType.foreground.
- green → const AnsiCode
- lightBlue → const AnsiCode
- lightCyan → const AnsiCode
- lightGray → const AnsiCode
- lightGreen → const AnsiCode
- lightMagenta → const AnsiCode
- lightRed → const AnsiCode
- lightYellow → const AnsiCode
- magenta → const AnsiCode
- packageVersion → const String
- red → const AnsiCode
- resetAll → const AnsiCode
- resetBlink → const AnsiCode
- resetBold → const AnsiCode
- resetDim → const AnsiCode
- resetItalic → const AnsiCode
- resetReverse → const AnsiCode
- resetUnderlined → const AnsiCode
- styleBlink → const AnsiCode
- styleBold → const AnsiCode
- styleDim → const AnsiCode
- styleItalic → const AnsiCode
- styleReverse → const AnsiCode
-
styles
→ const List<
AnsiCode> - All of the AnsiCode values that represent AnsiCodeType.style.
- styleUnderlined → const AnsiCode
- white → const AnsiCode
- yellow → const AnsiCode
Properties
- ansiOutputEnabled → bool
-
Whether formatted ANSI output is enabled for
wrapWith
and AnsiCode.wrap.no setter
Functions
-
canonicalize(
String path) → String -
Canonicalizes
path
. -
createBundle(
Directory brick) → MasonBundle -
Generates a MasonBundle from the provided
brick
directory. -
isBrickCompatibleWithMason(
BrickYaml brickYaml) → bool -
Returns whether the current
brickYaml
is compatible with the current version of mason. -
link(
{required Uri uri, String? message}) → String -
Wraps
uri
with an escape sequence so it's recognized as a hyperlink. An optional message can be used in place of theuri
. If nomessage
is provided, the text content will be the fulluri
. -
overrideAnsiOutput<
T> (bool enableAnsiOutput, T body()) → T -
Allows overriding ansiOutputEnabled to
enableAnsiOutput
for the code run withinbody
. -
unpackBundle(
MasonBundle bundle, Directory target) → void -
Unpack the
bundle
in thetarget
directory.
Typedefs
Exceptions / Errors
- BrickNotFoundException
-
Thrown when a brick registered in the
mason.yaml
cannot be found locally. - MasonException
- An exception thrown by an internal mason command.