Skip to content

Commit

Permalink
Find uxp app
Browse files Browse the repository at this point in the history
  • Loading branch information
hansottowirtz committed Feb 9, 2023
1 parent 683eb37 commit fa7fa0c
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 14 deletions.
3 changes: 2 additions & 1 deletion packages/uxp-devtools-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@adobe-fixed-uxp/uxp-devtools-cli",
"version": "1.5.2",
"version": "1.5.8",
"description": "Command line interface for rapid UXP plugin development",
"main": "src/uxp.js",
"scripts": {
Expand Down Expand Up @@ -33,6 +33,7 @@
"@adobe/uxp-template-ps-react-typescript": "^1.0.0",
"@adobe/uxp-template-ps-starter": "^1.0.0",
"@adobe/uxp-template-xd-starter": "^1.0.0",
"app-path": "^3.3.0",
"chalk": "^3.0.0",
"cli-table3": "^0.6.0",
"prompts": "^2.3.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/uxp-devtools-cli/scripts/setupInspectApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const path = require("path");
const { execSync } = require("child_process");

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

execSync("yarn package", {
Expand Down
31 changes: 19 additions & 12 deletions packages/uxp-devtools-cli/src/cli/utils/CLICDTInspectMgr.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,31 @@ governing permissions and limitations under the License.
const path = require("path");
const child_process = require("child_process");
const process = require("process");
const appPath = require("app-path");
const { createDeferredPromise } = require("./common");

function getDevtoolsAppExecutablePath() {
let uxpDevtoolAppDir = require.resolve("@adobe/uxp-inspect-frontend/package.json");
uxpDevtoolAppDir = path.dirname(uxpDevtoolAppDir);

const productName = "Adobe UXP Developer Tool";
const baseFolder = path.resolve(uxpDevtoolAppDir, "dist");
try {
let uxpDevtoolAppDir = require.resolve("@adobe-fixed-uxp/uxp-inspect-frontend/package.json");
uxpDevtoolAppDir = path.dirname(uxpDevtoolAppDir);

let executablePath = "";
if (process.platform === "darwin") {
executablePath = `${baseFolder}/mac/${productName}.app/Contents/MacOS/${productName}`;
}
else if (process.platform === "win32") {
executablePath = `${baseFolder}/win-unpacked/${productName}.exe`;
}
const baseFolder = path.resolve(uxpDevtoolAppDir, "dist");

return executablePath;
let executablePath = "";
if (process.platform === "darwin") {
executablePath = `${baseFolder}/mac/${productName}.app/Contents/MacOS/${productName}`;
}
else if (process.platform === "win32") {
executablePath = `${baseFolder}/win-unpacked/${productName}.exe`;
}

return executablePath;
} catch (e) {
const p = appPath.sync(productName);
if (!p) throw new Error(`${productName} not found`);
return `${p}/Contents/MacOS/${productName}`;
}
}

function wrapArg(name, arg) {
Expand Down
7 changes: 7 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2894,6 +2894,13 @@ [email protected]:
tar "^6.1.11"
temp-file "^3.4.0"

app-path@^3.3.0:
version "3.3.0"
resolved "https://registry.yarnpkg.com/app-path/-/app-path-3.3.0.tgz#0342a909db37079c593979c720f99e872475eba3"
integrity sha512-EAgEXkdcxH1cgEePOSsmUtw9ItPl0KTxnh/pj9ZbhvbKbij9x0oX6PWpGnorDr0DS5AosLgoa5n3T/hZmKQpYA==
dependencies:
execa "^1.0.0"

append-transform@^2.0.0:
version "2.0.0"
resolved "https://registry.npmjs.org/append-transform/-/append-transform-2.0.0.tgz#99d9d29c7b38391e6f428d28ce136551f0b77e12"
Expand Down

0 comments on commit fa7fa0c

Please sign in to comment.