Skip to content

Commit

Permalink
Add command to open expo upgrade helper in web page (#2232)
Browse files Browse the repository at this point in the history
* Add command to open expo upgrade helper in web page

* Fix security issue (#2239)

---------

Co-authored-by: Ezio Li <[email protected]>
  • Loading branch information
lexie011 and EzioLi01 authored Nov 5, 2024
1 parent 8bbc3e4 commit a67b9bd
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 49 deletions.
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,12 @@
"title": "Enable & Disable Expo Hermes",
"category": "React Native",
"enablement": "!config.security.workspace.trust.enabled || isWorkspaceTrusted"
},
{
"command": "reactNative.openExpoUpgradeHelper",
"title": "Open expo upgrade helper in web page",
"category": "React Native",
"enablement": "!config.security.workspace.trust.enabled || isWorkspaceTrusted"
}
],
"menus": {
Expand Down
1 change: 1 addition & 0 deletions src/common/error/errorStrings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -421,4 +421,5 @@ export const ERROR_STRINGS = {
),
[InternalErrorCode.FailedToEnableHermes]: "Failed to make changes to Hermes",
[InternalErrorCode.FailedToEnableExpoHermes]: "Failed to make changes to Expo Hermes",
[InternalErrorCode.FailedToOpenExpoUpgradeHelper]: "Failed to open expo upgrade helper",
};
1 change: 1 addition & 0 deletions src/common/error/internalErrorCode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export enum InternalErrorCode {
FailedToReopenQRCode = 129,
FailedToEnableHermes = 130,
FailedToEnableExpoHermes = 131,
FailedToOpenExpoUpgradeHelper = 132,

// Device Deployer errors
IOSDeployNotFound = 201,
Expand Down
1 change: 1 addition & 0 deletions src/extension/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ export * from "./prebuildClean";
export * from "./reopenQRCode";
export * from "./enableHermes";
export * from "./enableExpoHemes";
export * from "./openExpoUpgradeHelper";
24 changes: 24 additions & 0 deletions src/extension/commands/openExpoUpgradeHelper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.

import * as assert from "assert";
import * as vscode from "vscode";
import { OutputChannelLogger } from "../log/OutputChannelLogger";
import { ErrorHelper } from "../../common/error/errorHelper";
import { InternalErrorCode } from "../../common/error/internalErrorCode";
import { Command } from "./util/command";

const logger = OutputChannelLogger.getMainChannel();

export class openExpoUpgradeHelper extends Command {
codeName = "openExpoUpgradeHelper";
label = "Open expo upgrade helper in web page";
error = ErrorHelper.getInternalError(InternalErrorCode.FailedToOpenExpoUpgradeHelper);

async baseFn(): Promise<void> {
assert(this.project);
const ExpoUrl = "https://docs.expo.dev/bare/upgrade";
logger.info("Open expo upgrade helper in web browser.");
await vscode.env.openExternal(vscode.Uri.parse(ExpoUrl));
}
}
55 changes: 6 additions & 49 deletions test/smoke/package/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1636,22 +1636,6 @@ bluebird@^2.9.34:
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-2.11.0.tgz#534b9033c022c9579c56ba3b3e5a5caafbb650e1"
integrity sha512-UfFSr22dmHPQqPP9XWHRhq+gWnHCYguQGkXQlbyPtW5qTnhFWA8/iXg765tH0cAjy7l/zPJ1aBTO0g5XgA7kvQ==

[email protected]:
version "1.18.3"
resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.18.3.tgz#5b292198ffdd553b3a0f20ded0592b956955c8b4"
integrity sha512-YQyoqQG3sO8iCmf8+hyVpgHHOv0/hCEFiS4zTGUwTA1HjAFX66wRcNQrVCeJq9pgESMRvUAOvSil5MJlmccuKQ==
dependencies:
bytes "3.0.0"
content-type "~1.0.4"
debug "2.6.9"
depd "~1.1.2"
http-errors "~1.6.3"
iconv-lite "0.4.23"
on-finished "~2.3.0"
qs "6.5.2"
raw-body "2.3.3"
type-is "~1.6.16"

[email protected], body-parser@^1.20.1:
version "1.20.3"
resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.3.tgz#1953431221c6fb5cd63c4b36d53fab0928e548c6"
Expand All @@ -1665,7 +1649,7 @@ [email protected], body-parser@^1.20.1:
http-errors "2.0.0"
iconv-lite "0.4.24"
on-finished "2.4.1"
qs "6.13.0"
qs "~6.5.2"
raw-body "2.5.2"
type-is "~1.6.18"
unpipe "1.0.0"
Expand Down Expand Up @@ -3025,7 +3009,7 @@ express@^4.17.3:
parseurl "~1.3.3"
path-to-regexp "0.1.10"
proxy-addr "~2.0.7"
qs "6.13.0"
qs "~6.5.2"
range-parser "~1.2.1"
safe-buffer "5.2.1"
send "0.19.0"
Expand Down Expand Up @@ -5049,12 +5033,7 @@ node-fetch@^2.6.0, node-fetch@^2.6.1:
dependencies:
whatwg-url "^5.0.0"

[email protected]:
version "0.10.0"
resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.10.0.tgz#32dea2afb3e9926f02ee5ce8794902691a676bf3"
integrity sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==

node-forge@^1:
node-forge@^1.3.0:
version "1.3.1"
resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-1.3.1.tgz#be8da2af243b2417d5f646a770663a92b7e9ded3"
integrity sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==
Expand Down Expand Up @@ -5487,11 +5466,6 @@ [email protected]:
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.10.tgz#67e9108c5c0551b9e5326064387de4763c4d5f8b"
integrity "sha1-Z+kQjFwFUbnlMmBkOH3kdjxNX4s= sha512-7lf7qcQidTku0Gu3YDPc8DJ1q7OOucfa/BSsIwjuh56VU7katFvuM8hULfkwB3Fns/rsVF7PwPKVw1sl5KQS9w=="

[email protected]:
version "0.1.7"
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c"
integrity sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==

path-type@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b"
Expand Down Expand Up @@ -5971,19 +5945,7 @@ puppeteer-core@^13.0.0:
rimraf "3.0.2"
tar-fs "2.1.1"
unbzip2-stream "1.4.3"
ws "8.5.0"

[email protected]:
version "6.13.0"
resolved "https://registry.yarnpkg.com/qs/-/qs-6.13.0.tgz#6ca3bd58439f7e245655798997787b0d88a51906"
integrity sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==
dependencies:
side-channel "^1.0.6"

[email protected]:
version "6.5.2"
resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36"
integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==
ws "^8.17.1"

qs@~6.5.2:
version "6.5.3"
Expand Down Expand Up @@ -6384,7 +6346,7 @@ selfsigned@^2.1.1:
integrity sha512-th5B4L2U+eGLq1TVh7zNRGBapioSORUeymIydxgFpwww9d2qyKvtuPU2jJuHvYAwwqi2Y596QBL3eEqcPEYL8Q==
dependencies:
"@types/node-forge" "^1.3.0"
node-forge "^1"
node-forge "^1.3.0"

[email protected]:
version "7.3.2"
Expand Down Expand Up @@ -7713,11 +7675,6 @@ write-file-atomic@^2.3.0:
imurmurhash "^0.1.4"
signal-exit "^3.0.2"

[email protected]:
version "8.5.0"
resolved "https://registry.yarnpkg.com/ws/-/ws-8.5.0.tgz#bfb4be96600757fe5382de12c670dab984a1ed4f"
integrity sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==

ws@^8.13.0:
version "8.18.0"
resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.0.tgz#0d7505a6eafe2b0e712d232b42279f53bc289bbc"
Expand Down Expand Up @@ -7773,7 +7730,7 @@ [email protected]:
md5hex "1.0.0"
minimatch "3.0.4"
mv "2.1.1"
node-forge "0.10.0"
node-forge "^1.3.0"
nullthrows "1.1.1"
p-map "3.0.0"
p-retry "4.1.0"
Expand Down

0 comments on commit a67b9bd

Please sign in to comment.