Skip to content

Commit 0aa260d

Browse files
author
github-actions
committed
Prepare version 0.5.10
1 parent 83f1502 commit 0aa260d

File tree

6 files changed

+82
-172
lines changed

6 files changed

+82
-172
lines changed

CHANGELOG.md

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,107 +1,112 @@
11
# Changelog
22

3+
## [0.5.10]
4+
5+
- Released @ 3/2025 (UTC)
6+
- chore: Bugfix with paths
7+
38
## [0.5.9]
49

5-
- Released @ 12/2024 (UTC)
10+
- Released @ 3/2025 (UTC)
611
- chore: Update dependencies
712

813
## [0.5.8]
914

10-
- Released @ 12/2024 (UTC)
15+
- Released @ 3/2025 (UTC)
1116
- chore: Update dependencies
1217

1318
## [0.5.7]
1419

15-
- Released @ 12/2024 (UTC)
20+
- Released @ 3/2025 (UTC)
1621
- chore: Internal updates and update readme
1722

1823
## [0.5.5]
1924

20-
- Released @ 12/2024 (UTC)
25+
- Released @ 3/2025 (UTC)
2126
- refactor: Refactor file search
2227

2328
## [0.5.4]
2429

25-
- Released @ 12/2024 (UTC)
30+
- Released @ 3/2025 (UTC)
2631
- fix: Fix output path error
2732

2833
## [0.5.3]
2934

30-
- Released @ 12/2024 (UTC)
35+
- Released @ 3/2025 (UTC)
3136
- fix: Fix issue with getting current dir
3237

3338
## [0.5.2]
3439

35-
- Released @ 12/2024 (UTC)
40+
- Released @ 3/2025 (UTC)
3641
- fix: Various bugfixes
3742

3843
## [0.5.0]
3944

40-
- Released @ 12/2024 (UTC)
45+
- Released @ 3/2025 (UTC)
4146
- breaking: Improve algoritm
4247

4348
## [0.4.1]
4449

45-
- Released @ 12/2024 (UTC)
50+
- Released @ 3/2025 (UTC)
4651
- chore: Update dependencies
4752

4853
## [0.4.0]
4954

50-
- Released @ 12/2024 (UTC)
55+
- Released @ 3/2025 (UTC)
5156
- chore: Update dependencies
5257

5358
## [0.3.1]
5459

55-
- Released @ 12/2024 (UTC)
60+
- Released @ 3/2025 (UTC)
5661
- chore: Update dependencies
5762

5863
## [0.3.0]
5964

60-
- Released @ 12/2024 (UTC)
65+
- Released @ 3/2025 (UTC)
6166
- breaking: Update dependencies and docs
6267

6368
## [0.2.2]
6469

65-
- Released @ 12/2024 (UTC)
70+
- Released @ 3/2025 (UTC)
6671
- chore: Update dependencies
6772

6873
## [0.2.1]
6974

70-
- Released @ 12/2024 (UTC)
75+
- Released @ 3/2025 (UTC)
7176
- chore: Update dependencies
7277

7378
## [0.2.0]
7479

75-
- Released @ 12/2024 (UTC)
80+
- Released @ 3/2025 (UTC)
7681
- breaking Change tool command to shorter genidx and enable generation options
7782
- chore: Update readme
7883

7984
## [0.1.5]
8085

81-
- Released @ 12/2024 (UTC)
86+
- Released @ 3/2025 (UTC)
8287
- chore: Update dependencies
8388

8489
## [0.1.4]
8590

86-
- Released @ 12/2024 (UTC)
91+
- Released @ 3/2025 (UTC)
8792
- chore: Update dependencies
8893

8994
## [0.1.3]
9095

91-
- Released @ 12/2024 (UTC)
96+
- Released @ 3/2025 (UTC)
9297
- chore: Update dependencies and readme
9398

9499
## [0.1.2]
95100

