Skip to content

Commit cc74997

Browse files
authored
fix(bricks): windows prod build use copyPath (#49)
1 parent 294196e commit cc74997

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

bricks/dart_frog_prod_server/hooks/pre_gen.dart

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'dart:io';
22

33
import 'package:dart_frog_gen/dart_frog_gen.dart';
4+
import 'package:io/io.dart';
45
import 'package:mason/mason.dart';
56
import 'package:path/path.dart' as path;
67
import 'package:pubspec_parse/pubspec_parse.dart';
@@ -36,17 +37,13 @@ Future<void> run(HookContext context) async {
3637
}
3738

3839
final tempDirectory = await Directory.systemTemp.createTemp();
39-
final result = await Process.run(
40-
'cp',
41-
['-rf', '.', '${tempDirectory.path}${path.separator}'],
42-
workingDirectory: projectDirectory.path,
43-
runInShell: true,
44-
);
45-
bundlingDone();
46-
47-
if (result.exitCode != 0) {
48-
context.logger.err('${result.stderr}');
49-
exit(result.exitCode);
40+
try {
41+
await copyPath('.', '${tempDirectory.path}${path.separator}');
42+
bundlingDone();
43+
} catch (error) {
44+
bundlingDone();
45+
context.logger.err('$error');
46+
exit(1);
5047
}
5148

5249
await tempDirectory.rename(buildDirectoryPath);

bricks/dart_frog_prod_server/hooks/pubspec.lock

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ packages:
6464
url: "https://pub.dartlang.org"
6565
source: hosted
6666
version: "4.0.0"
67+
io:
68+
dependency: "direct main"
69+
description:
70+
name: io
71+
url: "https://pub.dartlang.org"
72+
source: hosted
73+
version: "1.0.3"
6774
json_annotation:
6875
dependency: transitive
6976
description:

bricks/dart_frog_prod_server/hooks/pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ environment:
66

77
dependencies:
88
dart_frog_gen: ^0.0.2-dev.1
9+
io: ^1.0.3
910
mason: ">=0.1.0-dev <0.1.0"
1011
path: ^1.8.1
1112
pubspec_parse: ^1.2.0

0 commit comments

Comments
 (0)