Skip to content

Commit fa7fa0c

Browse files
committed
Find uxp app
1 parent 683eb37 commit fa7fa0c

File tree

4 files changed

+29
-14
lines changed

4 files changed

+29
-14
lines changed

packages/uxp-devtools-cli/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@adobe-fixed-uxp/uxp-devtools-cli",
3-
"version": "1.5.2",
3+
"version": "1.5.8",
44
"description": "Command line interface for rapid UXP plugin development",
55
"main": "src/uxp.js",
66
"scripts": {
@@ -33,6 +33,7 @@
3333
"@adobe/uxp-template-ps-react-typescript": "^1.0.0",
3434
"@adobe/uxp-template-ps-starter": "^1.0.0",
3535
"@adobe/uxp-template-xd-starter": "^1.0.0",
36+
"app-path": "^3.3.0",
3637
"chalk": "^3.0.0",
3738
"cli-table3": "^0.6.0",
3839
"prompts": "^2.3.2",

packages/uxp-devtools-cli/scripts/setupInspectApp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const path = require("path");
1313
const { execSync } = require("child_process");
1414

1515
function generateDevtoolsAppPacakge() {
16-
let uxpDevtoolAppDir = require.resolve("@adobe/uxp-inspect-frontend/package.json");
16+
let uxpDevtoolAppDir = require.resolve("@adobe-fixed-uxp/uxp-inspect-frontend/package.json");
1717
uxpDevtoolAppDir = path.dirname(uxpDevtoolAppDir);
1818

1919
execSync("yarn package", {

packages/uxp-devtools-cli/src/cli/utils/CLICDTInspectMgr.js

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,31 @@ governing permissions and limitations under the License.
1313
const path = require("path");
1414
const child_process = require("child_process");
1515
const process = require("process");
16+
const appPath = require("app-path");
1617
const { createDeferredPromise } = require("./common");
1718

1819
function getDevtoolsAppExecutablePath() {
19-
let uxpDevtoolAppDir = require.resolve("@adobe/uxp-inspect-frontend/package.json");
20-
uxpDevtoolAppDir = path.dirname(uxpDevtoolAppDir);
21-
2220
const productName = "Adobe UXP Developer Tool";
23-
const baseFolder = path.resolve(uxpDevtoolAppDir, "dist");
21+
try {
22+
let uxpDevtoolAppDir = require.resolve("@adobe-fixed-uxp/uxp-inspect-frontend/package.json");
23+
uxpDevtoolAppDir = path.dirname(uxpDevtoolAppDir);
2424

25-
let executablePath = "";
26-
if (process.platform === "darwin") {
27-
executablePath = `${baseFolder}/mac/${productName}.app/Contents/MacOS/${productName}`;
28-
}
29-
else if (process.platform === "win32") {
30-
executablePath = `${baseFolder}/win-unpacked/${productName}.exe`;
31-
}
25+
const baseFolder = path.resolve(uxpDevtoolAppDir, "dist");
3226

33-
return executablePath;
27+
let executablePath = "";
28+
if (process.platform === "darwin") {
29+
executablePath = `${baseFolder}/mac/${productName}.app/Contents/MacOS/${productName}`;
30+
}
31+
else if (process.platform === "win32") {
32+
executablePath = `${baseFolder}/win-unpacked/${productName}.exe`;
33+
}
34+
35+
return executablePath;
36+
} catch (e) {
37+
const p = appPath.sync(productName);
38+
if (!p) throw new Error(`${productName} not found`);
39+
return `${p}/Contents/MacOS/${productName}`;
40+
}
3441
}
3542

3643
function wrapArg(name, arg) {

yarn.lock

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2894,6 +2894,13 @@ app-builder-lib@23.6.0:
28942894
tar "^6.1.11"
28952895
temp-file "^3.4.0"
28962896

2897+
app-path@^3.3.0:
2898+
version "3.3.0"
2899+
resolved "https://registry.yarnpkg.com/app-path/-/app-path-3.3.0.tgz#0342a909db37079c593979c720f99e872475eba3"
2900+
integrity sha512-EAgEXkdcxH1cgEePOSsmUtw9ItPl0KTxnh/pj9ZbhvbKbij9x0oX6PWpGnorDr0DS5AosLgoa5n3T/hZmKQpYA==
2901+
dependencies:
2902+
execa "^1.0.0"
2903+
28972904
append-transform@^2.0.0:
28982905
version "2.0.0"
28992906
resolved "https://registry.npmjs.org/append-transform/-/append-transform-2.0.0.tgz#99d9d29c7b38391e6f428d28ce136551f0b77e12"

0 commit comments

Comments
 (0)