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

Update cli-kit to 3.52 #1579

Merged
merged 5 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .changeset/mean-foxes-hope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'skeleton': patch
---

Update `@shopify/cli` dependency in `package.json`:

```diff
- "@shopify/cli": "3.51.0",
+ "@shopify/cli": "3.52.0",
```
Comment on lines +1 to +10
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@juanpprieto do we need this kind of changeset? Or should we just rely on h2 upgrade?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we do need this changeset so that it would trigger an overall update?

Should add '@shopify/cli-hydrogen': patch as well so that newly generated skeleton template will have the updated cli package version

5 changes: 5 additions & 0 deletions .changeset/tender-cooks-dance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/cli-hydrogen': patch
---

Update cli-kit dependency for bug fixes.
Comment on lines +1 to +5
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@wizardlyhel it's already here 👀

2 changes: 1 addition & 1 deletion examples/customer-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"dependencies": {
"@remix-run/react": "2.1.0",
"@remix-run/server-runtime": "2.1.0",
"@shopify/cli": "3.51.0",
"@shopify/cli": "3.52.0",
"@shopify/cli-hydrogen": "^6.1.0",
"@shopify/hydrogen": "^2023.10.3",
"@shopify/remix-oxygen": "^2.0.2",
Expand Down
2 changes: 1 addition & 1 deletion examples/express/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"devDependencies": {
"@remix-run/dev": "2.1.0",
"@remix-run/eslint-config": "2.1.0",
"@shopify/cli": "3.51.0",
"@shopify/cli": "3.52.0",
"@shopify/cli-hydrogen": "^6.1.0",
"@types/compression": "^1.7.2",
"@types/express": "^4.17.17",
Expand Down
2 changes: 1 addition & 1 deletion examples/optimistic-cart-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"dependencies": {
"@remix-run/react": "2.1.0",
"@remix-run/server-runtime": "2.1.0",
"@shopify/cli": "3.51.0",
"@shopify/cli": "3.52.0",
"@shopify/cli-hydrogen": "^6.1.0",
"@shopify/hydrogen": "~2023.10.3",
"@shopify/remix-oxygen": "^2.0.2",
Expand Down
82 changes: 41 additions & 41 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@ast-grep/napi": "0.11.0",
"@graphql-codegen/cli": "5.0.0",
"@oclif/core": "2.11.7",
"@shopify/cli-kit": "3.51.0",
"@shopify/cli-kit": "3.52.0",
"@shopify/hydrogen-codegen": "^0.1.0",
"@shopify/mini-oxygen": "^2.2.4",
"@shopify/oxygen-cli": "2.6.2",
Expand Down
23 changes: 7 additions & 16 deletions packages/cli/src/lib/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
} from './shopify-config.js';
import {getUserAccount} from './graphql/business-platform/user-account.js';
import {muteAuthLogs} from './log.js';
import {deferPromise} from './defer.js';

export type {AdminSession};

Expand Down Expand Up @@ -62,21 +63,12 @@ export async function login(root?: string, shop?: string | true) {
forcePrompt ||
shop !== existingConfig.shop
) {
// There's some bug in cli-kit that causes the process to exit when
// waiting for `keypress` in some situations. It seems that Node gets
// in a state where the event loop is empty while awaiting, and then exits.
// Adding a dummy timeout here to keep the event loop busy fixes it.
// Ref: https://github.com/Shopify/cli/issues/3055
const dummyTimeout = setTimeout(() => {}, 600000);

const token = await ensureAuthenticatedBusinessPlatform().catch(() => {
throw new AbortError(
'Unable to authenticate with Shopify. Please report this issue.',
);
});

clearTimeout(dummyTimeout);

const userAccount = await getUserAccount(token);
await hideLoginInfo();

Expand Down Expand Up @@ -116,10 +108,7 @@ export async function login(root?: string, shop?: string | true) {
}

function showLoginInfo() {
let deferredResolve: (value?: unknown) => void;
const promise = new Promise((resolve) => {
deferredResolve = resolve;
});
const deferred = deferPromise();

console.log('');

Expand Down Expand Up @@ -161,25 +150,27 @@ function showLoginInfo() {
{
title: 'Waiting for Shopify authentication',
task: async () => {
await promise;
await deferred.promise;
},
},
]);
});
},
});

promise.then(() => {
deferred.promise.then(() => {
restoreLogs();
if (hasLoggedPressKey) {
process.stdout.write(ansiEscapes.eraseLines(hasLoggedTimeout ? 11 : 10));
}
});

return async () => {
deferredResolve();
deferred.resolve();
// Without this timeout the process exits
// right after `renderTasks` is done.
// In some cases, it makes renderPrompt to return
// `undefined` without showing the prompt.
await new Promise((resolve) => setTimeout(resolve, 0));
};
}
Expand Down
14 changes: 14 additions & 0 deletions packages/cli/src/lib/defer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* Creates a promise that can be resolved or rejected from the outter scope.
*/
export function deferPromise() {
let resolve = (value?: unknown) => {};
let reject = resolve;

const promise = new Promise((_resolve, _reject) => {
resolve = _resolve;
reject = _reject;
});

return {promise, resolve, reject};
}
Loading
Loading