Add non-mutating auth alias support#7859
Conversation
d4133d5 to
98c5dc8
Compare
|
Just tested this, works great! +1 on wanting this in the official CLI |
|
Hey @gonzaloriestra, would it be possible for someone to take a look please? I think it's a really useful feature but I hate using a custom build 😅 |
|
@GeorgiZhelev thanks for the contribution! I think it makes sense, but let me share it internally. |
|
Ok, the team agrees! But we prefer to call it Could you change it? Or I can take care of it in another PR. What do you prefer? |
|
@gonzaloriestra happy you guys like the change! I've renamed it and added it for the app commands too. I'm not quite sure about the merge conflicts though! |
|
Great, thanks! Regarding the conflicts, there were some recent changes in main in some files you touched, so you need to rebase and re-apply your changes there. Agents usually solve that very well. Also, instead of adding the flags to all commands, you could add them to |
6f575c7 to
1362890
Compare
|
@gonzaloriestra Done for both :) |
What changed
sessionIdoption.findSessionIdByAlias(alias)helper for resolving account aliases without changing the current global session.--aliasto--auth-aliaswhile keepingSHOPIFY_FLAG_AUTH_ALIAS.--auth-aliasthrough Shopify theme commands and app commands that perform authenticated platform lookups.@shopify/cli-kit,@shopify/theme, and@shopify/app.Why
Theme and app commands previously relied on the globally selected CLI account session. This allows commands like:
without mutating the current global CLI session.
Validation
pnpm vitest run packages/cli-kit/src/private/node/session.test.ts packages/cli-kit/src/public/node/session.test.ts packages/theme/src/cli/utilities/theme-command.test.ts packages/theme/src/cli/utilities/theme-environment/dev-server-session.test.ts packages/theme/src/cli/services/metafields-pull.test.tspassed: 5 files, 98 tests.pnpm vitest run packages/theme/src/cli/utilities/theme-command.test.ts packages/app/src/cli/utilities/auth-alias.test.ts packages/app/src/cli/services/app-context.test.ts packages/app/src/cli/commands/app/init.test.ts packages/app/src/cli/utilities/execute-command-helpers.test.ts packages/app/src/cli/utilities/developer-platform-client/app-management-client.test.ts packages/app/src/cli/utilities/developer-platform-client/partners-client.test.ts packages/app/src/cli/services/dev/processes/theme-app-extension.test.ts packages/app/src/cli/utilities/extensions/fetch-product-variant.test.ts packages/app/src/cli/services/function/common.test.tspassed: 10 files, 164 tests.pnpm nx run app:type-checkpassed.pnpm nx run theme:type-checkpassed.pnpm nx run app:lintpassed.pnpm nx run theme:lintpassed.pnpm nx run cli-kit:lintpassed.pnpm refresh-manifestspassed.pnpm refresh-readmepassed.pnpm refresh-code-documentationpassed.pnpm build-dev-docspassed.git diff --checkpassed.Notes:
~/Library/Preferences; rerunning with filesystem access passed.