-
Notifications
You must be signed in to change notification settings - Fork 247
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
feat(aft): Adds link
, clean
, bootstrap
, pub
commands
#1883
Conversation
af36ceb
to
c4ebd22
Compare
@@ -36,8 +36,14 @@ commands: | |||
- run: | |||
name: Install and set up melos | |||
command: | | |||
flutter pub global activate melos 1.3.0 | |||
melos bootstrap | |||
flutter pub global activate melos |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any value in pinning this anymore?
flutter_tools: | ||
git: | ||
url: https://github.com/flutter/flutter.git | ||
ref: master |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we pin to a commit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For flutter-tools maybe, but I'd think for pub there might potentially be more chance of security updates that we'd want to get automatically?
pub: | ||
git: | ||
url: https://github.com/dart-lang/pub.git | ||
ref: master |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we pin to a commit?
c4ebd22
to
d0a9848
Compare
Codecov Report
@@ Coverage Diff @@
## next #1883 +/- ##
===========================================
+ Coverage 34.14% 44.18% +10.04%
===========================================
Files 107 122 +15
Lines 6274 7505 +1231
===========================================
+ Hits 2142 3316 +1174
- Misses 4132 4189 +57
Flags with carried forward coverage won't be shown. Click here to find out more.
|
e4eb7b2
to
f5b8a52
Compare
commit-id:ac7a1817
commit-id:54696df6 Revert "chore: Remove `pubspec_overrides` from tracking" This reverts commit 37914fb. This is needed by `mono_repo` until a better solution is available besides prefixing every mono_repo command with `aft link`. commit-id:d2fcc064
Links packages together by creating `pubspec_overrides.yaml` commit-id:43ac3346
Cleans the repo by removing temporary files created by link/build commands. commit-id:7807b7ff
Adds aliases of `pub get` and `pub upgrade` which can be run for all packages in the repo. Embeds `pub` and `flutter` tools for a significant speed-up over spawning subprocesses. commit-id:5f697643
Adds command to publish packages which need publishing. A check is made to `pub.dev` to see which version is the latest. commit-id:ac025581
Adds command to wrap `link` + `pub get` commands for the repo to replicate `melos bs`. commit-id:1546a8c5
Clean up README and library files for new commands. commit-id:e0e6dead
commit-id:58c2392c
Instead of having `deps.yaml`, have a single `aft.yaml` which will manage all the configuration for the repo, including for example ignored packages. commit-id:d309c42c
Adds pre-publish checks to prevent package publishing issues, esp. related to generated `build_runner` artifacts. commit-id:12c8b511
f5b8a52
to
0b9e838
Compare
commit-id:89a88d5f
commit-id:fee247fd
commit-id:ded0bfea
…t/boostrap Since we no longer track generated JS files, in order for the packages to be fully bootstrapped/usuable requires running `build_runner` for those with generated outputs. By default, now, `aft bootstrap` will run the generation - the idea being that it will only be run once to initialize a fresh repository. After that `aft pub get` accomplishes the same thing, although by default it will not run `build_runner`. `aft boostrap` can be run with the `--no-build` flag to disable this behavior, while `aft pub get/upgrade` can be run with the `--build` flag to enable it. commit-id:6c54b4df
if (path.basename(pkgB.path) == 'example') { | ||
return 1; | ||
} | ||
if (path.basename(pkgA.path) == 'example') { | ||
return -1; | ||
} | ||
return pkgA.compareTo(pkgB); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Not sure it really matters in this case, but the final order of the example packages is going to depend on the original order. If you sort ['example/foo', 'example/bar']
and ['example/bar', 'example/foo']
, they will not be the same after sort. if both are example packages, you probably just want to return pkgA.compareTo(pkgB)
.
if (path.basename(pkgB.path) == 'example') { | |
return 1; | |
} | |
if (path.basename(pkgA.path) == 'example') { | |
return -1; | |
} | |
return pkgA.compareTo(pkgB); | |
if (path.basename(pkgB.path) == 'example' && !path.basename(pkgA.path) == 'example') { | |
return 1; | |
} | |
if (path.basename(pkgA.path) == 'example' && !path.basename(pkgB.path) == 'example' ) { | |
return -1; | |
} | |
return pkgA.compareTo(pkgB); |
Or alternatively
if (path.basename(pkgB.path) == 'example') { | |
return 1; | |
} | |
if (path.basename(pkgA.path) == 'example') { | |
return -1; | |
} | |
return pkgA.compareTo(pkgB); | |
if (path.basename(pkgB.path) == 'example' && path.basename(pkgA.path) == 'example') { | |
return pkgA.compareTo(pkgB); | |
} | |
if (path.basename(pkgB.path) == 'example') { | |
return 1; | |
} | |
if (path.basename(pkgA.path) == 'example') { | |
return -1; | |
} | |
return pkgA.compareTo(pkgB); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, yeah it was just to get examples before their parent packages. I ended up removing this since I switched to using flutter_tools logic for pub get. Before, we were overriding the logic which checked for an example package.
aws_common: | ||
path: ../aws_common | ||
aws_signature_v4: | ||
path: ../aws_signature_v4 | ||
amplify_lints: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not in alphabetical order. When I run aft link
this is updated to be in alphabetical order. You might need to re-run link?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, good catch
import 'package:async/async.dart'; | ||
import 'package:path/path.dart' as p; | ||
|
||
const _deletePaths = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the motivation for deleting these? Should they be regenerated after being deleted? I found it surprising that aft clean
deleted files that were committed to source control.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, I think I had envisioned them not being tracked originally, but this needs to be fixed in mono_repo first.
import 'package:path/path.dart' as path; | ||
|
||
/// Command to bootstrap/link Dart/Flutter packages in the repo. | ||
class BootstrapCommand extends AmplifyCommand { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bootstrap is failing for the authenticator for me. See stack trace below. Are you not seeing that?
amplify_authenticator_example
type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'Map<String, Object>' in type cast
#0 GenerateLocalizationsTarget.build (package:flutter_tools/src/build_system/targets/localizations.dart:66:7)
#1 _BuildInstance._invokeInternal (package:flutter_tools/src/build_system/build_system.dart:847:27)
#2 FlutterBuildSystem.build (package:flutter_tools/src/build_system/build_system.dart:614:16)
#3 generateLocalizationsSyntheticPackage (package:flutter_tools/src/dart/generate_synthetic_packages.dart:58:30)
#4 PackagesGetCommand._runPubGet (package:flutter_tools/src/commands/packages.dart:132:7)
#5 PackagesGetCommand.runCommand (package:flutter_tools/src/commands/packages.dart:175:5)
#6 FlutterCommand.run. (package:flutter_tools/src/runner/flutter_command.dart:1209:27)
#7 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19)
#8 CommandRunner.runCommand (package:args/command_runner.dart:209:13)
#9 FlutterCommandRunner.runCommand. (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
#10 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19)
#11 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
#12 runFlutterPub. (package:aft/src/pub/pub_runner.dart:90:7)
#13 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19)
#14 runFlutterPub (package:aft/src/pub/pub_runner.dart:84:3)
#15 Result.capture. (package:async/src/result/result.dart:87:24)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I have an open PR for it, it's just not merged yet. There's a TODO in there somewhere to make failures in pub get fatal, but right now it just prints them.
Do not delete `pubspec_overrides` since these are being published now commit-id:008c0acd
commit-id:8ca2a62e
Adds the following commands to
aft
:bootstrap
/bs
: Sets up repo for development work (link
+pub get
)clean
: Cleans temporary files and build artifacts for all packageslink
: Links all packages together usingpubspec_overrides.yaml
pub
: Run pub commands for all packages in the repoget
: Runsdart pub get
/flutter pub get
for all packagesupgrade
: Runsdart pub upgrade
/flutter pub upgrade
for all packagespublish
: Runsdart pub publish
/flutter pub publish
for all packages which need publishing