Skip to content

Commit

Permalink
fix: add import of open
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed Feb 9, 2024
1 parent 5274dbd commit ff615c3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/fluffy-knives-promise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"jsx-mail": patch
---

add import of open
1 change: 1 addition & 0 deletions packages/jsx-mail/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"gluegun": "^5.1.6",
"json5": "^2.2.3",
"loading-cli": "^1.1.2",
"open": "^10.0.3",
"socket.io": "^4.7.2"
},
"devDependencies": {
Expand Down
13 changes: 7 additions & 6 deletions packages/jsx-mail/src/request-login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { showError } from "./utils/show-error";
import express from 'express';
import http from 'http';
import load from "./utils/load";
import open from "open";
import { getCurrentIp } from "./utils/get-current-ip";
import path from "path";

Expand Down Expand Up @@ -87,11 +86,13 @@ export default async function requestLogin(receivedToken?: string) {
server.listen(PORT);

const url = `${core.WEBSITE_URL}/cloud/sign-in?redirect=http://localhost:${PORT}/callback`;
open(url, { wait: true }).then(() => {
load.text = `Please, log in to your account: ${url}`
}).catch(() => {
server.close();
reject(new Error('Failed to open browser'));
import('open').then(({ default: open }) => {
open(url, { wait: true }).then(() => {
load.text = `Please, log in to your account: ${url}`
}).catch(() => {
server.close();
reject(new Error('Failed to open browser'));
})
})
})
const newToken = core.getToken();
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13776,7 +13776,7 @@ onetime@^6.0.0:
dependencies:
mimic-fn "^4.0.0"

open@*:
open@*, open@^10.0.3:
version "10.0.3"
resolved "https://registry.yarnpkg.com/open/-/open-10.0.3.tgz#f60d8db49fa126c50aec751957fb5d7de3308d4f"
integrity sha512-dtbI5oW7987hwC9qjJTyABldTaa19SuyJse1QboWv3b0qCcrrLNVDqBx1XgELAjh9QTVQaP/C5b1nhQebd1H2A==
Expand Down

0 comments on commit ff615c3

Please sign in to comment.