-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add UpdateCommand #111
Add UpdateCommand #111
Conversation
…ecker; update update script (only generate shell scripts); add update check
eecee1b
to
1ffe08b
Compare
Maybe we should also uses this command to update the bundled dart runtime ( |
When running
Everything is correctly updated and executed from the dart side, but an error (exit code 2) is thrown from the
I guess because we're modifying the file which is currently being executed? 🤔 |
f71197e
to
f837769
Compare
# Conflicts: # sidekick/test/util/cli_runner.dart # sidekick_test/lib/src/local_testing.dart
# Conflicts: # sidekick_core/lib/sidekick_core.dart # sidekick_test/lib/src/local_testing.dart
# Conflicts: # sidekick_core/lib/src/version_checker.dart # sidekick_core/test/version_checker_test.dart
Fixes #96
Scope of this PR
pubspec.yaml
template now contains a fieldsidekick: cli_version: <version>
which contains thesidekick
version the CLI was generated withUpdateCommand
which calls the latest available version ofupdate_sidekick_cli.dart
update_sidekick_cli
currently updates the following:tool
(download_dart.sh
,install.sh
,run.sh
,sidekick_config.sh
)sidekick_core
dependency to latest available versionsidekick->cli_version
inpubspec.yaml
to latest availablesidekick
versionNecessary work in following PRs
Update
sidekick_core
insidekick
and pass new sidekick version parameter toSidekickTemplateProperties
When generating a new sidekick CLI package, we have to save the version of sidekick which generated the CLI in the generated CLI's
<generated-cli>/pubspec.yaml
. However, we can't read the global sidekick's version because its executable is compiled and thus does not have access to its own<global-sidekick>/pubspec.yaml
because it isn't bundled with the compiled executable.Instead we could use an automatically generated source file which contains the version information
See e.g. https://stackoverflow.com/a/69048343/9905602 or how mason_cli implements this in a version.dart file: https://github.com/felangel/mason/pull/538/files
We should save the version of
sidekick_core
fromsidekick
'spubspec.lock
in a Dart fileAdd migration functions
Whenever additional steps (besides regenerating shell scripts) are needed to migrate from an old to the latest version, add them to
update_sidekick_cli.dart
. This script receives the current and the latest version. This information can be used to call migration functions to do additional update steps (e.g. modifying certain lines in dart files).How to test this PR
There is a
update_command_test.dart
which already tests this command.If you want to test this manually, do the following:
pubspec.yaml
of an old sidekick CLISidekickCommand
to the cli<cli> sidekick update
tool
have been updatedcli_version
has been updated to the latest version ofsidekick
(0.7.1
)sidekick_core
dependency has been updated tosidekick_core: '>=0.11.1 <1.0.0'
Successfully updated sidekick CLI <cli> from version 0.0.0 to 0.7.1!
)