-
Notifications
You must be signed in to change notification settings - Fork 164
feat(dart_frog_cli): support for Dart workspaces #1825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
felangel
wants to merge
19
commits into
main
Choose a base branch
from
feat/workspaces
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
1513a66
feat(dart_frog_cli): support for Dart workspaces
felangel b4b43a8
chore: update barrel
felangel 3e13bb0
fix: use workspace lockfile in production build
felangel b343a71
chore: adjust comment
felangel 8cad2c9
chore: regenerate bundle
felangel 1628e6e
chore: more doc fixes
felangel d9763a8
test: fix broken tests and add missing unit tests
felangel 772eecc
Merge branch 'main' into feat/workspaces
felangel 4713d41
test: add more tests
felangel 7d5af75
more test fixes
felangel 65137e2
cleanup
felangel ce469da
fix coverage
felangel 5369521
chore: coverage
felangel 3783d38
revert post_gen changes
felangel b687df5
ci: use updated workflow
felangel c77610c
coverage
felangel 63d54c6
tweak
felangel 0e5db9d
revert ci changes
felangel 3465341
chore: regenerate bundle
felangel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
bricks/dart_frog_prod_server/hooks/lib/dart_frog_prod_server_hooks.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
export 'src/create_bundle.dart'; | ||
export 'src/create_external_packages_folder.dart'; | ||
export 'src/dart_pub_get.dart'; | ||
export 'src/disable_workspace_resolution.dart'; | ||
export 'src/exit_overrides.dart'; | ||
export 'src/get_internal_path_dependencies.dart'; | ||
export 'src/get_pubspec_lock.dart'; | ||
export 'src/uses_workspace_resolution.dart'; |
20 changes: 20 additions & 0 deletions
20
bricks/dart_frog_prod_server/hooks/lib/src/disable_workspace_resolution.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import 'dart:io'; | ||
import 'package:mason/mason.dart'; | ||
import 'package:path/path.dart' as path; | ||
|
||
/// Opts out of dart workspaces until we can generate per package lockfiles. | ||
/// https://github.com/dart-lang/pub/issues/4594 | ||
void disableWorkspaceResolution( | ||
HookContext context, { | ||
required String workingDirectory, | ||
required void Function(int exitCode) exit, | ||
}) { | ||
try { | ||
File( | ||
path.join(workingDirectory, 'pubspec_overrides.yaml'), | ||
).writeAsStringSync('resolution: null', mode: FileMode.append); | ||
} on Exception catch (e) { | ||
context.logger.err('$e'); | ||
exit(1); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
bricks/dart_frog_prod_server/hooks/lib/src/uses_workspace_resolution.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import 'dart:io'; | ||
import 'package:mason/mason.dart'; | ||
import 'package:path/path.dart' as path; | ||
import 'package:pubspec_parse/pubspec_parse.dart'; | ||
|
||
/// Determines whether the project in the provided [workingDirectory] | ||
/// is configured to use `resolution: workspace`. | ||
bool usesWorkspaceResolution( | ||
HookContext context, { | ||
required String workingDirectory, | ||
required void Function(int exitCode) exit, | ||
}) { | ||
final pubspecFile = File(path.join(workingDirectory, 'pubspec.yaml')); | ||
if (!pubspecFile.existsSync()) return false; | ||
|
||
final Pubspec pubspec; | ||
try { | ||
pubspec = Pubspec.parse(pubspecFile.readAsStringSync()); | ||
} on Exception catch (e) { | ||
context.logger.err('$e'); | ||
exit(1); | ||
return false; | ||
} | ||
|
||
return pubspec.resolution == 'workspace'; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.