Skip to content

Commit eecfa4e

Browse files
authored
fix: Update to Dart SDK 3.8.0 and preserve trailing commas (#908)
<!-- Thanks for contributing! Provide a description of your changes below and a general summary in the title Please look at the following checklist to ensure that your PR can be accepted quickly: --> ## Description This updates to Dart SDK 3.8.0, removes the dependency on `intl` and sets the formatter to preserve trailing commas. ## Type of Change <!--- Put an `x` in all the boxes that apply: --> - [ ] ✨ `feat` -- New feature (non-breaking change which adds functionality) - [x] 🛠️ `fix` -- Bug fix (non-breaking change which fixes an issue) - [ ] ❌ `!` -- Breaking change (fix or feature that would cause existing functionality to change) - [ ] 🧹 `refactor` -- Code refactor - [ ] ✅ `ci` -- Build configuration change - [ ] 📝 `docs` -- Documentation - [ ] 🗑️ `chore` -- Chore
1 parent 190caf7 commit eecfa4e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+1466
-1135
lines changed

.github/workflows/validate.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- uses: actions/checkout@v4
3232
- uses: dart-lang/setup-dart@v1
3333
with:
34-
sdk: 3.6.0 # Update when min sdk supported version of `melos` package changes.
34+
sdk: 3.8.0 # Update when min sdk supported version of `melos` package changes.
3535
- name: Run Melos
3636
run: ./.github/workflows/scripts/install-tools.sh
3737

analysis_options.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616

1717
include: all_lint_rules.yaml
1818

19+
formatter:
20+
trailing_commas: preserve
21+
1922
analyzer:
2023
language:
2124
strict-casts: true

docs/getting-started.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ now:
6767
name: my_project
6868
publish_to: none
6969
environment:
70-
sdk: ^3.6.0
70+
sdk: ^3.8.0
7171
workspace:
7272
- packages/helper
7373
- packages/client_package

docs/guides/migrations.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ After the migration your root `pubspec.yaml` file would now look something like
2323
name: my_workspace
2424
publish_to: none
2525
environment:
26-
sdk: ^3.6.0
26+
sdk: ^3.8.0
2727
workspace:
2828
- packages/helper
2929
- packages/client_package
@@ -41,7 +41,7 @@ And this is what the `pubspec.yaml` file of a package would look like:
4141
```yaml
4242
name: my_package
4343
environment:
44-
sdk: ^3.6.0
44+
sdk: ^3.8.0
4545
resolution: workspace
4646
```
4747

packages/conventional_commit/lib/conventional_commit.dart

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ final _conventionalCommitHeaderRegex = RegExp(
44
r'(?<type>[a-zA-Z0-9_]+)(\((?<scope>[a-zA-Z0-9\-_,\s\*]+)\))?(?<breaking>!)?: ?(?<description>.+)',
55
);
66

7-
final _breakingChangeRegex =
8-
RegExp(r'^BREAKING(\sCHANGE)?:\s(?<description>.*$)', multiLine: true);
7+
final _breakingChangeRegex = RegExp(
8+
r'^BREAKING(\sCHANGE)?:\s(?<description>.*$)',
9+
multiLine: true,
10+
);
911

1012
final _footerRegex = RegExp(
1113
r'^(?<footer>(?:[a-z-A-Z0-9\-]+|BREAKING\sCHANGE)(?::\s|\s#).*$)',
@@ -74,7 +76,8 @@ class ConventionalCommit {
7476
.toList();
7577
final description = headerMatch.namedGroup('description')!.trim();
7678

77-
final isBreakingChange = headerMatch.namedGroup('breaking') != null ||
79+
final isBreakingChange =
80+
headerMatch.namedGroup('breaking') != null ||
7881
commitMessage.contains('BREAKING: ') ||
7982
commitMessage.contains('BREAKING CHANGE: ');
8083

@@ -86,8 +89,9 @@ class ConventionalCommit {
8689
// precedence over config files.
8790
if (commitMessage.contains('BREAKING: ') ||
8891
commitMessage.contains('BREAKING CHANGE: ')) {
89-
final breakingChangeMatch =
90-
_breakingChangeRegex.firstMatch(commitMessage);
92+
final breakingChangeMatch = _breakingChangeRegex.firstMatch(
93+
commitMessage,
94+
);
9195
if (breakingChangeMatch == null) {
9296
breakingChangeDescription = description;
9397
} else {
@@ -102,8 +106,11 @@ class ConventionalCommit {
102106
}
103107
}
104108

105-
final commitWithoutHeader =
106-
commitMessage.split('\n').skip(1).toList().join('\n');
109+
final commitWithoutHeader = commitMessage
110+
.split('\n')
111+
.skip(1)
112+
.toList()
113+
.join('\n');
107114

108115
var footers = _footerRegex
109116
.allMatches(commitWithoutHeader)

packages/conventional_commit/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ issue_tracker: https://github.com/invertase/melos/issues
77
resolution: workspace
88

99
environment:
10-
sdk: ^3.6.0
10+
sdk: ^3.8.0
1111

1212
dev_dependencies:
1313
test: any

packages/conventional_commit/test/conventional_commit_test.dart

Lines changed: 71 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ A body describing this commit in more detail.
77
The body in this example is multi-line.
88
''';
99

10-
const commitMessageWithBodyExample = '''
10+
const commitMessageWithBodyExample =
11+
'''
1112
refactor: did something
1213
1314
$bodyExample
@@ -53,29 +54,37 @@ void main() {
5354
expect(ConventionalCommit.tryParse('feat()'), isNull);
5455
});
5556

56-
test('accepts commit messages with or without a space before description',
57-
() {
58-
expect(ConventionalCommit.tryParse('feat:new thing'), isNotNull);
59-
expect(ConventionalCommit.tryParse('feat(foo):new thing'), isNotNull);
60-
expect(ConventionalCommit.tryParse('feat: new thing'), isNotNull);
61-
expect(ConventionalCommit.tryParse('feat(foo): new thing'), isNotNull);
62-
});
57+
test(
58+
'accepts commit messages with or without a space before description',
59+
() {
60+
expect(ConventionalCommit.tryParse('feat:new thing'), isNotNull);
61+
expect(ConventionalCommit.tryParse('feat(foo):new thing'), isNotNull);
62+
expect(ConventionalCommit.tryParse('feat: new thing'), isNotNull);
63+
expect(ConventionalCommit.tryParse('feat(foo): new thing'), isNotNull);
64+
},
65+
);
6366

64-
test('accepts commit messages with prefix before conventional commit type',
65-
() {
66-
expect(
67-
ConventionalCommit.tryParse('Merged PR 404: feat(scope): new feature'),
68-
isNotNull,
69-
);
70-
expect(
71-
ConventionalCommit.tryParse('Merge pull request #404: feat(foo):bar'),
72-
isNotNull,
73-
);
74-
expect(
75-
ConventionalCommit.tryParse('Merged branch develop to main: fix: test'),
76-
isNotNull,
77-
);
78-
});
67+
test(
68+
'accepts commit messages with prefix before conventional commit type',
69+
() {
70+
expect(
71+
ConventionalCommit.tryParse(
72+
'Merged PR 404: feat(scope): new feature',
73+
),
74+
isNotNull,
75+
);
76+
expect(
77+
ConventionalCommit.tryParse('Merge pull request #404: feat(foo):bar'),
78+
isNotNull,
79+
);
80+
expect(
81+
ConventionalCommit.tryParse(
82+
'Merged branch develop to main: fix: test',
83+
),
84+
isNotNull,
85+
);
86+
},
87+
);
7988

8089
test(
8190
'correctly parses commit with prefix before conventional commit type',
@@ -246,43 +255,41 @@ void main() {
246255
isFalse,
247256
);
248257
expect(
249-
ConventionalCommit.tryParse('docs(scope,dope): foo bar')!
250-
.isBreakingChange,
258+
ConventionalCommit.tryParse(
259+
'docs(scope,dope): foo bar',
260+
)!.isBreakingChange,
251261
isFalse,
252262
);
253263
expect(
254-
ConventionalCommit.tryParse('docs(scope,dope)!: foo bar')!
255-
.isBreakingChange,
264+
ConventionalCommit.tryParse(
265+
'docs(scope,dope)!: foo bar',
266+
)!.isBreakingChange,
256267
isTrue,
257268
);
258269
expect(
259270
ConventionalCommit.tryParse(
260271
'docs(scope): foo bar \n\nBREAKING: I broke something.',
261-
)!
262-
.isBreakingChange,
272+
)!.isBreakingChange,
263273
isTrue,
264274
);
265275
// Confirm exact matching of `BREAKING: ` (with space after colon).
266276
expect(
267277
ConventionalCommit.tryParse(
268278
'docs(scope): foo bar \n\nBREAKING:I broke something.',
269-
)!
270-
.isBreakingChange,
279+
)!.isBreakingChange,
271280
isFalse,
272281
);
273282
expect(
274283
ConventionalCommit.tryParse(
275284
'docs(scope): foo bar \n\nBREAKING CHANGE: I broke something.',
276-
)!
277-
.isBreakingChange,
285+
)!.isBreakingChange,
278286
isTrue,
279287
);
280288
// Confirm exact matching of `BREAKING CHANGE: ` (with space after colon).
281289
expect(
282290
ConventionalCommit.tryParse(
283291
'docs(scope): foo bar \n\nBREAKING CHANGE:I broke something.',
284-
)!
285-
.isBreakingChange,
292+
)!.isBreakingChange,
286293
isFalse,
287294
);
288295
});
@@ -294,46 +301,48 @@ void main() {
294301
isNull,
295302
);
296303
expect(
297-
ConventionalCommit.tryParse('docs(scope): foo bar')!
298-
.breakingChangeDescription,
304+
ConventionalCommit.tryParse(
305+
'docs(scope): foo bar',
306+
)!.breakingChangeDescription,
299307
isNull,
300308
);
301309
expect(
302-
ConventionalCommit.tryParse('docs(scope,dope): foo bar')!
303-
.breakingChangeDescription,
310+
ConventionalCommit.tryParse(
311+
'docs(scope,dope): foo bar',
312+
)!.breakingChangeDescription,
304313
isNull,
305314
);
306315

307316
// Should be identical to commit description if BREAKING footer with the
308317
// description is not used.
309318
// - without scopes
310319
expect(
311-
ConventionalCommit.tryParse('docs!: foo bar')!
312-
.breakingChangeDescription,
320+
ConventionalCommit.tryParse(
321+
'docs!: foo bar',
322+
)!.breakingChangeDescription,
313323
equals('foo bar'),
314324
);
315325
// - with scopes
316326
expect(
317-
ConventionalCommit.tryParse('docs(scope,dope)!: foo bar')!
318-
.breakingChangeDescription,
327+
ConventionalCommit.tryParse(
328+
'docs(scope,dope)!: foo bar',
329+
)!.breakingChangeDescription,
319330
equals('foo bar'),
320331
);
321332

322333
// Should be equal to the BREAKING footer message if specified.
323334
expect(
324335
ConventionalCommit.tryParse(
325336
'docs(scope): foo bar \n\nBREAKING: I broke something.',
326-
)!
327-
.breakingChangeDescription,
337+
)!.breakingChangeDescription,
328338
equals('I broke something.'),
329339
);
330340

331341
// Should be equal to the BREAKING CHANGE footer message if specified.
332342
expect(
333343
ConventionalCommit.tryParse(
334344
'docs(scope): foo bar \n\nBREAKING CHANGE: I broke something again.',
335-
)!
336-
.breakingChangeDescription,
345+
)!.breakingChangeDescription,
337346
equals('I broke something again.'),
338347
);
339348
});
@@ -344,8 +353,9 @@ void main() {
344353
isFalse,
345354
);
346355
expect(
347-
ConventionalCommit.tryParse("Merge branch 'main' of invertase/melos")!
348-
.isMergeCommit,
356+
ConventionalCommit.tryParse(
357+
"Merge branch 'main' of invertase/melos",
358+
)!.isMergeCommit,
349359
isTrue,
350360
);
351361
expect(
@@ -357,13 +367,15 @@ void main() {
357367
isFalse,
358368
);
359369
expect(
360-
ConventionalCommit.tryParse('docs(scope): Merge foo bar')!
361-
.isMergeCommit,
370+
ConventionalCommit.tryParse(
371+
'docs(scope): Merge foo bar',
372+
)!.isMergeCommit,
362373
isFalse,
363374
);
364375
expect(
365-
ConventionalCommit.tryParse('docs(scope,dope)!: Merge foo bar')!
366-
.isMergeCommit,
376+
ConventionalCommit.tryParse(
377+
'docs(scope,dope)!: Merge foo bar',
378+
)!.isMergeCommit,
367379
isFalse,
368380
);
369381
});
@@ -403,8 +415,9 @@ void main() {
403415

404416
test('footers', () {
405417
// With a multi-line/paragraph body.
406-
final commitWithBodyParsed =
407-
ConventionalCommit.tryParse(commitMessageWithBodyExample)!;
418+
final commitWithBodyParsed = ConventionalCommit.tryParse(
419+
commitMessageWithBodyExample,
420+
)!;
408421
// Body should not leak into footers.
409422
expect(
410423
commitWithBodyParsed.footers.length,
@@ -427,8 +440,9 @@ void main() {
427440
);
428441

429442
// Footers should still parse without a body.
430-
final commitWithoutBodyParsed =
431-
ConventionalCommit.tryParse(commitMessageWithoutBodyExample)!;
443+
final commitWithoutBodyParsed = ConventionalCommit.tryParse(
444+
commitMessageWithoutBodyExample,
445+
)!;
432446
// Header should not leak into footers.
433447
expect(
434448
commitWithoutBodyParsed.footers

packages/melos/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@ like this:
6464
name: my_workspace
6565
publish_to: none
6666
environment:
67-
sdk: ^3.6.0
67+
sdk: ^3.8.0
6868
workspace:
6969
- packages/helper
7070
- packages/client_package
7171
- packages/server_package
7272
dev_dependencies:
73-
melos: ^7.0.0
73+
melos: ^7.0.0-dev.9
7474

7575
melos:
7676
# All of the content of your previous melos.yaml file
@@ -82,7 +82,7 @@ And this is what the `pubspec.yaml` file of a package would look like:
8282
```yaml
8383
name: my_package
8484
environment:
85-
sdk: ^3.6.0
85+
sdk: ^3.8.0
8686
resolution: workspace
8787
```
8888

packages/melos/bin/melos.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import 'package:cli_launcher/cli_launcher.dart';
22
import 'package:melos/src/command_runner.dart';
33

44
Future<void> main(List<String> arguments) async => launchExecutable(
5-
arguments,
6-
LaunchConfig(
7-
name: ExecutableName('melos'),
8-
launchFromSelf: false,
9-
entrypoint: melosEntryPoint,
10-
),
11-
);
5+
arguments,
6+
LaunchConfig(
7+
name: ExecutableName('melos'),
8+
launchFromSelf: false,
9+
entrypoint: melosEntryPoint,
10+
),
11+
);

0 commit comments

Comments
 (0)