96-
- Released @ 12/2024 (UTC)
101+
- Released @ 3/2025 (UTC)
97102
- chore: Update workflow scripts
98103

99104
## [0.1.1]
100105

101-
- Released @ 12/2024 (UTC)
106+
- Released @ 3/2025 (UTC)
102107
- fix: Fix path underscore bug
103108

104109
## [0.1.0]
105110

106-
- Released @ 12/2024 (UTC)
111+
- Released @ 3/2025 (UTC)
107112
- Initial release

bin/gen_indexes.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,5 @@ void main(
2020
'https://raw.githubusercontent.com/dev-cetera/df_generate_dart_indexes/main/templates/_index.g.dart.md',
2121
],
2222
}) async {
23-
await genIndexes(
24-
args,
25-
defaultTemplates: defaultTemplates,
26-
);
23+
await genIndexes(args, defaultTemplates: defaultTemplates);
2724
}

bin/gen_indexes_basename.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,5 @@ void main(
2020
'https://raw.githubusercontent.com/dev-cetera/df_generate_dart_indexes/main/templates/_{basename}.g.dart.md',
2121
],
2222
}) async {
23-
await genIndexes(
24-
args,
25-
defaultTemplates: defaultTemplates,
26-
);
23+
await genIndexes(args, defaultTemplates: defaultTemplates);
2724
}

bin/gen_indexes_ts.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,5 @@ void main(
2020
'https://raw.githubusercontent.com/dev-cetera/df_generate_dart_indexes/main/templates/index.ts.md',
2121
],
2222
}) async {
23-
await genIndexesTs(
24-
args,
25-
defaultTemplates: defaultTemplates,
26-
);
23+
await genIndexesTs(args, defaultTemplates: defaultTemplates);
2724
}

lib/src/gen_indexes.dart

