-
Notifications
You must be signed in to change notification settings - Fork 438
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
fix(cli): do not throw during migrate if project ID is passed through flag #7594
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
a89c1aa
to
8149b70
Compare
…the --project option instead of the cli config
No changes to documentation |
Component Testing Report Updated Oct 5, 2024 2:25 PM (UTC) ✅ All Tests Passed -- expand for details
|
@@ -164,9 +164,15 @@ const runMigrationCommand: CliCommandDefinition<CreateFlags> = { | |||
|
|||
const projectConfig = apiClient({ | |||
requireUser: true, | |||
requireProject: true, | |||
requireProject: false, |
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.
I left this in as false
instead of removing it so that it would indicate that false
is intended here.
⚡️ Editor Performance ReportUpdated Sat, 05 Oct 2024 14:37:11 GMT
Detailed information🏠 Reference resultThe performance result of
🧪 Experiment resultThe performance result of this branch
📚 Glossary
|
packages/sanity/src/_internal/cli/commands/migration/runMigrationCommand.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Espen Hovlandsdal <espen@hovlandsdal.com>
… flag (#7594) ### Description This PR sets the `apiClient`'s `requireProject` to `false` and instead only throws an error if both the cli config and the `--project` option are missing ### What to review Verify that the change is as expected and that the wording of the error is correct. ### Testing * create a simple migration script with sanity, `sanity migration create` and follow the prompt make sure there is no `sanity.cli.js` in your codebase Next steps: * Open /code/migrations/migration_id/index.ts in your code editor and write the code for your migration. * Dry run the migration with: `sanity migration run migration_id --project= --dataset` * Run the migration against a dataset with: `sanity migration run migration_id --project= --dataset --no-dry-run` * edit the script and run it as: `sanity migration run migration_id --project=real_project_id --dataset real_dataset` you should NOT get an error. Test again without specifying a `--project` project ID, you should see an error. ### Notes for release None <!-- Engineers do not need to worry about the final copy, but they must provide the docs team with enough context on: * What changed * How does one use it (code snippets, etc) * Are there limitations we should be aware of If this is PR is a partial implementation of a feature and is not enabled by default or if this PR does not contain changes that needs mention in the release notes (tooling chores etc), please call this out explicitly by writing "Part of feature X" or "Not required" in this section. --> --------- Co-authored-by: Espen Hovlandsdal <espen@hovlandsdal.com>
Description
This PR sets the
apiClient
'srequireProject
tofalse
and instead only throws an error if both the cli config and the--project
option are missingWhat to review
Verify that the change is as expected and that the wording of the error is correct.
Testing
sanity migration create
and follow the promptmake sure there is no
sanity.cli.js
in your codebaseNext steps:
Open /code/migrations/migration_id/index.ts in your code editor and write the code for your migration.
Dry run the migration with:
sanity migration run migration_id --project= --dataset
Run the migration against a dataset with:
sanity migration run migration_id --project= --dataset --no-dry-run
edit the script and run it as:
sanity migration run migration_id --project=real_project_id --dataset real_dataset
you should NOT get an error.
Test again without specifying a
--project
project ID, you should see an error.Notes for release
None