π Language: English | δΈζ
π‘ See the Migration Guide to learn how to migrate between breaking changes.
YAML Variable Scanner, used to scan multiple files for text that can use YAML variables.
[example]
Important
Currently, only the following variables support checking:
{{ x.xx.xxx }}
- π Multiple files can be specified (Glob syntax)
- ποΈ Ignore checks can be specified
- Ignore files (Glob syntax)
- Ignore YAML variables, text paragraphs (RegExp syntax)
- π Support for checking existing YAML variables in text
- π¦ Detailed console printout (with statistics)
Use the following command to run the check in the example:
$ dart run example --help
$ dart run example check
Flutter / Dart | 3.19.0+ / 3.3.0+ |
---|---|
yaml_variable_scanner 0.0.1+ | β |
Run this command with Flutter,
$ dart pub add yaml_variable_scanner
or add yaml_variable_scanner
to pubspec.yaml
dependencies manually.
dependencies:
yaml_variable_scanner: ^latest_version
import 'dart:io';
import 'package:yaml_variable_scanner/yaml_variable_scanner.dart';
YamlVariableScanner.run(
/// yaml_variable_scanner config file
'./yaml_variable_scanner.yaml',
stdout,
);
- Create the yaml_variable_scanner.yaml file.
- Complete the yaml_variable_scanner.yaml configuration.
yaml_variable_scanner:
# File path for YAML variables
yamlFilePath:
- path: "test/siteA.yaml" # YAML path (Glob syntax)
variablePrefix: "a." # Variable prefix. e.g. `a.` -> `a.x.xx`
- path: "test/siteB.yaml"
variablePrefix: "b."
# Ignore YAML file path
#
# (Glob Syntax)
ignoreYamlFilePath:
- "test/test.yaml"
# Ignore YAML Key
#
# e.g. "^a\.bb$"
#
# (RegExp Syntax)
ignoreYamlKey:
- ^description$
# File path for check file contents
#
# (Glob Syntax)
checkFilePath:
- "test/**/*.md"
# Ignore file paths to check
#
# (Glob Syntax)
ignoreCheckFilePath:
- "test/content/**.md"
# Ignore text that doesn't need to match
#
# e.g.
# - `r"^\s*---([\s\S]*?)---$"`
# - `r"^\s*{%-?\s*comment\s*-?%}([\s\S]*?){%-?\s*endcomment\s*-?%}$"`
# - `r"^\s*<!---?\s*([\s\S]*?)\s*-?-->$"`
#
# (RegExp Syntax)
ignoreCheckText:
# --- xxx ---
- ^\s*---([\s\S]*?)---$
# {%- comment %} xxx {% endcomment -%}
- ^\s*{%-?\s*comment\s*-?%}([\s\S]*?){%-?\s*endcomment\s*-?%}$
# <!-- xxx -->
- ^\s*<!---?\s*([\s\S]*?)\s*-?-->$
Parameter | Type | Default | Description |
---|---|---|---|
configPath required |
String |
- | yaml_variable_scanner.yaml config file path. |
stdout required |
Stdout |
- | stdout from dart:io |
printMode | PrintMode |
PrintMode.detail | Console Print Mode. |
Open sourced under the MIT license.
Β© AmosHuKe