Lines changed: 29 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ Future<void> genIndexes(
2626
'A tool for generating index/barrel files for Dart. Ignores files that starts with underscores.',
2727
example: 'gen-indexes -i .',
2828
params: [
29-
DefaultFlags.HELP.flag.copyWith(
30-
negatable: true,
31-
),
29+
DefaultFlags.HELP.flag.copyWith(negatable: true),
3230
DefaultOptions.INPUT_PATH.option.copyWith(
3331
defaultsTo: FileSystemUtility.i.currentDir,
3432
),
@@ -46,10 +44,7 @@ Future<void> genIndexes(
4644

4745
final help = argResults.flag(DefaultFlags.HELP.name);
4846
if (help) {
49-
_print(
50-
printCyan,
51-
parser.getInfo(argParser),
52-
);
47+
_print(printCyan, parser.getInfo(argParser));
5348
exit(ExitCodes.SUCCESS.code);
5449
}
5550

@@ -75,10 +70,7 @@ Future<void> genIndexes(
7570

7671
// ---------------------------------------------------------------------------
7772

78-
_print(
79-
printWhite,
80-
'Looking for files..',
81-
);
73+
_print(printWhite, 'Looking for files..');
8274
final filePathStream0 = PathExplorer(inputPath).exploreFiles();
8375
final filePathStream1 = filePathStream0.where((e) {
8476
final path = p.relative(e.path, from: inputPath);
@@ -88,106 +80,69 @@ Future<void> genIndexes(
8880
try {
8981
findings = await filePathStream1.toList();
9082
} catch (e) {
91-
_print(
92-
printRed,
93-
'Failed to read file tree!',
94-
spinner,
95-
);
83+
_print(printRed, 'Failed to read file tree!', spinner);
9684
exit(ExitCodes.FAILURE.code);
9785
}
9886
if (findings.isEmpty) {
9987
spinner.stop();
100-
_print(
101-
printYellow,
102-
'No files found in $inputPath!',
103-
);
88+
_print(printYellow, 'No files found in $inputPath!');
10489
exit(ExitCodes.SUCCESS.code);
10590
}
10691

10792
// ---------------------------------------------------------------------------
10893

10994
final templateData = <String, String>{};
11095
for (final template in templates) {
111-
_print(
112-
printWhite,
113-
'Reading template at: $template...',
114-
);
115-
final result = await MdTemplateUtility.i
116-
.readTemplateFromPathOrUrl(
117-
template,
118-
)
119-
.value;
96+
_print(printWhite, 'Reading template at: $template...');
97+
final result =
98+
await MdTemplateUtility.i.readTemplateFromPathOrUrl(template).value;
12099

121100
if (result.isErr()) {
122101
spinner.stop();
123-
_print(
124-
printRed,
125-
' Failed to read template!',
126-
);
102+
_print(printRed, ' Failed to read template!');
127103
exit(ExitCodes.FAILURE.code);
128104
}
129105
templateData[template] = result.unwrap();
130106
}
131107

132108
// ---------------------------------------------------------------------------
133109

134-
_print(
135-
printWhite,
136-
'Generating...',
137-
spinner,
138-
);
110+
_print(printWhite, 'Generating...', spinner);
139111

140112
for (final entry in templateData.entries) {
141-
final fileName = p.basename(entry.key).replaceAll('.md', '').replaceAll(
142-
'{basename}',
143-
p.basename(inputPath),
144-
);
113+
final fileName = p
114+
.basename(entry.key)
115+
.replaceAll('.md', '')
116+
.replaceAll('{basename}', p.basename(inputPath));
145117
final template = entry.value;
146118
final skipPath = p.join(inputPath, fileName);
147-
final data = template.replaceData(
148-
{
149-
'___PUBLIC_EXPORTS___': _publicExports(
150-
inputPath,
151-
findings.map((e) => e.path).where((e) => e != skipPath),
152-
(e) => true,
153-
(e) => 'export \'./$e\';',
154-
),
155-
},
156-
);
119+
final data = template.replaceData({
120+
'___PUBLIC_EXPORTS___': _publicExports(
121+
inputPath,
122+
findings.map((e) => e.path).where((e) => e != skipPath),
123+
(e) => true,
124+
(e) => 'export \'./$e\';',
125+
),
126+
});
157127

158-
_print(
159-
printWhite,
160-
'Writing output to $fileName...',
161-
spinner,
162-
);
128+
_print(printWhite, 'Writing output to $fileName...', spinner);
163129
try {
164130
await FileSystemUtility.i.writeLocalFile(fileName, data);
165131
} catch (e) {
166-
_print(
167-
printRed,
168-
'Failed to write at: $fileName',
169-
spinner,
170-
);
132+
_print(printRed, 'Failed to write at: $fileName', spinner);
171133
exit(ExitCodes.FAILURE.code);
172134
}
173135
}
174136

175137
// ---------------------------------------------------------------------------
176138

177139
spinner.stop();
178-
_print(
179-
printGreen,
180-
'Done!',
181-
);
140+
_print(printGreen, 'Done!');
182141
}
183142

184143
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
185144

186-
void _print(
187-
void Function(String) print,
188-
String message, [
189-
Spinner? spinner,
190-
]) {
145+
void _print(void Function(String) print, String message, [Spinner? spinner]) {
191146
spinner?.stop();
192147
print('[gen-indexes] $message');
193148
spinner?.start();
@@ -199,8 +154,9 @@ String _publicExports(
199154
bool Function(String filePath) test,
200155
String Function(String baseName) statementBuilder,
201156
) {
202-
final relativeFilePaths =
203-
filePaths.map((e) => p.relative(e, from: inputPath));
157+
final relativeFilePaths = filePaths.map(
158+
(e) => p.relative(e, from: inputPath),
159+
);
204160
final exportFilePaths = relativeFilePaths.where((e) => test(e));
205161
final statements = exportFilePaths.map(statementBuilder);
206162
return statements.join('\n');

0 commit comments

Comments
 (0)