Skip to content
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(cli): improve migration runner output #5904

Merged
merged 4 commits into from
Mar 13, 2024

Conversation

juice49
Copy link
Contributor

@juice49 juice49 commented Mar 5, 2024

Description

The migration run commands can be run from any Studio project subdirectory, but their output messages currently assume the user is in the project root. This branch makes the output clearer, and adds consistent list formatting when multiple migrations are found.

Before

When no migrations found
sanity migration run nonexistent
Not in project directory, assuming context of project at /Users/ash/projects/sanity/dev/test-studio

Error: No migration found for "nonexistent" in current directory. Make sure that the migration file exists and exports a valid migration as its default export.
 Tried the following files:
 - migrations/nonexistent.mjs
 - migrations/nonexistent.js
 - migrations/nonexistent.ts
 - migrations/nonexistent.cjs
 - migrations/nonexistent/index.mjs
 - migrations/nonexistent/index.js
 - migrations/nonexistent/index.ts
 - migrations/nonexistent/index.cjs
When multiple migrations found
sanity migration run multiple
Not in project directory, assuming context of project at /Users/ash/projects/sanity/dev/test-studio

Error: Found multiple migrations for "multiple" in current directory migrations/multiple.mjs, migrations/multiple.js, migrations/multiple.ts, migrations/multiple.cjs, migrations/multiple/index.mjs, migrations/multiple/index.js, migrations/multiple/index.ts, migrations/multiple/index.cjs

After

When no migrations found
sanity migration run nonexistent
Not in project directory, assuming context of project at /Users/ash/projects/sanity/dev/test-studio

Error: No migration found for "nonexistent" in the /Users/ash/projects/sanity/dev/test-studio/migrations directory. Make sure that the migration file exists and exports a valid migration as its default export.
 Tried the following files:
 - nonexistent.mjs
 - nonexistent.js
 - nonexistent.ts
 - nonexistent.cjs
 - nonexistent/index.mjs
 - nonexistent/index.js
 - nonexistent/index.ts
 - nonexistent/index.cjs
When multiple migrations found
sanity migration run multiple
Not in project directory, assuming context of project at /Users/ash/projects/sanity/dev/test-studio

Error: Found multiple migrations for "multiple" in the /Users/ash/projects/sanity/dev/test-studio/migrations directory:
 - multiple.mjs
 - multiple.js
 - multiple.ts
 - multiple.cjs
 - multiple/index.mjs
 - multiple/index.js
 - multiple/index.ts
 - multiple/index.cjs

What to review

Do the adjusted output messages make sense?

Testing

Attempt to run migrations that are nonexistent, or have multiple matching scripts, from both a Studio project root directory and a Studio project subdirectory.

Copy link

vercel bot commented Mar 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
performance-studio ✅ Ready (Inspect) Visit Preview Mar 13, 2024 4:51pm
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 13, 2024 4:51pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Mar 13, 2024 4:51pm

Copy link
Contributor

github-actions bot commented Mar 5, 2024

No changes to documentation

Copy link
Contributor

github-actions bot commented Mar 5, 2024

Component Testing Report Updated Mar 13, 2024 4:54 PM (UTC)

File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 31s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 6s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 12s 3 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 13s 4 2 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 12s 6 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 32s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 59s 15 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 3s 18 0 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 12s 6 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 13s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 20s 9 0 0

Copy link
Member

@rexxars rexxars left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@juice49 juice49 requested a review from a team March 13, 2024 16:37
@juice49 juice49 requested review from a team and thebiggianthead as code owners March 13, 2024 16:37
@juice49 juice49 requested review from hermanwikner and removed request for a team March 13, 2024 16:37
@juice49 juice49 force-pushed the feat/improve-migration-runner-messages branch from feb2431 to cda4a56 Compare March 13, 2024 16:38
@juice49 juice49 force-pushed the feat/improve-migration-runner-messages branch from d1d34ef to 7bfbfe9 Compare March 13, 2024 16:42
@juice49 juice49 changed the title Feat/improve migration runner messages feat(cli): improve migration runner output Mar 13, 2024
@juice49 juice49 added this pull request to the merge queue Mar 13, 2024
Merged via the queue into next with commit 11d15ce Mar 13, 2024
36 checks passed
@juice49 juice49 deleted the feat/improve-migration-runner-messages branch March 13, 2024 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants