Skip to content

Commit 3f9dea5

Browse files
authored
Allow non-glob file path arguments containing glob syntax (#196)
1 parent acc3539 commit 3f9dea5

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 1.4.5
2+
3+
* Glob syntax will no longer be resolved if a file with that literal name
4+
exists.
5+
16
## 1.4.4
27

38
### Division Migrator

lib/src/migrator.dart

+5-2
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,11 @@ abstract class Migrator extends Command<Map<Uri, String>> {
8181

8282
var entrypoints = [
8383
for (var argument in argResults!.rest)
84-
for (var entry in Glob(argument).listFileSystemSync(fileSystem))
85-
if (entry is File) entry.path
84+
if (File(argument).existsSync())
85+
argument
86+
else
87+
for (var entry in Glob(argument).listFileSystemSync(fileSystem))
88+
if (entry is File) entry.path
8689
];
8790
for (var entrypoint in entrypoints) {
8891
var tuple =

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: sass_migrator
2-
version: 1.4.4
2+
version: 1.4.5
33
description: A tool for running migrations on Sass files
44
author: Jennifer Thakar <[email protected]>
55
homepage: https://github.com/sass/migrator

test/cli_dart_test.dart

+10
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,16 @@ void main() {
6464
]).validate();
6565
});
6666

67+
test("allows non-glob file arguments containing glob syntax", () async {
68+
await d.dir('[dir]', [d.file("test.scss", "a {b: (1 / 2)}")]).create();
69+
70+
await (await runMigrator(["division", "[dir]/test.scss"])).shouldExit(0);
71+
72+
await d.dir('[dir]', [
73+
d.file("test.scss", '@use "sass:math";\n\na {b: math.div(1, 2)}')
74+
]).validate();
75+
});
76+
6777
group("with --dry-run", () {
6878
test("prints the name of a file that would be migrated", () async {
6979
await d.file("test.scss", "a {b: abs(-1)}").create();

0 commit comments

Comments
 (0)